Course menuDVA-C03

Exams / DVA-C03 / Container images and deployments with ECR, ECS and EKS / Question 1

DVA-C03 practice question: Container images and deployments with ECR, ECS and EKS (1 of 2)

Testing and Deployment A free question from our original DVA-C03 practice exam. Try it, then open the answer to see why each option is right or wrong.

Last verified against current AWS documentation ·How we write our questions

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.

  1. A. Add an ECR lifecycle policy that expires untagged images after seven days, so replaced images are removed before anyone can deploy them.
  2. B. In each task definition revision, reference the image by its digest (repository@sha256:...) instead of by a tag.
  3. C. Set the repository's tag mutability to IMMUTABLE, so any push that reuses a tag already in the repository is rejected.
  4. D. Tag each image with the Git commit SHA it was built from when the build pushes it to the repository.
  5. E. 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.
  • B. Right: Correct. A digest identifies one exact image, and moving a tag does not change what the digest points to. Rolling back to an older task definition revision then runs the same image that ran before. Learn more: Amazon ECS task definition parameters (opens in a new tab)
  • C. Wrong: Immutable tags would stop a tag from moving, but this changes a setting of the shared repository. Other teams' pipelines rely on moving tags, so the stated constraint rules this out. Learn more: Image tag mutability in Amazon ECR (opens in a new tab)
  • 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.

Study

Keep practicing

Answer questions with a score at the end, or practice just this topic with the explanation after each one. No sign-up needed.

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