Skip to main content

AWS Batch IAM policy

Seqera accesses your AWS account through an IAM policy attached to the role or user in your AWS credentials. Create the policy first, then create the credentials that use it. Use this policy for AWS Batch compute environments, with Batch Forge or with existing resources.

Policy​

To create and launch pipelines, explore buckets with Data Explorer, or run Studio sessions with the AWS Batch compute environment, you must provide an IAM user with specific permissions. Some permissions are mandatory to create the compute environment and for it to function correctly. Others are optional. For example, some populate the lists of values that you select from in the Platform UI.

Attach permissions directly to an IAM user, or to an IAM role that the IAM user can assume when it accesses AWS resources.

The following broad, permissive policy includes all the required permissions for a quick start. Follow the principle of least privilege and grant only the permissions your use case needs, as shown in the statement reference.

Full permissive policy (for reference)
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "BatchEnvironmentManagementCanBeRestricted",
"Effect": "Allow",
"Action": [
"batch:CreateComputeEnvironment",
"batch:CreateJobQueue",
"batch:DeleteComputeEnvironment",
"batch:DeleteJobQueue",
"batch:TagResource",
"batch:UpdateComputeEnvironment",
"batch:UpdateJobQueue"
],
"Resource": [
"arn:aws:batch:*:*:compute-environment/TowerForge-*",
"arn:aws:batch:*:*:job-queue/TowerForge-*"
]
},
{
"Sid": "BatchEnvironmentListing",
"Effect": "Allow",
"Action": [
"batch:DescribeComputeEnvironments",
"batch:DescribeJobDefinitions",
"batch:DescribeJobQueues",
"batch:DescribeJobs"
],
"Resource": "*"
},
{
"Sid": "BatchJobsManagementCanBeRestricted",
"Effect": "Allow",
"Action": [
"batch:CancelJob",
"batch:RegisterJobDefinition",
"batch:SubmitJob",
"batch:TagResource",
"batch:TerminateJob"
],
"Resource": [
"arn:aws:batch:*:*:job-definition/*",
"arn:aws:batch:*:*:job-queue/TowerForge-*",
"arn:aws:batch:*:*:job/*"
]
},
{
"Sid": "LaunchTemplateManagement",
"Effect": "Allow",
"Action": [
"ec2:CreateLaunchTemplate",
"ec2:DeleteLaunchTemplate",
"ec2:DescribeLaunchTemplates",
"ec2:DescribeLaunchTemplateVersions"
],
"Resource": "*"
},
{
"Sid": "PassRolesToBatchCanBeRestricted",
"Effect": "Allow",
"Action": "iam:PassRole",
"Resource": "*",
"Condition": {
"StringEquals": {
"iam:PassedToService": [
"batch.amazonaws.com",
"ec2.amazonaws.com",
"ecs-tasks.amazonaws.com"
]
}
}
},
{
"Sid": "CloudWatchLogsAccessCanBeRestricted",
"Effect": "Allow",
"Action": [
"logs:Describe*",
"logs:FilterLogEvents",
"logs:Get*",
"logs:List*",
"logs:StartQuery",
"logs:StopQuery",
"logs:TestMetricFilter"
],
"Resource": "*"
},
{
"Sid": "OptionalS3PlatformDataAccessCanBeRestricted",
"Effect": "Allow",
"Action": [
"s3:Get*",
"s3:List*",
"s3:PutObject"
],
"Resource": "*"
},
{
"Sid": "OptionalIAMManagementCanBeRestricted",
"Effect": "Allow",
"Action": [
"iam:AddRoleToInstanceProfile",
"iam:AttachRolePolicy",
"iam:CreateInstanceProfile",
"iam:CreateRole",
"iam:DeleteInstanceProfile",
"iam:DeleteRole",
"iam:DeleteRolePolicy",
"iam:DetachRolePolicy",
"iam:GetRole",
"iam:ListAttachedRolePolicies",
"iam:ListRolePolicies",
"iam:PutRolePolicy",
"iam:RemoveRoleFromInstanceProfile",
"iam:TagInstanceProfile",
"iam:TagRole"
],
"Resource": [
"arn:aws:iam::*:role/TowerForge-*",
"arn:aws:iam::*:instance-profile/TowerForge-*"
]
},
{
"Sid": "OptionalFetchOptimizedAMIMetadata",
"Effect": "Allow",
"Action": "ssm:GetParameters",
"Resource": "arn:aws:ssm:*:*:parameter/aws/service/ecs/*"
},
{
"Sid": "OptionalEC2MetadataDescribe",
"Effect": "Allow",
"Action": [
"ec2:DescribeAccountAttributes",
"ec2:DescribeImages",
"ec2:DescribeInstanceTypeOfferings",
"ec2:DescribeInstanceTypes",
"ec2:DescribeKeyPairs",
"ec2:DescribeSecurityGroups",
"ec2:DescribeSubnets",
"ec2:DescribeVpcs"
],
"Resource": "*"
},
{
"Sid": "OptionalFSXManagementCanBeRestricted",
"Effect": "Allow",
"Action": [
"fsx:CreateFileSystem",
"fsx:DeleteFileSystem",
"fsx:DescribeFileSystems",
"fsx:TagResource"
],
"Resource": "*"
},
{
"Sid": "OptionalEFSManagementCanBeRestricted",
"Effect": "Allow",
"Action": [
"elasticfilesystem:CreateFileSystem",
"elasticfilesystem:DeleteFileSystem",
"elasticfilesystem:CreateMountTarget",
"elasticfilesystem:DeleteMountTarget",
"elasticfilesystem:DescribeFileSystems",
"elasticfilesystem:DescribeMountTargets",
"elasticfilesystem:UpdateFileSystem",
"elasticfilesystem:PutLifecycleConfiguration",
"elasticfilesystem:TagResource"
],
"Resource": "*"
},
{
"Sid": "OptionalPipelineSecretsListing",
"Effect": "Allow",
"Action": "secretsmanager:ListSecrets",
"Resource": "*"
},
{
"Sid": "OptionalPipelineSecretsManagementCanBeRestricted",
"Effect": "Allow",
"Action": [
"secretsmanager:DescribeSecret",
"secretsmanager:DeleteSecret",
"secretsmanager:CreateSecret"
],
"Resource": "arn:aws:secretsmanager:*:*:secret:tower-*"
},
{
"Sid": "OptionalUserdataCheck",
"Effect": "Allow",
"Action": [
"ec2:GetConsoleOutput"
],
"Resource": "*"
},
{
"Sid": "OptionalLineageIntegrationSNSAndS3",
"Effect": "Allow",
"Action": [
"sns:CreateTopic",
"sns:SetTopicAttributes",
"sns:Subscribe",
"sns:ConfirmSubscription",
"sns:Unsubscribe",
"sns:DeleteTopic",
"s3:CreateBucket",
"s3:GetBucketNotification",
"s3:PutBucketNotification",
"s3:GetBucketLocation",
"s3:ListBucket",
"s3:GetObject"
],
"Resource": [
"arn:aws:sns:*:*:seqera-lineage-*",
"arn:aws:s3:::seqera-lineage-*",
"arn:aws:s3:::seqera-lineage-*/*"
]
}
]
}

