A developer is configuring an Amazon Elastic Container Service (ECS) task definition for a containerized application. The application code needs to retrieve objects from an Amazon S3 bucket at runtime. Additionally, the ECS container agent requires permissions to pull the private container image from Amazon Elastic Container Registry (ECR) to launch the task. Which configuration should the developer use to grant the appropriate permissions?
- AAssign an IAM role with Amazon S3 permissions to the Task Execution Role, and assign an IAM role with Amazon ECR permissions to the Task Role.
- BConfigure the container's environment variables with the AWS Access Key ID and Secret Access Key of an IAM user that has both Amazon S3 and Amazon ECR permissions.
- Assign an IAM role with Amazon S3 permissions to the Task Role, and assign an IAM role with Amazon ECR permissions to the Task Execution Role.Answer
- DAssign an IAM role with both Amazon S3 and Amazon ECR permissions to the Task Execution Role, and leave the Task Role blank.
Answer
Assign an IAM role with Amazon S3 permissions to the Task Role, and assign an IAM role with Amazon ECR permissions to the Task Execution Role.
The correct configuration requires assigning the application-specific permissions (Amazon S3 access) to the ECS Task Role so the containerized application code can access S3 at runtime. The container agent itself requires permissions to pull images from Amazon ECR, which must be assigned to the ECS Task Execution Role.
Step-by-Step Solution
Key Concept
ECS Task Role vs Task Execution Role
Estimated Time:1m 0s