What is the difference between the ECS task role and the task execution role?
IntermediateConceptContainers and Serverless
Answer
The execution role is used by the ECS agent/Fargate to set up the task: pull images from ECR, write logs to CloudWatch, and fetch secrets from Secrets Manager or SSM for secrets: entries. The task role is what your application code assumes at runtime to call AWS APIs like S3 or DynamoDB.
Mixing them up is the classic cause of CannotPullContainerError (execution role) versus AccessDenied from the app (task role).
More on Containers and Serverless
ECS vs EKS vs Fargate: what is the relationship?BeginnerWhat are ECS task definitions, tasks and services?BeginnerWhat are ECS capacity providers?IntermediateHow does `awsvpc` network mode work in ECS?IntermediateWhat deployment strategies does ECS support?AdvancedWhat does the EKS control plane include and who manages it?Beginner