AWS Certified Developer - Associate (DVA-C02) · AWS

Deployment

11 practice questions covering 24% of the official AWS Certified Developer - Associate (DVA-C02) blueprint. Every item includes a worked explanation of the correct answer.

View all 4 domains in AWS Certified Developer - Associate (DVA-C02)

Syllabus Coverage & Domain Overview

The Deployment domain of the current DVA-C02 guide is about getting application code from a developer's machine into running AWS environments in a repeatable, testable way. The official outline splits it into four tasks: preparing application artifacts, testing applications in development environments, automating deployment testing, and deploying code through AWS continuous integration and delivery services. It is a hands-on domain, so expect to be judged on what you would actually configure rather than on definitions.

Preparing artifacts means knowing what goes inside a deployable package: dependencies, configuration files, environment variables and container images, plus a sensible directory layout and the memory and compute a function or service needs. Environment-specific configuration, including the use of AWS AppConfig, belongs here too. The testing tasks cover writing integration tests with mocked external APIs, building test events such as JSON payloads for Lambda and API Gateway, using API Gateway stages as development endpoints, and keeping approved versions available for testing through Lambda aliases, image tags or branch-based environments. Infrastructure as code runs through the whole domain, with AWS SAM and CloudFormation templates being written, updated and deployed to different environments.

The CI/CD task is the heaviest. You should be able to explain Lambda packaging options, API Gateway stages and custom domains, and how a commit to a repository triggers build, test and deploy actions. You also need to separate the roles of the services involved: a pipeline orchestrates, a build service compiles and tests using its build specification, and a deployment service releases using its own specification file and lifecycle hooks. Deployment strategies are central. Be clear on the differences between blue/green, canary, linear, rolling and all-at-once releases, what each costs in capacity and risk, and how each one is rolled back. The outline also mentions labels and branches for release management and using stage variables to drive dynamic behavior.

Questions are usually short scenarios with a constraint attached, such as minimal downtime, a gradual shift of traffic, a quick rollback, or keeping the same version across environments. Common traps include picking a strategy that replaces capacity in place when the scenario demands an untouched previous version, mixing up which file or service does what, and ignoring where the failure appears, for example a build failing versus a hook failing during deployment. Another trap is choosing a manual or console answer when the question clearly wants a template-driven, repeatable one. Read each option for the exact deployment platform, since EC2, Lambda and container targets behave differently.

For preparation, build a small SAM application and push it through a pipeline with a build step and a gradual Lambda deployment, then deliberately break a build, a hook and a template update and read the errors. Practise rollbacks, deploy the same template to two stages, and write one mocked integration test. Reading the official outline skill by skill and checking you can do each one is a reliable checklist.

In the official AWS Certified Developer - Associate (DVA-C02) examination blueprint, Deployment carries a weightage of 24%. Out of the total examination duration of 2 hr 10 min, candidates should budget approximately 31 min for questions from this domain to maintain pace across the paper.

How to Master Deployment for AWS Certified Developer - Associate (DVA-C02)

Our 11 published questions in Deployment are written for PrepIQ Hub and checked as set out in our editorial policy. Each item is written to the medium difficulty level of the AWS exam:

  • Targeted Topic Drills: Launch Topic Practice mode to work exclusively through Deployment items and review the step-by-step derivation after each submission.
  • Negative Marking Discipline: The AWS Certified Developer - Associate (DVA-C02) applies no negative marking penalty, so practice eliminating the three distractors systematically on every Deployment item.
  • Benchmark Target: Aim for at least 72% accuracy in Deployment drills before moving to full-paper simulations.

Deployment worked examples

