SaveMyCert
Log in
5 of 5 free questions left today·for 30 a day
DVA-C03 · Domain 3

Testing and Deployment practice questions

Testing and Deployment is worth 22% of the DVA-C03 exam — the 3rd-heaviest of the 4 domains. Preparing and shipping code: packaging and container images, environment configuration, API Gateway stages, automated testing with SAM/CDK/CloudFormation and AI tools, and CI/CD with CodeDeploy, CodePipeline, ECS/EKS, deployment strategies and rollback. Official weighting 22%. 6 fully worked examples are further down this page, answers included.

Exam weight
22%
the 3rd-heaviest of the 4 domains
Questions
105
across 3 topics
Free, no account
5/day
a free account allows 30 a day
Explanations
Every option
right and wrong

Build a practice session

5 free questions left today.

Domains

How many?

Mode

Ready when you are

10 fresh questions drawn across 1 of 4 domains, in Learn mode.

Review what you missed

Every question you answer incorrectly, and every question you flag while practising, is saved here automatically. Finish a session and you can come back to re-drill just those.

6 sample Testing and Deployment questions, fully explained

Questions from the DVA-C03 bank mapped to domain 3, with the answer key and the reasoning behind every option. None of them repeat the examples on the main DVA-C03 practice page.

Question 1Testing and Deployment

A team stores release images in an Amazon ECR repository using version tags such as 2.4.1. Last week a developer rebuilt an older branch and pushed it with an existing version tag, so a later deployment pulled different code than the tag had before. The team wants ECR to reject any push that reuses a tag. What should a developer configure?

Choose one.

  • a
    Add a lifecycle policy rule that keeps tagged images

    Lifecycle policies only expire or archive images. They do not stop a push from moving an existing tag to a new image.

  • b
    Turn on scan on push for the repository's images

    Scanning reports vulnerabilities in pushed images. It does not block a push that reuses a tag.

  • c
    Turn on tag immutability in the repository's settings Correct

    With tag immutability on, ECR returns ImageTagAlreadyExistsException when a push uses a tag that already exists, so a version tag can never point at different code.

  • d
    Add a repository policy that denies the ecr:PutImage action

    Denying PutImage would block every push, including legitimate new versions, rather than only pushes that reuse a tag.

The concept

ECR tag immutability makes every tag in a repository point at one image for good.

Why that’s the answer

In a mutable repository a push with an existing tag silently moves the tag to the new image. Turning on tag immutability makes ECR reject such a push with ImageTagAlreadyExistsException, so a version tag always identifies the same image. Lifecycle rules and scanning manage or inspect images after they arrive, and denying PutImage stops all pushes.

How to reason it out
  1. Identify the problem: a tag was overwritten by a later push.
  2. Look for a repository setting that rejects reused tags.
  3. Recall that tag immutability returns ImageTagAlreadyExistsException.
  4. Turn it on for the release repository.

Exam tip: Want a tag to mean one image forever? Turn on ECR tag immutability.

DVA-C03 Deployment Artifacts: Dependencies, ECR Images, AppConfig and API Gateway Stages — the lesson that teaches this.

Question 2Testing and Deployment

A CI pipeline pushes every build to one ECR repository. Each build is tagged with its version (for example 3.1.0) and the pipeline also moves the latest tag and a dev-<branch> tag to the newest image. Version tags must never be overwritten. Existing task definitions reference this repository, and the team does not want to add steps to the pipeline. Which configuration meets these requirements?

Choose one.

  • a
    Set the repository to IMMUTABLE and expire latest and dev-* images after one day with a lifecycle rule

    With IMMUTABLE and no exclusions, the next push that moves latest fails with ImageTagAlreadyExistsException. A lifecycle rule acts within 24 hours, too late to free the tag for the next build.

  • b
    Set the repository to IMMUTABLE_WITH_EXCLUSION with wildcard filters for latest and dev-* Correct

    Immutability then protects every tag except those matching the exclusion filters, so version tags are rejected on reuse while latest and dev-* keep moving with no pipeline change.

  • c
    Set the repository to IMMUTABLE and delete the latest and dev-* tags with batch-delete-image before each push

    This works, but it adds a step to the pipeline, which the team ruled out, and it briefly leaves no latest tag.

  • d
    Push version tags to a new IMMUTABLE repository and keep latest and dev-* in the current MUTABLE one

    Splitting repositories protects version tags but changes the image URIs that existing task definitions reference and adds a second push to the pipeline.

