From a6d0c7fa2f440dcb0eda81a85d563184afcb52a6 Mon Sep 17 00:00:00 2001 From: Ward Vandewege Date: Thu, 17 Feb 2022 16:31:23 -0500 Subject: [PATCH] 18772: arvados-dispatch-cloud: add IamInstanceProfile field to the ec2 driver. Arvados-DCO-1.1-Signed-off-by: Ward Vandewege --- lib/cloud/ec2/ec2.go | 21 ++++++++++++++------- lib/config/config.default.yml | 1 + 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/cloud/ec2/ec2.go b/lib/cloud/ec2/ec2.go index 269a7d8def..2cbe4cf290 100644 --- a/lib/cloud/ec2/ec2.go +++ b/lib/cloud/ec2/ec2.go @@ -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 { diff --git a/lib/config/config.default.yml b/lib/config/config.default.yml index a7ce982857..07ff772e21 100644 --- a/lib/config/config.default.yml +++ b/lib/config/config.default.yml @@ -1269,6 +1269,7 @@ Clusters: Region: "" EBSVolumeType: gp2 AdminUsername: debian + IamInstanceProfile: "" # (azure) Credentials. SubscriptionID: "" -- 2.30.2