Deployment questions from the AWS Certified Developer - Associate (DVA-C02) syllabus, answered in full. Try each one before opening the explanation.

  1. Example 1 · Deployment · easy

    An AWS CloudFormation stack provisions an Amazon RDS production database and an Amazon S3 audit bucket. If a junior engineer accidentally deletes the CloudFormation stack, the company wants the RDS database to have a final snapshot taken automatically before termination, and the S3 bucket to be kept intact without being deleted. Which DeletionPolicy values should be set on the RDS instance and the S3 bucket in the CloudFormation template?

    • ASet DeletionPolicy: Delete on both the RDS instance and the S3 bucket
    • BSet DeletionPolicy: Snapshot on RDS and DeletionPolicy: Retain on S3
    • CSet DeletionPolicy: Snapshot on S3 and DeletionPolicy: Delete on RDS
    • DSet UpdateReplacePolicy: Delete with no DeletionPolicy on either resource
    Show answer and explanation

    Correct answer: B. Set DeletionPolicy: Snapshot on RDS and DeletionPolicy: Retain on S3

    Why

    In CloudFormation, setting DeletionPolicy: Snapshot on resources that support snapshots (such as AWS::RDS::DBInstance, AWS::EC2::Volume, AWS::Redshift::Cluster) creates a final snapshot before deleting the resource, while setting DeletionPolicy: Retain preserves the resource (AWS::S3::Bucket) in your AWS account when the stack is deleted.

    • A. Set DeletionPolicy: Delete on both the RDS instance and the S3 bucket — DeletionPolicy: Delete permanently destroys the RDS database (unless DeleteAutomatedBackups/snapshot is set) and fails or deletes the bucket.
    • C. Set DeletionPolicy: Snapshot on S3 and DeletionPolicy: Delete on RDS — AWS::S3::Bucket does not support DeletionPolicy: Snapshot (only Delete, Retain, or RetainExceptOnCreate).
    • D. Set UpdateReplacePolicy: Delete with no DeletionPolicy on either resource — Omitting DeletionPolicy defaults to Delete when the stack is deleted.
  2. Example 2 · Deployment · medium

    A developer is writing a buildspec.yml file for AWS CodeBuild that compiles a Node.js TypeScript service, runs unit tests, and packages a production artifact. During the build, the script needs to fetch a database test password from AWS Secrets Manager (arn:aws:secretsmanager:us-east-1:111122223333:secret:TestDB-AbCdEf) and expose it as an environment variable inside the build container without hardcoding the secret in buildspec.yml. Which native buildspec.yml section supports this?

    • ACommit the plaintext password inside the phases.install.commands list in Git
    • BPlace the secret ARN inside the artifacts.discard-paths boolean field
    • CDeclare the secret under the env: secrets-manager: block in buildspec.yml
    • DDeclare the secret inside an EC2 appspec.yml ValidateService lifecycle hook
    Show answer and explanation

    Correct answer: C. Declare the secret under the env: secrets-manager: block in buildspec.yml

    Why

    In CodeBuild buildspec.yml (version 0.2), the env.secrets-manager (and env.parameter-store) mapping block natively resolves secrets from AWS Secrets Manager (or SSM Parameter Store) using the CodeBuild service role and injects them as masked environment variables during the build.

    • A. Commit the plaintext password inside the phases.install.commands list in Git — Committing plaintext secrets into buildspec.yml in Git exposes credentials to anyone with repo access.
    • B. Place the secret ARN inside the artifacts.discard-paths boolean field — discard-paths strips directory hierarchies from output artifacts; it does not resolve Secrets Manager values.
    • D. Declare the secret inside an EC2 appspec.yml ValidateService lifecycle hook — appspec.yml is for AWS CodeDeploy runtime deployment, not AWS CodeBuild compilation.
  3. Example 3 · Deployment · hard

    You are deploying an application to Amazon EC2 instances using AWS CodeDeploy (in-place deployment). Inside the root of your revision bundle sits the appspec.yml file defining lifecycle event hooks. In what exact chronological order does the CodeDeploy agent execute these four core lifecycle hooks during an EC2 deployment?

    • ABeforeInstall -> AfterInstall -> ApplicationStart -> ValidateService
    • BValidateService -> ApplicationStart -> BeforeInstall -> AfterInstall
    • CAfterInstall -> BeforeInstall -> ValidateService -> ApplicationStart
    • DBeforeAllowTraffic -> AfterAllowTraffic -> BeforeInstall -> ApplicationStart
    Show answer and explanation

    Correct answer: A. BeforeInstall -> AfterInstall -> ApplicationStart -> ValidateService

    Why

    For an in-place EC2 or on-premises CodeDeploy deployment, the agent runs lifecycle events in a fixed order: ApplicationStop, DownloadBundle, BeforeInstall, Install, AfterInstall, ApplicationStart, ValidateService. The four hooks you can script in appspec.yml and that the question lists therefore run BeforeInstall, then AfterInstall, then ApplicationStart, then ValidateService. A helpful way to remember it is preparation, file copy, configuration, start, verify. BeforeInstall handles pre-install tasks such as backing up or decrypting files. Install is reserved for the agent, which copies the revision files to their destinations, and you cannot script it. AfterInstall is for configuration after the files are in place. ApplicationStart restarts or starts services, and ValidateService runs last to confirm the deployment worked. The most common trap is mixing up the hook names with the traffic-routing hooks used for load-balanced and Lambda or ECS deployments, or forgetting that the file copy sits between BeforeInstall and AfterInstall.

    • B. ValidateService -> ApplicationStart -> BeforeInstall -> AfterInstall — This order reverses the sequence. ValidateService is the final hook and checks that the application is healthy after it has started, so it cannot run before ApplicationStart, BeforeInstall or AfterInstall.
    • C. AfterInstall -> BeforeInstall -> ValidateService -> ApplicationStart — This places AfterInstall before BeforeInstall and ValidateService before ApplicationStart. BeforeInstall always runs before the Install event and AfterInstall, and ValidateService must follow ApplicationStart because it verifies a running application.
    • D. BeforeAllowTraffic -> AfterAllowTraffic -> BeforeInstall -> ApplicationStart — BeforeAllowTraffic and AfterAllowTraffic are traffic-related hooks. They apply to load-balanced deployments and to Lambda and ECS deployments, and they run after the application is installed and started, never before BeforeInstall. The option also leaves out AfterInstall and ValidateService, so it does not describe the four core EC2 hooks.
  4. Example 4 · Deployment · medium

    A serverless team uses AWS SAM (template.yaml) and AWS CodeDeploy to deploy a new version of an AWS Lambda function behind an alias named live. They configure DeploymentPreference with Type: Linear10PercentEvery5Minutes. How long will it take for 100% of production traffic on the live alias to shift to the new Lambda version, and which two CodeDeploy lifecycle hooks are available for Lambda deployments?

    • A10% shifts every 5 minutes using BeforeAllowTraffic and AfterAllowTraffic hooks
    • B10% shifts for 5 minutes then 90% at once using BeforeInstall and AfterInstall
    • C100% shifts immediately using ApplicationStop and ValidateService EC2 hooks
    • D5% shifts every 10 minutes using BeforeBlockTraffic and DownloadBundle hooks
    Show answer and explanation

    Correct answer: A. 10% shifts every 5 minutes using BeforeAllowTraffic and AfterAllowTraffic hooks

    Why

    With Linear10PercentEvery5Minutes, CodeDeploy shifts 10% of traffic initially and adds 10% every 5 minutes across 9 subsequent intervals ($9 \times 5 = 45$ minutes; or 10 steps of 10% over 45–50 minutes, reaching 100% after 9 intervals of 5 minutes = 45 minutes after the initial 10% step, or 50 minutes across 10 intervals). For AWS Lambda deployments, CodeDeploy supports only two lifecycle hooks: BeforeAllowTraffic and AfterAllowTraffic (unlike EC2 deployments which use BeforeInstall, AfterInstall, ApplicationStart, ValidateService).

    • B. 10% shifts for 5 minutes then 90% at once using BeforeInstall and AfterInstall — Shifting 10% then 90% describes a Canary deployment, and BeforeInstall/AfterInstall are EC2/On-Premises hooks.
    • C. 100% shifts immediately using ApplicationStop and ValidateService EC2 hooks — Shifting 100% immediately is AllAtOnce, and ApplicationStop/ValidateService are EC2 hooks.
    • D. 5% shifts every 10 minutes using BeforeBlockTraffic and DownloadBundle hooks — The policy name Linear10PercentEvery5Minutes shifts 10% every 5 minutes, not 5% every 10 minutes.
  5. Example 5 · Deployment · medium

    An application runs on AWS Elastic Beanstalk across a fleet of 6 EC2 instances behind an Application Load Balancer. During a version update, the architect requires that: (1) existing instances never serve the old and new versions simultaneously without a full health check, (2) a brand-new Auto Scaling group of 6 instances is launched alongside the existing 6 instances, and (3) if the new instances fail health checks, rollback requires zero DNS swap and simply terminates the new temporary Auto Scaling group. Which Elastic Beanstalk deployment policy meets these requirements?

    • AAll at once deployment policy updating the 6 existing instances in place
    • BRolling deployment policy reducing capacity by one batch at a time
    • CRolling with additional batch updating existing instances after one batch
    • DImmutable deployment policy launching a full parallel set of new instances
    Show answer and explanation

    Correct answer: D. Immutable deployment policy launching a full parallel set of new instances

    Why

    Immutable deployments launch a temporary second Auto Scaling group of fresh instances inside the same environment behind the existing load balancer. Once the new instances pass health checks, they are moved into the primary Auto Scaling group and the old instances are terminated — allowing fast, clean rollback without modifying existing instances or swapping external DNS CNAMEs.

    • A. All at once deployment policy updating the 6 existing instances in place — All at once updates existing instances in place and causes brief service downtime.
    • B. Rolling deployment policy reducing capacity by one batch at a time — Rolling updates existing instances in place at reduced fleet capacity.
    • C. Rolling with additional batch updating existing instances after one batch — Rolling with additional batch still mutates existing instances in place after the first batch.
  6. Example 6 · Deployment · medium

    In an AWS CloudFormation template, Stack A (NetworkStack) creates a production VPC and wants to export the VpcId so that Stack B (AppStack, in the same AWS account and region) can reference that VpcId dynamically without hardcoding vpc-0abc12345. Which pair of CloudFormation intrinsic functions / sections should be used in Stack A and Stack B?

    • AUse Fn::Base64 in Stack A's Parameters and Fn::GetAZs in Stack B across regions
    • BUse DeletionPolicy: Retain in Stack A's Resources and CreationPolicy in Stack B
    • CUse Fn::Split in Stack A's Mappings and Fn::Cidr in Stack B for subnet IP parsing
    • DExport the value in Stack A's Outputs and call Fn::ImportValue in Stack B
    Show answer and explanation

    Correct answer: D. Export the value in Stack A's Outputs and call Fn::ImportValue in Stack B

    Why

    To share values across CloudFormation stacks in the same account and region, Stack A declares an Outputs entry with an Export: Name (!Sub "${AWS::StackName}-VpcId"), and Stack B imports that exported value using the Fn::ImportValue (!ImportValue) intrinsic function.

    • A. Use Fn::Base64 in Stack A's Parameters and Fn::GetAZs in Stack B across regions — Fn::Base64 encodes UserData strings and Fn::GetAZs lists Availability Zones; neither shares cross-stack outputs.
    • B. Use DeletionPolicy: Retain in Stack A's Resources and CreationPolicy in Stack B — DeletionPolicy and CreationPolicy govern resource lifecycle behavior, not cross-stack variable references.
    • C. Use Fn::Split in Stack A's Mappings and Fn::Cidr in Stack B for subnet IP parsing — Fn::Split and Fn::Cidr manipulate strings and IP blocks locally within a single template.

Every worked example on this page passed our independent verification before publication — how that works is set out in our editorial policy. Spotted an error? Tell us through the contact page and we will correct it.

All 6 Deployment questions with answers

All Syllabus Domains in AWS Certified Developer - Associate (DVA-C02)

AWS and Amazon Web Services are trademarks of Amazon.com, Inc. PrepIQ Hub is not affiliated with, endorsed by, or sponsored by Amazon Web Services.