A developer is configuring a task definition to run a microservice on Amazon ECS using the AWS Fargate launch type. The microservice application code needs to send messages to an Amazon SQS queue. How should the developer grant the application code the required SQS permissions?
- AAssign the permissions to the IAM role specified in the executionRoleArn parameter of the task definition.
- BEmbed an IAM user's access key credentials directly in the application code configuration inside the container.
- Assign the permissions to the IAM role specified in the taskRoleArn parameter of the task definition.Answer
- DModify the SQS queue's resource-based policy to trust the Amazon Resource Name (ARN) of the ECS cluster.
Answer
Assign the permissions to the IAM role specified in the taskRoleArn parameter of the task definition.
The correct option is the one specifying the use of the taskRoleArn parameter. When deploying containers on Amazon ECS, the Task Role (taskRoleArn) grants the containerized application permissions to make API requests to other AWS services like Amazon SQS. The AWS SDK inside the container automatically retrieves temporary credentials associated with this role.
Step-by-Step Solution
Key Concept
ECS Task Role vs. ECS Task Execution Role
Estimated Time:45s