Download aws-batch-full-policy.json

Existing resources​

For AWS Batch with existing resources, remove the permissions that Batch Forge uses to create resources:

  • Batch compute environment and job queue management: Keep only the job permissions. See AWS Batch management for the minimum set.
  • IAM role creation: Not needed when you create the IAM roles yourself. See IAM roles for AWS Batch.

Create the policy in AWS​

Create the policy in the AWS account where Seqera creates or uses the resources.

  1. Open the AWS IAM console.
  2. From the left navigation menu, select Policies under Access management.
  3. Select Create policy.
  4. In the Policy editor section, select the JSON tab.
  5. Replace the default text in the policy editor with the policy on this page, adapted to your use case, then select Next.
  6. On the Review and create page, enter a name and description for the policy, then select Create policy.

Next, create AWS Batch credentials with this policy attached.

Statement reference​

This section describes each statement in the policy: what Seqera uses it for, whether it is optional, and how to restrict it.

AWS Batch management​

The first section of the policy allows Seqera to create, update, and delete Batch compute environments, job queues, and jobs.

If you must use manually created Batch compute environments and job queues, or prefer to manage their lifecycle yourself, you can remove the permissions to manipulate them from the policy. The minimum permissions required are:

  • batch:DescribeJobs to report job status
  • batch:DescribeJobDefinitions to list existing job definitions
  • batch:RegisterJobDefinition to create new job definitions
  • batch:CancelJob to cancel jobs
  • batch:SubmitJob to submit jobs
  • batch:TagResource to tag jobs
  • batch:TerminateJob to terminate jobs

