Free tool
ECS task role policy generator
Pick the services your ECS calls and get the task role it needs — scoped to the right ARNs, with the reason behind every action.
1. Which thing needs the role?
The compute that makes the calls. It assumes the role; everything else is a resource the role points at.
Changing this opens that principal’s own page.
2. What does it call?
Only connections the knowledge base records IAM requirements for. Tick what your ECS actually talks to.
3. Fill in your account (optional)
Leave these blank and the ARNs keep visible placeholders, so a half-finished policy fails instead of quietly granting more than you meant.
Your role
Nothing selected yet, so the role below can be assumed but grants nothing. Tick a service above.
{
"Version": "2012-10-17",
"Statement": []
}
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ECSAssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "ecs-tasks.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
Before you apply this
- These are the actions this integration typically needs — not a least-privilege proof. After you deploy, narrow the policy with IAM Access Analyzer, which generates one from the calls the principal actually made.
- No permissions were generated. The role below can be assumed but grants nothing — pick at least one service this principal calls.
Worth knowing about a ECS task role
- This is the TASK role — your container's own permissions. The task EXECUTION role is a second, separate role (trusting the same service principal) that the ECS agent uses to pull the image and set up logging; it usually carries AmazonECSTaskExecutionRolePolicy and is not generated here. (Knowledge base, ECS → ECR.)
- The SDK inside the container picks up the task role's credentials from the task metadata endpoint automatically.
Grounded in the same data that validates diagrams
Design Beaver models AWS connections so it can tell you when a diagram is wrong. Part of that model is which IAM actions each integration needs and why — researched against AWS documentation, not inferred. This tool reads that data directly, which is why it can explain every statement instead of just emitting one.
It also means the tool knows what it doesn’t know. A connection the knowledge base has no IAM data for is skipped and named, never filled in with a plausible guess. Where an action comes from somewhere other than the knowledge base, it is labelled.
What a ECS task role can be scoped to
ECS assumes this role through the ecs-tasks.amazonaws.com service principal. These are the 5 connections the knowledge base records IAM requirements for:
- ECS → DynamoDB
The application in the ECS task reads/writes a DynamoDB table via the AWS SDK
dynamodb:GetItemdynamodb:PutItemdynamodb:Querydynamodb:UpdateItemdynamodb:DeleteItemAttach an IAM task role to the task definition granting the required DynamoDB actions — the container's SDK picks up the task role credentials from the task metadata endpoint automatically, so no access keys live in the image
- ECS → S3
The application in the ECS task reads/writes S3 objects via the AWS SDK (e.g. serving user uploads, reading config/assets, writing logs or exports)
s3:GetObjects3:PutObjects3:ListBucketAttach an IAM task role to the task definition granting the required S3 actions — the SDK inside the container picks up the task role's temporary credentials automatically, so no long-lived access keys are stored in the image. This is the task role (application permissions), not the execution role (which handles image pull and log setup).
- ECS → Secrets Manager
The containerized app reads a secret (typically the database credentials for its RDS/RDS Proxy connection, or third-party API keys) from Secrets Manager instead of baking it into the image or a plain environment variable
secretsmanager:GetSecretValuesecretsmanager:DescribeSecretGrant secretsmanager:GetSecretValue (and secretsmanager:DescribeSecret) on the specific secret to the task's IAM role — either the task role (the app reads the secret at runtime via the SDK) or the execution role (the task definition's `secrets` block injects the value as an environment variable at container start). Note the injected value is only refreshed when the task restarts, so a rotated secret needs a new task
- ECS → SNS
The application in the ECS task publishes messages to an SNS topic via the AWS SDK to fan an event out to multiple subscribers
sns:PublishAttach an IAM task role granting sns:Publish on the target topic
- ECS → SQS
The application in the ECS task sends or polls SQS messages via the AWS SDK to decouple components (e.g. a worker service draining a queue)
sqs:SendMessagesqs:ReceiveMessagesqs:DeleteMessagesqs:GetQueueAttributesAttach an IAM task role granting the SQS actions the app uses — sqs:SendMessage to produce, or sqs:ReceiveMessage/sqs:DeleteMessage/sqs:GetQueueAttributes to consume
Generate a role for something else
- EC2instance profile roleDynamoDB · EventBridge · Lambda · S3 · Secrets Manager · SES · SNS · SQS
- Lambdaexecution roleDynamoDB · EventBridge · S3 · Secrets Manager · SES · SNS · SQS
- IoT Corerule action roleDynamoDB · Lambda · S3 · SNS · SQS · Step Functions
- Step Functionsstate machine execution roleDynamoDB · EventBridge · Lambda · S3 · SNS · SQS
- CodeBuildservice roleCodeArtifact · CodeCommit · ECR · S3 · Secrets Manager
- App Runnerinstance roleDynamoDB · S3 · Secrets Manager
- API Gatewayintegration roleDynamoDB · Step Functions
Questions
Where do the actions come from?
Is this a least-privilege policy?
How is this different from the other IAM policy generators?
Does anything I type leave my browser?
Why are there two policies?
Draw it instead, and the role attaches itself
Design Beaver knows which connections need a role because it checks them as you draw. Drop an IAM Role node onto a function and the warnings it resolves disappear. Free, in your browser — sign in with Google or GitHub to save your work.
Sign up for free! →Prefer email? Get new features in your inbox: