A developer is deploying a microservices application to Amazon ECS using the AWS Fargate launch type in AWS Account A. The container image is stored in a private Amazon Elastic Container Registry (Amazon ECR) repository located in AWS Account B. During deployment, the ECS tasks fail to transition to the RUNNING state, and the task status shows an error indicating that the container image cannot be pulled from the remote registry. Which combination of steps should the developer perform to resolve this authentication and access issue? (Select TWO.)
- Configure the ECS task execution role in Account A with an IAM policy that allows the ecr:GetAuthorizationToken action on all resources, and the ecr:BatchCheckLayerAvailability, ecr:GetDownloadUrlForLayer, and ecr:BatchGetImage actions on the Account B repository.Cevap
- Configure the ECR repository policy in Account B to grant read-only access for the ecr:BatchCheckLayerAvailability, ecr:GetDownloadUrlForLayer, and ecr:BatchGetImage actions to the ECS task execution role ARN from Account A.Cevap
- CConfigure the ECS task role in Account A with an IAM policy that allows ECR API calls, and attach it to the container definition under the taskRoleArn parameter.
- DModify the trust policy of the ECS task execution role in Account A to allow the ecr.amazonaws.com service principal to assume the role.
- ECreate a secret in AWS Secrets Manager in Account A containing cross-account ECR registry credentials, and reference the secret in the container definition's repositoryCredentials parameter.
Cevap
Configure the ECS task execution role in Account A with permissions to pull the ECR image, and configure the ECR repository policy in Account B to grant access to Account A's task execution role.
To pull private ECR images cross-account, the ECS task execution role in Account A needs permissions to retrieve the authorization token and access the repository layers. Simultaneously, the repository policy in Account B must allow access from the Account A task execution role principal.
Adım Adım Çözüm
Anahtar Kavram
Configuring cross-account private ECR repository access for Amazon ECS tasks by separating Task Execution Role from Task Role permissions.