An organization is containerizing a legacy session manager and deploying it as a task on Amazon ECS with the AWS Fargate launch type. The application code requires permissions to write session state directly to an Amazon DynamoDB table. Additionally, the task's container image is hosted within a private Amazon Elastic Container Registry (ECR) repository. The developer needs to establish the correct IAM permissions for both the ECS container agent and the application itself to run successfully.
Which of the following configuration steps must the developer perform? (Select TWO.)
- Configure the ECS Task Role with an IAM policy that allows the `dynamodb:PutItem` action.Cevap
- Configure the ECS Task Execution Role with an IAM policy that allows the `ecr:GetDownloadUrlForLayer` and `ecr:BatchGetImage` actions.Cevap
- CConfigure the ECS Task Execution Role with an IAM policy that allows the `dynamodb:PutItem` action.
- DConfigure the trust policy of the ECS Task Role to allow the Amazon EC2 service (`ec2.amazonaws.com`) to assume the role.
- EInclude static AWS credentials inside the application's environment configuration within the Dockerfile.
Cevap
To configure the task successfully, the ECS Task Role must be configured with permission to write to DynamoDB (`dynamodb:PutItem`), and the ECS Task Execution Role must be configured with permissions to pull the image from ECR (`ecr:GetDownloadUrlForLayer` and `ecr:BatchGetImage`).
The correct configurations are: 1. Setting the ECS Task Role with an IAM policy that allows the application code to write to DynamoDB (`dynamodb:PutItem`). The Task Role is designed specifically to provide permissions to the application running inside the container. 2. Setting the ECS Task Execution Role with an IAM policy that allows the ECS container agent to pull images from ECR (`ecr:GetDownloadUrlForLayer` and `ecr:BatchGetImage`). The Task Execution Role is used by the ECS container agent to perform lifecycle tasks on behalf of the container before the application begins running.
Adım Adım Çözüm
Anahtar Kavram
Delineation between the ECS Task Role (granting permissions to the application code inside the container) and the ECS Task Execution Role (granting permissions to the ECS agent/daemon to pull images and push logs).