A developer is deploying a containerized application to Amazon ECS on AWS Fargate. The application needs to read and write items in an Amazon DynamoDB table. According to security best practices, which two steps should the developer take to configure the required permissions? (Select two.)
- Create an IAM role with a trust policy that allows the Amazon ECS tasks service principal (ecs-tasks.amazonaws.com) to assume the role.Answer
- Attach the IAM policy containing the DynamoDB read and write permissions to the ECS Task Role.Answer
- CAttach the IAM policy containing the DynamoDB read and write permissions to the ECS Task Execution Role.
- DModify the trust policy of the IAM role to trust the DynamoDB service principal (dynamodb.amazonaws.com).
- EGenerate AWS access keys for an IAM user with DynamoDB permissions and package them as environment variables inside the Docker container image.
Answer
Create an IAM role with a trust policy that allows the Amazon ECS tasks service principal to assume the role, and attach the permissions policy to the ECS Task Role.
To secure an ECS task, the developer must use an ECS Task Role for application permissions (like DynamoDB access) and configure the trust policy to allow the ECS tasks service principal (ecs-tasks.amazonaws.com) to assume that role.
Step-by-Step Solution
Key Concept
IAM Task Roles for ECS tasks separation and configuration