The concept

ECR tag immutability can be applied to most tags while excluding a named set of moving tags.

Why that’s the answer

ECR supports exclusion filters on tag mutability. IMMUTABLE_WITH_EXCLUSION makes all tags immutable except those matching the wildcard filters, so version tags cannot be reused while latest and dev-* still move. Plain IMMUTABLE affects every tag, so moving latest fails; deleting tags before each push or splitting repositories would work but break the stated constraints (no new pipeline steps, same repository for existing task definitions). Lifecycle expiry is asynchronous and cannot free a tag in time.

How to reason it out
  1. List the requirements: version tags protected, latest and dev-* movable.
  2. Note the constraints: one repository, no new pipeline steps.
  3. Recall that plain IMMUTABLE applies to every tag in the repository.
  4. Recall that exclusion filters exempt matching tags from immutability.
  5. Choose IMMUTABLE_WITH_EXCLUSION with filters for the moving tags.

Exam tip: Immutable versions plus a moving latest in one repository: IMMUTABLE_WITH_EXCLUSION.

DVA-C03 Deployment Artifacts: Dependencies, ECR Images, AppConfig and API Gateway Stages — the lesson that teaches this.

Question 3Testing and Deployment

A team deploys an Amazon ECS service from images built by CodeBuild. During an incident, nobody could tell which source commit was running, and rolling back meant rebuilding an old branch. The team wants each running task to be traceable to its exact source revision and wants rollback to be a redeploy of an earlier image. Which tagging approach should the build use?

Choose one.

  • a
    Tag each image with the full Git commit ID that the build checked out Correct

    A commit-ID tag (CodeBuild exposes it as CODEBUILD_RESOLVED_SOURCE_VERSION) is unique per build and maps straight to the source revision. Rolling back means pointing the task definition at an earlier commit's tag, with no rebuild.

  • b
    Tag each image as latest and record the commit ID in the build logs

    latest moves on every build, so the running task's tag says nothing about its revision and earlier images lose their tag, which makes rollback a rebuild.

  • c
    Tag each image with the environment name and retag it on promotion

    Environment tags such as prod move between images on each promotion, so they cannot identify a revision and the previous image is no longer addressable by tag.

  • d
    Tag each image with the build date and keep the ECR repository mutable

    A date is not a source revision, and two builds on one day can share it. In a mutable repository the tag can also be overwritten.

The concept

Unique, revision-based image tags give traceability and cheap rollback; moving tags give neither.

Why that’s the answer

CodeBuild exposes the source revision in CODEBUILD_RESOLVED_SOURCE_VERSION (the commit ID for Git sources). Tagging images with it means the task definition revision names the exact commit, and every earlier image stays addressable, so rollback is a redeploy. Moving tags (latest, environment names) are fine as convenience pointers but cannot be the deployment reference. Pairing commit tags with tag immutability keeps them trustworthy.

How to reason it out
  1. Note both needs: trace a running task to a commit, roll back without rebuilding.
  2. Reject tags that move between images, such as latest or an environment name.
  3. Pick a tag that is unique per source revision.
  4. Reference that tag in the task definition for each deployment.

Exam tip: Deploy by an immutable commit-ID tag; use moving tags only as pointers.

DVA-C03 Deployment Artifacts: Dependencies, ECR Images, AppConfig and API Gateway Stages — the lesson that teaches this.

Question 4Testing and Deployment

Every CI build pushes a new image to an ECR repository and moves the build tag, which leaves the previous image untagged. Storage costs are growing because thousands of untagged images have built up. A developer wants ECR to remove untagged images automatically once they are older than 14 days. What should the developer configure?

Choose one.

  • a
    A repository policy that denies ecr:PutImage for untagged images

    A repository policy controls who may call ECR actions. It cannot delete existing images and does not act on image age.

  • b
    A lifecycle policy rule with tagStatus tagged and imageCountMoreThan set to 14

    This selects tagged images and keeps a count of 14, so it ignores the untagged images and could expire release images instead.

  • c
    A replication rule that moves untagged images to a cheaper Region's registry

    Replication copies images to other Regions or accounts. It does not remove anything from the source repository.

  • d
    A lifecycle rule with tagStatus untagged and sinceImagePushed of 14 days Correct

    This rule selects untagged images and expires those pushed more than 14 days ago, with no code to run or schedule.

The concept