You can use batch:DescribeJobQueues to list the existing job queues in a drop-down. It is not required if you specify manually created job queues. However, it is required when you let Seqera create and manage job queues automatically with Batch Forge. In this case, you must also add the batch:DescribeComputeEnvironments permission.

You can also restrict permissions based on resource tags. Users define these tags when they set up a pipeline in Platform.

{
"Sid": "BatchEnvironmentListing",
"Effect": "Allow",
"Action": [
"batch:DescribeJobDefinitions",
"batch:DescribeJobs"
],
"Resource": "*"
},
{
"Sid": "BatchJobsManagement",
"Effect": "Allow",
"Action": [
"batch:CancelJob",
"batch:RegisterJobDefinition",
"batch:SubmitJob",
"batch:TagResource",
"batch:TerminateJob"
],
"Resource": [
"arn:aws:batch:<REGION>:<ACCOUNT_ID>:job-queue/MyCustomJQ",
"arn:aws:batch:<REGION>:<ACCOUNT_ID>:job-definition/*",
"arn:aws:batch:<REGION>:<ACCOUNT_ID>:job/*"
],
"Condition": {
"StringEqualsIfExists": {
"aws:ResourceTag/MyCustomTag": "MyCustomValue"
}
}
}
warning

If you restrict the batch actions with resource tags, set the appropriate tags on each Seqera pipeline when you configure it in Platform. If the tag is missing, the pipeline fails to run.

You cannot restrict the job definition and job name resources to specific names, because Seqera creates job definitions and jobs with dynamic names. Use the wildcard * in the name of these resources. batch:SubmitJob requires permission on both job definitions and job queues. Include both ARNs in the Resource array.

If you prefer to let Seqera manage Batch resources for you, you can still restrict the permissions to specific resources in your account ID and region. You can also restrict permissions based on resource tags, as shown with the Condition in the earlier example.

note

The quick start policy expects the names of compute environments and job queues that Seqera creates automatically to start with the TowerForge- prefix. This is the default prefix for Platform Cloud resources and cannot be customized.

Launch template management​

Seqera needs permission to create and manage EC2 launch templates that use optimized Amazon Machine Images (AMIs) identified through AWS Systems Manager (SSM).

note

AWS does not support restricting IAM permissions on EC2 launch templates based on specific resource names or tags. As a result, you must grant permission to operate on any resource *.

Pass role to Batch​

The iam:PassRole permission allows Seqera to pass execution IAM roles to AWS Batch to run Nextflow pipelines.

You can restrict the permission to a specific account, and allow passing only the manually created roles or the roles that Seqera creates automatically with the default prefix TowerForge-. The automatically created roles include the Fargate head job role TowerForge-<compute-environment-id>-FargateRole when you use Enable Fargate for head job. The following statement also restricts the receiving services to AWS Batch, EC2, and ECS tasks:

{
"Sid": "PassRolesToBatch",
"Effect": "Allow",
"Action": "iam:PassRole",
"Resource": [
"arn:aws:iam::<ACCOUNT_ID>:role/TowerForge-*",
"arn:aws:iam::<ACCOUNT_ID>:role/TowerForge-*-FargateRole"
],
"Condition": {
"StringEquals": {
"iam:PassedToService": [
"batch.amazonaws.com",
"ec2.amazonaws.com",
"ecs-tasks.amazonaws.com"
]
}
}
}
note

