A developer has deployed a containerized application to Amazon ECS on AWS Fargate. The application code needs to retrieve customer records from an Amazon DynamoDB table. During execution, the container logs display an AccessDeniedException when attempting to call DynamoDB API operations. The developer verifies that the ECS task execution role has an attached policy allowing the necessary DynamoDB permissions. How should the developer resolve this authorization failure?
- AEnsure the DynamoDB policy is attached to the ECS task execution role and configure the container definition to enable runtime credential sharing.
- Attach the DynamoDB permission policy to the ECS task role instead of the ECS task execution role.Cevap
- CModify the trust relationship of the ECS task execution role to allow the DynamoDB service to assume the role.
- DConfigure an Amazon Cognito Identity Pool to exchange credentials for the container and map them to the task execution role.
Cevap
Attach the DynamoDB permission policy to the ECS task role instead of the ECS task execution role.
The correct answer is correct because the ECS task role is designed specifically to grant AWS API permissions to the application code running inside containerized tasks. The ECS task execution role is intended for the container agent itself to pull images from Amazon ECR and push logs to CloudWatch.
Adım Adım Çözüm
Anahtar Kavram
ECS Task Role vs. ECS Task Execution Role