SDLC Automation

A build role pulls Docker Hub images through an Amazon ECR pull through cache rule that has valid upstream credentials. Its identity policy allows ecr:GetAuthorizationToken and the image-pull actions on the docker-hub/* repositories. Tags that are already cached pull successfully, but pulling a tag that has never been cached fails with access denied, even though its repository already exists. Which permission should be added?

Show the answer

Correct answerC. ecr:BatchImportUpstreamImage on the docker-hub/* repositories

AWhy not this: This permission creates rules; the rule already exists and pulling through it does not need it.

BWhy not this: Push permissions are not needed: ECR imports the upstream image itself once the caller may trigger the import.

CWhy this is right: Pulling an uncached tag makes ECR import it from upstream, and the caller must be allowed to trigger that import.

DWhy not this: ECR reads the upstream credentials secret itself; the caller doesn't need access to it to pull.

When a requested image isn't cached yet, ECR imports it from the upstream registry, which requires ecr:BatchImportUpstreamImage for the caller; ecr:CreateRepository is also needed only when the repository doesn't exist. Push permissions and rule-management permissions are not part of pulling.