When Enable Fargate for head job is selected, Seqera passes both the head job role and the execution role to ecs-tasks.amazonaws.com when you launch a pipeline. Batch Forge creates them as TowerForge-<compute-environment-id>-FargateRole and TowerForge-<compute-environment-id>-ExecutionRole, unless you set your own in Head job role and Batch execution role. Your iam:PassRole statement must include ecs-tasks.amazonaws.com in iam:PassedToService, as in the earlier example. This also applies without Fargate if you set a Head job role.

If your organization scopes iam:PassRole to explicit role ARNs instead of wildcards, include both roles for each compute environment in Resource, in addition to your other TowerForge roles. Also allow passing them to ecs-tasks.amazonaws.com. If you omit either role from Resource, or omit ecs-tasks.amazonaws.com from iam:PassedToService, head job definition creation fails.

CloudWatch logs access​

Seqera requires access to CloudWatch logs to display log data in the web interface.

You can scope the policy down to the specific log group defined on the compute environment, in a specific account and region:

{
"Sid": "CloudWatchLogsAccess",
"Effect": "Allow",
"Action": [
"logs:Describe*",
"logs:FilterLogEvents",
"logs:Get*",
"logs:List*",
"logs:StartQuery",
"logs:StopQuery",
"logs:TestMetricFilter"
],
"Resource": "arn:aws:logs:<REGION>:<ACCOUNT_ID>:log-group:/aws/batch/job/*"
}

S3 access (optional)​

Seqera automatically attempts to fetch a list of the S3 buckets available in the AWS account connected to Platform. It provides them in a drop-down, where you select the bucket to use as the Nextflow work directory when you create a compute environment. This feature is optional. You can type the bucket name manually instead. To allow Seqera to fetch the list of buckets in the account, add the s3:ListAllMyBuckets action with the Resource field set to *, as shown in the full permissive policy at the beginning of this page. The s3:ListAllMyBuckets action also allows Data Explorer to auto-discover the data repositories accessible to your workspace credentials.

Seqera products such as Studios and Data Explorer manipulate data in AWS S3 buckets. If you do not use these features, you can omit the related permissions.

You can scope the IAM policy down to allow only limited read/write permissions in the S3 buckets that Studios and Data Explorer use. For each bucket you want to browse, upload to, download from, or delete files in with Data Explorer, grant s3:GetObject, s3:PutObject, and s3:DeleteObject on the bucket objects. On the bucket itself, grant s3:ListBucket. s3:GetBucketAcl on the bucket is optional. The policy must also include permission to check the region and list the content of the S3 bucket used as the Nextflow work directory. Seqera also recommends granting the s3:GetObject permission on the work directory path to fetch Nextflow log files.

note

If you created a separate S3 bucket only for Nextflow work directories, the IAM user does not need read/write access to it. If you allow Seqera to manage resources with Batch Forge, the automatically created IAM roles have the necessary permissions.

If you set up the compute environment manually, create the required IAM roles with the necessary permissions as detailed in Create AWS Batch resources manually.