ECR lifecycle policies expire images automatically by tag status and by age or count.

Why that’s the answer

A lifecycle policy rule selects images by tagStatus (untagged, tagged with a prefix or pattern, or any) and counts them by imageCountMoreThan or by age (sinceImagePushed with countUnit days). Untagged images older than 14 days are exactly what tagStatus untagged with sinceImagePushed 14 selects. ECR acts on matching images within 24 hours. Repository policies govern access, and replication copies images.

How to reason it out
  1. Identify the images: untagged ones.
  2. Identify the condition: older than 14 days.
  3. Map them to tagStatus untagged and countType sinceImagePushed.
  4. Preview the rule, then apply it as the repository's lifecycle policy.

Exam tip: Clean up old images in ECR with a lifecycle policy: pick the tag status, then age or count.

DVA-C03 Deployment Artifacts: Dependencies, ECR Images, AppConfig and API Gateway Stages — the lesson that teaches this.

Question 5Testing and Deployment

A repository holds images tagged prod-<version>, images with feature-branch tags and untagged images. A developer needs a lifecycle policy that always keeps the 10 newest prod-tagged images, however old they are, and expires every other image once it is older than 14 days. Which policy meets the requirement?

Choose one.

  • a
    Rule priority 1: any, sinceImagePushed 14 days. Rule priority 2: tagged, prefix prod, imageCountMoreThan 10.

    Here the age rule wins first and would expire prod images older than 14 days. ECR also requires a tagStatus any rule to have the lowest priority, so this policy is not valid.

  • b
    Rule priority 1: untagged, sinceImagePushed 14 days. Rule priority 2: tagged, prefix prod, imageCountMoreThan 10.

    Feature-branch images are tagged but do not match prod, so neither rule selects them and they are never expired.

  • c
    Rule priority 1: tagged, prefix prod, sinceImagePushed 14 days. Rule priority 2: any, imageCountMoreThan 10.

    This expires prod images by age, the opposite of the requirement, and keeps only 10 of all other images regardless of age.

  • d
    Rule priority 1: tagged, prefix prod, imageCountMoreThan 10. Rule priority 2: any, sinceImagePushed 14 days. Correct

    Images matching the prefix rule cannot be expired by the lower-priority any rule, so the 10 newest prod images survive whatever their age, older prod images expire, and everything else expires after 14 days.

The concept

ECR lifecycle rules are evaluated together but applied in priority order, and an image matched by a higher-priority rule's tag filter is protected from lower-priority rules.

Why that’s the answer

ECR evaluates all rules, then applies them by priority (a lower number wins). An image that matches the tagging requirements of a rule cannot be expired by a lower-priority rule. So a priority 1 rule for prefix prod with imageCountMoreThan 10 expires only prod images beyond the newest 10, and the priority 2 any rule with sinceImagePushed 14 cannot touch prod images at all. A tagStatus any rule must have the lowest priority. Policies that rank the age rule first, leave feature tags unselected, or swap the count types fail the requirement.

How to reason it out
  1. Write down both requirements: keep the 10 newest prod images, age out the rest after 14 days.
  2. Recall that a lower priority number wins and protects images its tag filter matches.
  3. Put the prod prefix rule with imageCountMoreThan 10 first.
  4. Add a final tagStatus any rule with sinceImagePushed 14 days.
  5. Run the lifecycle policy preview before applying.

Exam tip: In ECR lifecycle policies, put specific tag rules first and the catch-all any rule last.

DVA-C03 Deployment Artifacts: Dependencies, ECR Images, AppConfig and API Gateway Stages — the lesson that teaches this.

Question 6Testing and Deployment

A developer's Dockerfile installs a compiler toolchain, builds a Go service and runs the resulting binary. The pushed image is over 1 GB, and security scans flag vulnerabilities in the build tools that the running service never uses. The developer wants a small runtime image that contains only the compiled binary and keeps building with one Dockerfile. What should the developer do?

Choose one.

  • a
    Add a .dockerignore file that excludes the compiler and toolchain folders from the image

    .dockerignore only filters files sent from the build context. The toolchain is installed inside the image by RUN instructions, so it stays.

  • b
    Use a multi-stage build and copy just the binary into a minimal final stage Correct

    The first stage holds the toolchain and compiles the binary; COPY --from copies just the binary into a small base image, so build tools never reach the final image.

  • c
    Add a final RUN instruction that uninstalls the compiler and build tools

    Each instruction adds a layer. Removing files in a later layer hides them but the earlier layers still carry them, so the image barely shrinks.

  • d
    Turn on Docker layer caching in the CodeBuild project that builds the image

    Layer caching speeds up repeat builds by reusing layers. It does not change what the final image contains.

