Skip to main content

DVA-C02 practice question · Deployment

A CodeBuild project builds a container image from a CodeCommit repository and pushes it to Amazon ECR.

A CodeBuild project builds a container image from a CodeCommit repository and pushes it to Amazon ECR. During incidents, operators must be able to look at the image tag of a running container and identify the exact Git revision it was built from. Which tagging approach meets this requirement?

  • ATag each image with the value of CODEBUILD_RESOLVED_SOURCE_VERSION, read after the source download phase
  • BTag each image only as latest and turn on tag immutability for the ECR repository
  • CTag each image with the value of CODEBUILD_START_TIME so that every pushed tag is unique
  • DTag each image with the value of CODEBUILD_INITIATOR to show which pipeline or user started it
Show the answer and explanation

Correct answer: A) Tag each image with the value of CODEBUILD_RESOLVED_SOURCE_VERSION, read after the source download phase

Tagging images with the commit ID from CODEBUILD_RESOLVED_SOURCE_VERSION makes every image traceable to its exact source revision. Timestamps, initiator names, and a single latest tag cannot do that.

Why each option is right or wrong

  • A) Correct. For CodeCommit, GitHub, and Bitbucket sources, CODEBUILD_RESOLVED_SOURCE_VERSION contains the commit ID (available after DOWNLOAD_SOURCE). Using it, or a shortened form, as the tag links each image directly to the exact commit.
  • B) Incorrect. Tag immutability stops tags from being overwritten. After the first push, any later push of latest fails with ImageTagAlreadyExistsException. The latest tag also contains no commit information.
  • C) Incorrect. CODEBUILD_START_TIME is the build start timestamp. It makes each tag unique, but it does not identify which Git commit was built.
  • D) Incorrect. CODEBUILD_INITIATOR identifies who started the build, such as a pipeline name or user name. It is the same for many builds and does not identify a source revision.
Exam domain
Deployment · 24% of DVA-C02
Question type
Multiple choice (one answer)

Practise the full DVA-C02 exam

This question is one of a small free sample from the CertRidge DVA-C02 bank. Full practice exams match the real exam's length, time limit and domain weights, explain every option, and Review Mode re-drills the questions you miss.

Original question written from the official exam guide. Not affiliated with AWS; never copied from the real exam.

Worth reading: DVA-C02 cheat sheet, Lambda, DynamoDB, API Gateway, IAM and Cognito, messaging, CI/CD and X-Ray in tables, plus what DVA-C03 changes.