Security

Amazon ECR and Task Roles

ECR stores container images; task roles grant running ECS tasks temporary AWS permissions.

How it works

Amazon ECR is a registry for container images that supports encryption and vulnerability scanning. When running an application on Amazon ECS, you can specify a task role in the task definition so application code receives temporary AWS credentials. The role's IAM policies determine the task's permissions; configure them according to least privilege.

When to use it

Choose it when the requirement is securely pull images and give a container least-privilege AWS access.

Real-world example

A billing application running on ECS uses an image from ECR. Its configured task role allows application code to read invoices from S3 and write records to DynamoDB without placing long-term access keys in the image.

Common pitfall

Confusing the task role with the task execution role can put permissions in the wrong place. The execution role grants the ECS or Fargate agent permissions for supporting task operations; the task role grants permissions to application code.

Often confused with

Compare its service boundary with AWS container runtime choices; choose from the workload requirement.

References

Prepared by Cloud Quest. Check current behavior and limits in the AWS documentation:

SAA-C03 study guide and learning resources

Understand it for real with 3D models and simulated labs

Connect the concept to a working architecture.

Start learning