A retail company deploys its order service to Amazon ECS from a shared Amazon ECR repository. Last month, a rebuild pushed a new image under a tag that production was already using. A later rollback to an older task definition revision then ran a different build than the team expected.
Other teams' pipelines rely on moving tags in this repository, so its settings must stay as they are. A rollback must run exactly the image that ran before, and each running image must trace back to its source commit.
Which TWO actions meet these requirements? (Choose two.)
Choose two answers.
AA. Add an ECR lifecycle policy that expires untagged images after seven days, so replaced images are removed before anyone can deploy them.
BB. In each task definition revision, reference the image by its digest (repository@sha256:...) instead of by a tag.
CC. Set the repository's tag mutability to IMMUTABLE, so any push that reuses a tag already in the repository is rejected.
DD. Tag each image with the Git commit SHA it was built from when the build pushes it to the repository.
EE. Have the build script retag the newest image with the release name each time, so the release name always points to the latest build.
Show the answer and explanation
Answers: B, D
A. Wrong: A lifecycle policy removes old images, but it does not stop a tag from pointing to a new build. Expiring old images can also remove the exact image that a rollback needs.
D. Right: Correct. A commit SHA names the one source revision that a build came from, so the image a task runs can be traced to its commit. Each build gets its own SHA, so the pipeline never has a reason to reuse the tag.
E. Wrong: Retagging moves the release name to a new image, which is the exact problem the team is trying to prevent. A task definition that names the release tag can then run a different build after a rollback.
Explanation
Referencing the image by digest in each task definition revision pins it to one exact image, so a rollback runs the same build even if a tag later moves. Tagging each image with its Git commit SHA ties it to one source revision. Tag immutability would also stop tags from moving, but it changes the shared repository that other teams rely on.
Want more on Container images and deployments with ECR, ECS and EKS? The 5 full-length practice sets have 10 more Container images and deployments with ECR, ECS and EKS questions, 390 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets →