An Amazon ECS task running on EC2 must read objects from a specific S3 bucket, while the ECS agent must pull its image from private Amazon ECR. Where should the S3 read permission be assigned?
Show the answer
Correct answerC. The ECS task role
AWhy not this: The task execution role supports operations such as image pulls, not the application code's S3 requests.
BWhy not this: The container instance role supports the EC2 host and ECS agent rather than providing task-scoped application permissions.
CWhy this is right: The task role supplies application credentials and can scope S3 access to the required bucket.
DWhy not this: The service-linked role lets ECS manage AWS resources on your behalf rather than authorize application requests.
The task role provides AWS permissions to application code running in an ECS task. The task execution role supports agent operations such as pulling images from Amazon ECR; it does not supply the application's S3 permissions.