Skip to content

Commit 4f44b58

Browse files
committed
docs: document the minimal IAM policy for the executor
Add a "Required IAM permissions" section to docs/further.md giving the minimal core policy the executor role needs (batch:SubmitJob/DescribeJobs/ RegisterJobDefinition/DeregisterJobDefinition/TerminateJob/DescribeJobQueues/ DescribeComputeEnvironments and iam:PassRole), plus a single tags add-on (batch:TagResource, with an ecs:TagResource note for tag propagation). Each permission is tied to the feature that needs it, and the register/deregister and PassRole statements are called out as conditional (pre-existing job definitions, and only when --aws-batch-job-role is set). Cross-linked from the README.
1 parent 47e8027 commit 4f44b58

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Snakemake executor plugin: aws-batch
22

33
A Snakemake executor plugin for submitting jobs to AWS Batch. Documentation can be found in the [Snakemake plugin catalog](https://snakemake.github.io/snakemake-plugin-catalog/plugins/executor/aws-batch.html).
4+
5+
For the minimal IAM policy and the tags add-on required to run the executor, see [docs/further.md — Required IAM permissions](docs/further.md#required-iam-permissions).

docs/further.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,69 @@ SNAKEMAKE_AWS_BATCH_REGION
2828
SNAKEMAKE_AWS_BATCH_JOB_QUEUE
2929
SNAKEMAKE_AWS_BATCH_JOB_ROLE
3030

31+
# Required IAM permissions
32+
33+
The principal that runs Snakemake (the *executor role*) needs the following
34+
permissions to submit and monitor jobs. The policy is split into a mandatory
35+
core set and an add-on statement that is only needed when tags are configured.
36+
37+
## Core policy (always required)
38+
39+
```json
40+
{
41+
"Version": "2012-10-17",
42+
"Statement": [
43+
{
44+
"Sid": "BatchCore",
45+
"Effect": "Allow",
46+
"Action": [
47+
"batch:SubmitJob",
48+
"batch:DescribeJobs",
49+
"batch:RegisterJobDefinition",
50+
"batch:DeregisterJobDefinition",
51+
"batch:TerminateJob",
52+
"batch:DescribeJobQueues",
53+
"batch:DescribeComputeEnvironments"
54+
],
55+
"Resource": "*"
56+
},
57+
{
58+
"Sid": "PassJobRole",
59+
"Effect": "Allow",
60+
"Action": "iam:PassRole",
61+
"Resource": "arn:aws:iam::<account-id>:role/<job-role-name>"
62+
}
63+
]
64+
}
65+
```
66+
67+
- `batch:DescribeJobQueues` and `batch:DescribeComputeEnvironments` are used to
68+
detect whether a queue is backed by EC2 or Fargate so the plugin builds a
69+
compatible job definition.
70+
- `batch:RegisterJobDefinition` and `batch:DeregisterJobDefinition` are only
71+
needed when the plugin registers a job definition per job (the default). If
72+
you use a pre-existing job definition (`--aws-batch-job-definition`), both can
73+
be omitted — see [Pre-existing Job Definitions](#pre-existing-job-definitions).
74+
- The `PassJobRole` statement is only needed when you set `--aws-batch-job-role`;
75+
scope its `Resource` to that specific job role ARN.
76+
77+
## Add-on: tags (`--aws-batch-tags` or `SNAKEMAKE_AWS_BATCH_JOB_TAGS`)
78+
79+
```json
80+
{
81+
"Sid": "BatchTagResource",
82+
"Effect": "Allow",
83+
"Action": "batch:TagResource",
84+
"Resource": "*"
85+
}
86+
```
87+
88+
`batch:TagResource` authorizes the tag-on-create when jobs and job definitions
89+
are submitted with tags; without it, submission fails with `AccessDenied`
90+
whenever tags are configured. Depending on your account's ECS
91+
tagging-authorization settings you may additionally need `ecs:TagResource` on
92+
`*`, because AWS Batch propagates tags to the ECS resources it manages.
93+
3194
# Rule-Specific Container Images
3295

3396
By default, all jobs use the global container image specified via `--container-image`. However, you can specify a different container image for individual rules using the `aws_batch_container_image` resource parameter:

0 commit comments

Comments
 (0)