A developer is deploying a containerized application on Amazon ECS using the AWS Fargate launch type. The application is designed to poll an Amazon SQS queue and process incoming messages. The task definition uses the awslogs log driver to send container logs to Amazon CloudWatch Logs. During deployment, the task fails to launch, and the AWS Management Console displays the following error:
ResourceInitializationError: unable to pull secrets or registry auth: execution role does not have permissions to pull from ECR
The developer verifies that two IAM roles are associated with the task definition: ApplicationTaskExecutionRole and ApplicationTaskRole.
Which action must the developer take to resolve the container startup failure and ensure the application can poll the SQS queue once running?
- Attach a policy allowing ecr:GetDownloadUrlForLayer and ecr:BatchGetImage to the ApplicationTaskExecutionRole, and attach a policy allowing sqs:ReceiveMessage and sqs:DeleteMessage to the ApplicationTaskRole.Cevap
- BAttach a policy allowing ecr:GetDownloadUrlForLayer and ecr:BatchGetImage to the ApplicationTaskRole, and attach a policy allowing sqs:ReceiveMessage and sqs:DeleteMessage to the ApplicationTaskExecutionRole.
- CAttach a policy containing ECR, SQS, and CloudWatch permissions to the ApplicationTaskExecutionRole, and configure the ApplicationTaskRole trust policy to allow it to assume the ApplicationTaskExecutionRole.
- DAttach a policy allowing ecr:GetDownloadUrlForLayer and sqs:ReceiveMessage to the ApplicationTaskExecutionRole, and leave the ApplicationTaskRole unconfigured since Fargate tasks run in a shared security context.