18772: arvados-dispatch-cloud: add IamInstanceProfile field to the ec2
authorWard Vandewege <ward@curii.com>
Thu, 17 Feb 2022 21:31:23 +0000 (16:31 -0500)
committerWard Vandewege <ward@curii.com>
Mon, 21 Feb 2022 17:05:39 +0000 (12:05 -0500)
       driver.

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

lib/cloud/ec2/ec2.go
lib/config/config.default.yml

index 269a7d8def59a1e38603633691d657aef29d8e81..2cbe4cf290c1b0e7a9dcaaeb1b701242c0da1cd3 100644 (file)
@@ -40,13 +40,14 @@ const (
 )
 
 type ec2InstanceSetConfig struct {
-       AccessKeyID      string
-       SecretAccessKey  string
-       Region           string
-       SecurityGroupIDs arvados.StringSet
-       SubnetID         string
-       AdminUsername    string
-       EBSVolumeType    string
+       AccessKeyID        string
+       SecretAccessKey    string
+       Region             string
+       SecurityGroupIDs   arvados.StringSet
+       SubnetID           string
+       AdminUsername      string
+       EBSVolumeType      string
+       IamInstanceProfile string
 }
 
 type ec2Interface interface {
@@ -230,6 +231,12 @@ func (instanceSet *ec2InstanceSet) Create(
                        }}
        }
 
+       if instanceSet.ec2config.IamInstanceProfile != "" {
+               rii.IamInstanceProfile = &ec2.IamInstanceProfileSpecification{
+                       Name: aws.String(instanceSet.ec2config.IamInstanceProfile),
+               }
+       }
+
        rsv, err := instanceSet.client.RunInstances(&rii)
        err = wrapError(err, &instanceSet.throttleDelayCreate)
        if err != nil {
index a7ce9828573fb4b5832f49837de19413af4aa6d4..07ff772e21af2a4e39ad57040f51823dbc88f358 100644 (file)
@@ -1269,6 +1269,7 @@ Clusters:
           Region: ""
           EBSVolumeType: gp2
           AdminUsername: debian
+          IamInstanceProfile: ""
 
           # (azure) Credentials.
           SubscriptionID: ""