The concept

Multi-stage builds separate build-time dependencies from the runtime image.

Why that’s the answer

A Dockerfile can define several FROM stages. The build stage installs compilers and produces the artifact, and the final stage starts from a minimal base and uses COPY --from=<stage> to take only the artifact. Layers from earlier stages are not part of the final image, so it is smaller and has fewer vulnerable packages. Deleting tools in a later RUN leaves them in earlier layers, and .dockerignore filters the build context, not installed packages.

How to reason it out
  1. Note what the runtime needs: only the compiled binary.
  2. Recall that image layers are additive, so later deletes do not shrink earlier layers.
  3. Split the Dockerfile into a build stage and a minimal runtime stage.
  4. Copy the binary across with COPY --from.

Exam tip: Build in one stage, ship from another: multi-stage builds keep build tools out of the image.

DVA-C03 Deployment Artifacts: Dependencies, ECR Images, AppConfig and API Gateway Stages — the lesson that teaches this.

What DVA-C03 domain 3 tests, topic by topic

The official exam guide breaks Testing and Deployment into 3 topics. The question bank follows the same split, so a weak topic shows up as a cluster of misses you can go back and read.

Published DVA-C03 practice questions per topic in Testing and Deployment
TopicWhat it coversQuestions
Prepare application artifacts to be deployed to AWSOfficial DVA-C03 Task 3.1 skills: (1) Manage dependencies for code modules (for example, environment variables, configuration files, container images) within packages. (2) Build and manage container images for deployment (for example, by using Amazon ECR, Docker files, container image tagging, lifecycle policies). (3) Use code repositories in deployment environments. (4) Manage environment-specific application configuration by using AWS services (for example, AWS AppConfig, AWS Systems Manager Parameter Store, AWS Secrets Manager, Amazon API Gateway, AWS Lambda). (5) Use API Gateway features and resources (for example, stage-specific URLs, endpoints).35
Implement and automate application testing in AWS environmentsOfficial DVA-C03 Task 3.2 skills: (1) Develop and validate tests (for example, by using AWS SAM, AWS CDK, AWS CloudFormation). (2) Use mock APIs for external dependencies by using AWS services and tools (for example, API Gateway). (3) Create application test events (for example, by using JSON payloads to test Lambda functions and API Gateway APIs). (4) Create and configure application environments (for example, Lambda aliases, container image tags, AWS Amplify branches, AWS Copilot environments, API Gateway APIs). (5) Use AWS AI tools to generate tests and automate repetitive testing workflows (for example, automated test execution, test result analysis, regression testing automation, test coverage).35
Deploy code by using AWS continuous integration and continuous delivery (CI/CD) servicesOfficial DVA-C03 Task 3.3 skills: (1) Use Lambda deployment packaging methods to optimize deployment efficiency (for example, .zip files, container images, layers). (2) Deploy containerized applications by using AWS container orchestration services (for example, Amazon ECS task definitions, Amazon EKS manifests, AWS Fargate launch types, rolling updates). (3) Use infrastructure as code (IaC) templates (for example, CloudFormation templates, AWS SAM templates). (4) Deploy application revisions to target environments by using AWS CodeDeploy. (5) Use AWS CodePipeline to orchestrate CI/CD pipelines (for example, invoke pipelines from linked code repositories, orchestrate progression through multiple environments). (6) Implement deployment strategies for application releases (for example, blue/green, canary, rolling). (7) Implement automatic or manual rollback by using AWS services (for example, CloudFormation, CodeDeploy). (8) Use source control features to manage application versions and releases (for example, labels, branches). (9) Use AWS AI tools to support CI/CD workflows (for example, automated deployment approvals, environment provisioning, post-deployment validation).35
Total105

Revise Testing and Deployment before you drill it

Other DVA-C03 domains

Testing and Deployment: your questions

Testing and Deployment is domain 3 of the DVA-C03 exam guide and carries 22% of the scored content — the 3rd-heaviest of the 4 domains. On a 65-question paper that works out to roughly 14 questions, though AWS does not publish an exact per-domain count and individual exam forms vary.

Source

The domain weight and topic list on this page come from the official DVA-C03 exam guide.