{
"Sid": "S3CheckBucketWorkDirectory",
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::example-bucket-used-as-work-directory"
]
},
{
"Sid": "S3ReadOnlyNextflowLogFiles",
"Effect": "Allow",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::example-bucket-used-as-work-directory/path/to/work/directory/*"
]
},
{
"Sid": "S3ReadWriteBucketsForStudiosDataExplorer",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:GetObjectTagging",
"s3:GetBucketLocation",
"s3:GetBucketPolicy",
"s3:GetBucketAcl",
"s3:ListBucket",
"s3:PutObject",
"s3:PutObjectTagging",
"s3:DeleteObject"
],
"Resource": [
"arn:aws:s3:::example-bucket-read-write-studios",
"arn:aws:s3:::example-bucket-read-write-studios/*",
"arn:aws:s3:::example-bucket-read-write-data-explorer",
"arn:aws:s3:::example-bucket-read-write-data-explorer/*"
]
}
note

s3:ListBucket allows Data Explorer to resolve each bucket's region and list its contents. Data Explorer omits a bucket it cannot reach with s3:ListBucket. s3:GetBucketAcl lets Data Explorer detect public buckets. Without it, Data Explorer treats every bucket as private. Data Explorer does not call s3:GetBucketLocation or s3:GetBucketPolicy. If you prefer not to enumerate individual actions, the s3:Get* and s3:List* wildcards shown in the full permissive policy also cover s3:ListBucket and s3:GetBucketAcl.

IAM roles for AWS Batch (optional)​

Seqera can automatically create the IAM roles needed to interact with AWS Batch and other AWS services. To opt out, create the required IAM roles manually and provide their ARNs when you create the compute environment in Platform. To set up the IAM roles manually, see Create AWS Batch resources manually.

To allow Seqera to create IAM roles but restrict it to your specific account and the default IAM role prefix, use the following statement:

{
"Sid": "IAMRoleAndProfileManagement",
"Effect": "Allow",
"Action": [
"iam:AddRoleToInstanceProfile",
"iam:AttachRolePolicy",
"iam:CreateInstanceProfile",
"iam:CreateRole",
"iam:DeleteInstanceProfile",
"iam:DeleteRole",
"iam:DeleteRolePolicy",
"iam:DetachRolePolicy",
"iam:GetRole",
"iam:ListAttachedRolePolicies",
"iam:ListRolePolicies",
"iam:PutRolePolicy",
"iam:RemoveRoleFromInstanceProfile",
"iam:TagInstanceProfile",
"iam:TagRole"
],
"Resource": [
"arn:aws:iam::<ACCOUNT_ID>:role/TowerForge-*",
"arn:aws:iam::<ACCOUNT_ID>:instance-profile/TowerForge-*"
]
}
note

The quick start policy expects the names of roles that Seqera creates automatically to start with the TowerForge- prefix. This is the default prefix for Platform Cloud resources and cannot be customized.

AWS Systems Manager (optional)​

Seqera Platform can use AWS Systems Manager (SSM) to identify ECS Optimized AMIs for pipeline execution. This permission is optional. If you provide a custom AMI ID when you create the compute environment, you do not need this permission.

EC2 describe permissions (optional)​

Seqera can retrieve information from EC2 about existing AWS resources in your account, including VPCs, subnets, and security groups. Seqera uses this data to populate drop-downs in the Platform UI when you create compute environments. These permissions are optional but recommended. Without them, you must enter resource ARNs manually in the interface.

note

AWS does not support restricting IAM permissions on EC2 Describe actions based on specific resource names or tags. As a result, you must grant permission to operate on any resource *.

FSx file systems (optional)​

Seqera can manage AWS FSx file systems if your pipelines need them.

This section of the policy is optional. Omit it if your pipelines do not use FSx file systems. Because the describe actions cannot be restricted to specific resources, you must grant permission to operate on any resource *. You can restrict the management actions to specific resources, as in the following example.

{
"Sid": "FSxDescribe",
"Effect": "Allow",
"Action": [
"fsx:DescribeFileSystems"
],
"Resource": "*"
},
{
"Sid": "FSxManagement",
"Effect": "Allow",
"Action": [
"fsx:CreateFileSystem",
"fsx:DeleteFileSystem",
"fsx:TagResource"
],
"Resource": "arn:aws:fsx:<REGION>:<ACCOUNT_ID>:file-system/MyManualFSx"
}

EFS file systems (optional)​

Seqera can manage AWS EFS file systems if your pipelines need them.

This section of the policy is optional. Omit it if your pipelines do not use EFS file systems. Because the describe actions cannot be restricted to specific resources, you must grant permission to operate on any resource *. You can restrict the management actions to specific resources, as in the following example.

{
"Sid": "EFSDescribe",
"Effect": "Allow",
"Action": [
"elasticfilesystem:DescribeFileSystems",
"elasticfilesystem:DescribeMountTargets"
],
"Resource": "*"
},
{
"Sid": "EFSManagement",
"Effect": "Allow",
"Action": [
"elasticfilesystem:CreateFileSystem",
"elasticfilesystem:DeleteFileSystem",
"elasticfilesystem:CreateMountTarget",
"elasticfilesystem:DeleteMountTarget",
"elasticfilesystem:UpdateFileSystem",
"elasticfilesystem:PutLifecycleConfiguration",
"elasticfilesystem:TagResource"
],
"Resource": "arn:aws:elasticfilesystem:<REGION>:<ACCOUNT_ID>:file-system/MyManualEFS"
}

Pipeline secrets (optional)​

Seqera can synchronize pipeline secrets defined in the Platform workspace with AWS Secrets Manager. This requires additional permissions on the IAM user. If you do not plan to use pipeline secrets, you can omit this section of the policy.

The listing of secrets cannot be restricted. You can restrict the management actions to secrets in a specific account and region, which must be the region where the pipeline runs. Seqera only creates secrets with the tower- prefix.

{
"Sid": "PipelineSecretsListing",
"Effect": "Allow",
"Action": "secretsmanager:ListSecrets",
"Resource": "*"
},
{
"Sid": "PipelineSecretsManagementCanBeRestricted",
"Effect": "Allow",
"Action": [
"secretsmanager:DescribeSecret",
"secretsmanager:DeleteSecret",
"secretsmanager:CreateSecret"
],
"Resource": "arn:aws:secretsmanager:<REGION>:<ACCOUNT_ID>:secret:tower-*"
}

If you specify a customer-managed KMS key (CMK) in the Pipeline secrets KMS key field under Advanced options, the compute environment credentials also require kms:GenerateDataKey and kms:Decrypt on that key. Grant these actions either by naming the compute environment principal in the key policy, or in the principal's own IAM policy if the key policy delegates to IAM. The default key policy created by aws kms create-key delegates to IAM.

{
"Sid": "PipelineSecretsKmsKey",
"Effect": "Allow",
"Action": [
"kms:GenerateDataKey",
"kms:Decrypt"
],
"Resource": "arn:aws:kms:<REGION>:<ACCOUNT_ID>:key/<KEY_ID>"
}

Additional steps required to use secrets in a pipeline​

To use pipeline secrets with manually created IAM roles, follow the steps in AWS Secrets Manager integration.

Userdata script error detection (optional)​

Platform can retrieve the EC2 instance console output to detect errors in the userdata script that bootstraps the VM during instance startup. If the userdata script fails, Platform shows the failure as a warning on the workflow. Without this permission, Platform does not detect userdata script failures and shows no warning.

{
"Sid": "OptionalUserdataCheck",
"Effect": "Allow",
"Action": [
"ec2:GetConsoleOutput"
],
"Resource": "*"
}

Data lineage (optional)​

If you enable data lineage in your workspace, your Platform integration credentials must be able to create the notification topic and bucket notifications that the lineage service uses. Add the following permissions to the credentials:

{
"Sid": "LineageIntegrationSNS",
"Effect": "Allow",
"Action": [
"sns:CreateTopic",
"sns:SetTopicAttributes",
"sns:Subscribe",
"sns:ConfirmSubscription",
"sns:Unsubscribe",
"sns:DeleteTopic"
],
"Resource": "arn:aws:sns:<REGION>:<ACCOUNT_ID>:seqera-lineage-*"
},
{
"Sid": "LineageIntegrationS3",
"Effect": "Allow",
"Action": [
"s3:CreateBucket",
"s3:GetBucketNotification",
"s3:PutBucketNotification",
"s3:GetBucketLocation",
"s3:ListBucket",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::seqera-lineage-*",
"arn:aws:s3:::seqera-lineage-*/*"
]
}

If you manage your own EC2 instance role or head job role instead of letting Seqera create them with Batch Forge, see Create an EC2 instance role for the additional S3 permissions to add to those roles.