A developer is deploying a containerized application to Amazon ECS using the AWS Fargate launch type. The application is packaged in a Docker image stored in a private Docker Hub repository. During task initialization, the Amazon ECS agent must pull this image using credentials stored in AWS Secrets Manager. Once running, the application code must publish messages to an Amazon SQS queue. Which combination of IAM configurations should the developer implement to meet these requirements? (Select TWO.)
- Attach a policy to the ECS task execution role that allows the secretsmanager:GetSecretValue action on the secret containing the private registry credentials.Answer
- Attach a policy to the ECS task role that allows the sqs:SendMessage action on the Amazon SQS queue.Answer
- CAttach a policy to the ECS task role that allows the secretsmanager:GetSecretValue action on the secret containing the private registry credentials.
- DAttach a policy to the ECS task execution role that allows the sqs:SendMessage action on the Amazon SQS queue.
- EModify the trust policy of the ECS task execution role to trust the sqs.amazonaws.com service principal.
Answer
To configure this setup correctly, the developer must attach the secretsmanager:GetSecretValue permission to the ECS task execution role to allow the ECS agent to retrieve the private registry credentials, and attach the sqs:SendMessage permission to the ECS task role to allow the application code to write to the SQS queue.
The correct configurations involve assigning the registry credentials access to the ECS task execution role and assigning SQS permissions to the ECS task role. The ECS task execution role is assumed by the ECS agent to perform actions such as pulling the container image and pulling secrets from Secrets Manager. The ECS task role is assumed by the application running inside the container, granting it permissions to interact with AWS resources like SQS.
Step-by-Step Solution
Key Concept
ECS Task Role vs. Task Execution Role