Question

Difficulty: EasyAmazon ECS and Docker Deployment

A developer is creating an Amazon ECS task definition to deploy a containerized application to AWS Fargate. The container needs to pull its image from Amazon ECR, write container logs to Amazon CloudWatch Logs, and query an Amazon DynamoDB table. Which two configurations must the developer specify in the task definition to meet these requirements?

  1. A task execution role that grants permissions to pull the container image from Amazon ECR and write logs to Amazon CloudWatch LogsAnswer
  2. A task role that grants permissions to the application code running inside the container to query the Amazon DynamoDB tableAnswer
  3. C
    A task role that grants permissions to the Amazon ECS agent to pull the container image from Amazon ECR
  4. D
    A task execution role that grants permissions to the application code to read data from the Amazon DynamoDB table
  5. E
    A container definition with hardcoded AWS access keys in the environment variables to authenticate the SDK client inside the container

Answer

The developer must specify a task execution role to grant ECR and CloudWatch access to the ECS agent, and a task role to grant DynamoDB access to the application code.
The correct choices specify a task execution role to grant the ECS agent permissions to pull ECR images and write CloudWatch logs, and a task role to grant the application code permissions to query DynamoDB.

Step-by-Step Solution

1
Identify the permissions needed for the ECS container agent to pull the Docker image and configure logging.
These infrastructure lifecycle actions are executed by the ECS agent, requiring the Task Execution Role.
The Task Execution Role provides the necessary permissions for the container agent itself before the application container starts.
2
Identify the permissions needed for the application code itself to interact with Amazon DynamoDB.
This business logic is executed inside the application container, requiring the Task Role.
The Task Role assigns permissions directly to the application container so the code can query AWS resources using SDKs.

Key Concept

Amazon ECS Task IAM Roles
Estimated Time:1m 0s
Rate this question