A developer is deploying a containerized application to Amazon ECS using the AWS Fargate launch type. The ECS task needs to pull the container image from a private Amazon ECR repository and send container logs to Amazon CloudWatch. Once running, the application code inside the container must read data files from an Amazon S3 bucket.
Which two IAM configuration steps must the developer take in the ECS task definition to grant these permissions?
- Configure the Task Execution Role with permissions to pull the container image from Amazon ECR and send logs to Amazon CloudWatch.Answer
- Configure the Task Role with permissions to read objects from the Amazon S3 bucket.Answer
- CConfigure the Task Role with permissions to pull the container image from Amazon ECR.
- DConfigure the Task Execution Role with permissions to read objects from the Amazon S3 bucket.
- EHardcode IAM user credentials with Amazon S3 read permissions in the application's environment variables.
Answer
Configure the Task Execution Role with permissions to pull the container image from Amazon ECR and send logs to Amazon CloudWatch, and configure the Task Role with permissions to read objects from the Amazon S3 bucket.
To deploy the application securely, the developer must use two separate IAM roles. The Task Execution Role is required by the Amazon ECS container agent to authenticate with Amazon ECR to pull the Docker image and to create log streams in Amazon CloudWatch before the container starts. The Task Role is assumed by the application code running inside the container to authorize calls to other AWS services, such as reading files from the Amazon S3 bucket.
Step-by-Step Solution
Key Concept
Distinction between ECS Task Role and ECS Task Execution Role