A development team is preparing to deploy an application to Amazon ECS using the AWS Fargate launch type. The application container needs to pull its Docker image from a private Amazon ECR repository. Once the container is running, the application code needs to retrieve data from an Amazon S3 bucket.
Which IAM role configuration is required in the task definition to support this deployment?
- AAssign a single IAM role containing both ECR pull and S3 read permissions to the Task Role, and leave the Task Execution Role empty.
- Assign an IAM role with S3 read permissions to the Task Role, and assign an IAM role with ECR pull permissions to the Task Execution Role.Cevap
- CAssign an IAM role with ECR pull permissions to the Task Role, and assign an IAM role with S3 read permissions to the Task Execution Role.
- DAssign an IAM role with both ECR pull and S3 read permissions to the Task Execution Role, and add a trust relationship allowing the ECS task to assume itself.
Cevap
Assign an IAM role with S3 read permissions to the Task Role, and assign an IAM role with ECR pull permissions to the Task Execution Role.
The correct option correctly maps S3 read permissions to the Task Role and ECR pull permissions to the Task Execution Role. When using AWS Fargate, the ECS container agent runs outside the user container and needs credentials to pull the image from ECR and write logs; these permissions must be in the Task Execution Role. Once the container is running, the application code runs inside the container and requires separate credentials to access AWS resources like Amazon S3; these permissions must be in the Task Role.
Adım Adım Çözüm
Anahtar Kavram
Distinction between ECS Task Role and ECS Task Execution Role