Interview Prep/AWS/ECS, EKS, Lambda and ECR

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 →

  1. Define taskRoleArn in the task definition
  2. ECS injects AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
  3. SDK picks it up automatically
  4. Never share the instance role with containers

Why → Per-task roles give least privilege.

Interview tip → Differentiate task role and execution role.

aws All AWS questions Roadmap: EKS, ECS & serverless on AWS

More on ECS, EKS, Lambda and ECR