How does an ECS task get AWS permissions at runtime?
BeginnerScenarioECS, EKS, Lambda and ECR
Answer
Situation read → Through its task role, via a credentials endpoint.
What I'd do →
- Define
taskRoleArnin the task definition - ECS injects
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI - SDK picks it up automatically
- Never share the instance role with containers
Why → Per-task roles give least privilege.
Interview tip → Differentiate task role and execution role.
More on ECS, EKS, Lambda and ECR
ECS on Fargate or on EC2: how do you choose?BeginnerDeploy a containerized API on ECS behind an ALB. What are the building blocks?BeginnerAn ECS service deployment is stuck, tasks start and stop repeatedly. How do you debug?IntermediateRoll out a new ECS service version with canary and automatic rollback.IntermediateEKS pods need access to S3 without node-level permissions. How?IntermediateUpgrade an EKS cluster from 1.31 to 1.33 safely.Intermediate