Use IAM role instead of user credentials
Note
This feature requires Tower 21.06.0 or later.
AWS-based customers can configure Tower to interact with other AWS Services like Batch using an IAM Role rather than providing IAM User credentials.
Configure the Tower IAM Policy#
Assumptions in Provided Policies
The provided policies were designed with certain assumptions:
- IAM Policy: Tower and Nextflow should have whole access to identified S3 Buckets.
- Trust Policy: The Role should be assumable by EC2, ECS, EKS, and only specifically-named IAM actors.
You may wish to limit S3 access to specific prefixes, and/or Role assumption to more specific Platforms.
Create a custom IAM Policy (Tower-Role-Policy.json).
Click to view custom Tower-Role-Policy.json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
- Modify
BucketPolicy01
andBucketPolicy02
with the name(s) of the your S3 Buckets. - Revise (if necessary) the scope of access to a specific prefix in the S3 bucket(s).
Modify the Tower IAM Role Trust Policy (Optional)#
Review and modify the Role Trust Policy (Tower-Role-Trust-Policy.json).
Click to view Tower-Role-Trust-Policy
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
-
Replace
YOUR-AWS-ACCOUNT
with your own AWS Account Id. -
Specify the Users and/or Roles able to assume the Tower IAM Role.
Create the IAM Artefacts#
Create the IAM Artefacts in your AWS Account.
-
Navigate to the folder containing your configured IAM documents:
1
cd <FOLDER_WITH_YOUR_CONFIGURED_IAM_DOCUMENTS>
-
Create the Role:
1
aws iam create-role --role-name Tower-Role --assume-role-policy-document file://Tower-Role-Trust-Policy.json
-
Create an inline policy for the Role:
1
aws iam put-role-policy --role-name Tower-Role --policy-name Tower-Role-Policy --policy-document file://Tower-Role-Policy.json
-
Create an instance profile:
1
aws iam create-instance-profile --instance-profile-name Tower-Instance
-
Bind the Role to the instance profile:
1
aws iam add-role-to-instance-profile --instance-profile-name Tower-Instance --role-name Tower-Role
Configure the Tower Application#
With the IAM artefacts complete, update your Tower application configuration:
-
Add the following entry to your
tower.env
1
TOWER_ALLOW_INSTANCE_CREDENTIALS=true
-
Restart the Tower application.
-
Verify that the change took effect by querying the Tower instance
service-info
endpoint:1
curl -X GET "https://YOUR-TOWER-DOMAIN/api/service-info" -H "Accept: application/json" | jq ".serviceInfo.allowInstanceCredentials"
-
Log in to Tower and create a new AWS credential. You are now prompted for an AWS
arn
instead of access keys.Before Change:
After Change: