Skip to main content

DVA-C02 · 24% of the exam

Deployment practice questions

10 free Deployment questions for the AWS Certified Developer – Associate (DVA-C02) exam, each with the correct answer and an explanation for every option.

What this domain covers

Packaging and releasing applications: CI/CD with the AWS developer tools, infrastructure as code and deployment strategies.

Exam weight
24%
On a real exam
≈ 16 questions
In our bank
142 questions

Topics that come up most

  • CodeCommit, CodeBuild, CodeDeploy, CodePipeline
  • SAM and CloudFormation templates
  • Elastic Beanstalk deployment policies
  • Lambda versions, aliases and traffic shifting
  • Blue/green and canary deployments

How to study it

Memorise what each deployment policy does to availability and rollback time; the questions give a constraint and ask for the policy.

Sample Deployment questions

Try each one before opening the answer. Original questions written to the official exam objectives.

  1. Question 1

    A company manages dozens of AWS accounts with AWS Organizations. A developer must deploy a baseline security CloudFormation template to every account in a production organizational unit (OU). Accounts added to that OU later must receive the stack automatically, with no manual step. Which approach meets these requirements?

    • ACreate a StackSet with service-managed permissions that targets the OU, and turn on automatic deployment
    • BCreate a StackSet with self-managed permissions that targets the current account IDs in the OU
    • CCreate a root stack that uses nested stacks, with one AWS::CloudFormation::Stack resource for each account
    • DPackage the baseline template as a CloudFormation module in the registry and share it with the organization
    Show answer and explanation

    Answer: A) Create a StackSet with service-managed permissions that targets the OU, and turn on automatic deployment

    Only StackSets with service-managed permissions support automatic deployment. When it is turned on, CloudFormation deploys stack instances to accounts as they join a target OU. Self-managed StackSets, nested stacks, and modules do not cover new accounts automatically.

    • ACorrect. With service-managed permissions, StackSets deploy to accounts managed by AWS Organizations and create the required IAM roles for you. When automatic deployment is turned on, CloudFormation deploys a stack to any account that is added to a target OU.
    • BIncorrect. With self-managed permissions, you must create the IAM roles in each target account yourself, and the StackSet deploys only to the accounts you list. Automatic deployment to new Organizations accounts is a feature of the service-managed model.
    • CIncorrect. Nested stacks split one template into reusable pieces that are created as part of a parent stack. They are not a way to deploy across multiple accounts, and they do not respond to accounts being added to an OU.
    • DIncorrect. Modules are reusable, versioned resource configurations that you include in your own templates. Each account would still have to deploy a stack that uses the module, so registering a module deploys nothing to new accounts.
  2. Question 2

    A developer defines a Python Lambda function in an AWS CDK stack using lambda.Code.fromAsset() with a bundling option. The bundling option specifies the runtime's bundlingImage and the command 'pip install -r requirements.txt -t /asset-output && cp -au . /asset-output'. What happens when the developer runs cdk synth or cdk deploy?

    • AThe CDK runs the command in a Docker container from the runtime's build image, with the source mounted at /asset-input, and zips the /asset-output contents as the function code.
    • BThe CDK uploads the raw source directory to Amazon S3, and Lambda runs the bundling command during the first invocation, before the handler starts.
    • CThe CDK passes the bundling command to CloudFormation, which runs it in a temporary CodeBuild project during stack creation and stores the output.
    • DThe CDK embeds the bundled code inline in the template's ZipFile property, so the stack needs no bootstrap staging bucket.
    Show answer and explanation

    Answer: A) The CDK runs the command in a Docker container from the runtime's build image, with the source mounted at /asset-input, and zips the /asset-output contents as the function code.

    CDK asset bundling runs the build command in a Docker container during synthesis, by default using the runtime's SAM build image. The /asset-output contents become the Lambda code package, which the CDK then publishes to the bootstrap S3 bucket. (NodejsFunction uses local esbuild when it's available and falls back to Docker otherwise.)

    • ACorrect. The CDK runs bundling during synthesis. It mounts the asset path at /asset-input inside the container, and whatever the command writes to /asset-output is zipped and used as the Lambda code. Runtime.bundlingImage points to the AWS SAM build image for that runtime.
    • BIncorrect. Bundling happens on the machine running the CDK, during synthesis, not at runtime. Lambda never runs CDK bundling commands. The finished, bundled artifact is what gets published.
    • CIncorrect. CloudFormation doesn't run CDK bundling commands. The CDK produces the bundled asset locally in the cloud assembly (cdk.out) before any stack deployment begins.
    • DIncorrect. The CDK CLI first publishes file assets to the Amazon S3 bucket created during bootstrapping, and only then deploys the stack's resources. Bundling prepares the artifact but doesn't remove this staging step.
  3. Question 3

    A developer adds a Connectors attribute to an AWS::Serverless::Function resource in an AWS SAM template. The connector names a DynamoDB table as its Destination and lists Write under Permissions. What does AWS SAM do with this connector at deployment?

    • AIt composes the scoped IAM access policies that let the function write to the table, so the developer doesn't hand-write policy statements
    • BIt creates a VPC gateway endpoint for DynamoDB so the function can reach the table without sending traffic over the public internet
    • CIt creates an event source mapping so that changes to items in the table automatically invoke the function with the modified records
    • DIt packages the DynamoDB client libraries into a Lambda layer that is attached to the function so it can call the table at runtime
    Show answer and explanation

    Answer: A) It composes the scoped IAM access policies that let the function write to the table, so the developer doesn't hand-write policy statements

    AWS SAM connectors let you state the intended access between resources, such as Read or Write from a function to a table. SAM then composes the scoped IAM policies, so you don't write them by hand.

    • ACorrect. Connectors (AWS::Serverless::Connector) let you state the source, the destination, and Read or Write permission. AWS SAM then composes the matching, narrowly scoped access policies for you.
    • BIncorrect. Connectors only provision permissions between resources. They don't create networking components such as VPC endpoints.
    • CIncorrect. A connector grants the access the source needs to the destination. It does not set up event triggers. A stream trigger is defined separately, for example as an event on the function.
    • DIncorrect. Connectors do not package dependencies or create layers. Their only job is to compose the access policies between the source and destination resources.
  4. Question 4

    A developer has broad permissions and creates a CloudFormation stack using the AWS CLI, passing the ARN of a CloudFormation service role with the --role-arn parameter. The role trusts cloudformation.amazonaws.com and grants only Amazon EC2 actions. Whose permissions does CloudFormation use to provision the stack's resources?

    • AThe service role's permissions, for this and all later operations on the stack; the developer needs iam:PassRole to specify the role
    • BThe developer's own permissions, because the service role is only assumed to roll back resources when a stack operation fails
    • CThe intersection of the developer's permissions and the service role's permissions, so every resource action must be allowed by both
    • DThe developer's own permissions for the initial create, with the service role applied only to later stack updates and deletions
    Show answer and explanation

    Answer: A) The service role's permissions, for this and all later operations on the stack; the developer needs iam:PassRole to specify the role

    By default, CloudFormation uses a temporary session generated from the caller's credentials. Once a service role is specified, CloudFormation uses that role's credentials for all operations on the stack. The caller needs iam:PassRole to specify the role.

    • ACorrect. When a service role is specified, CloudFormation uses that role's credentials and keeps using that role for every later operation on the stack. To specify the role, the caller must have iam:PassRole permission for it. Resources outside the role's EC2 permissions would fail to create, even though the developer has broader access.
    • BIncorrect. The service role is not limited to rollbacks. Once specified, it is used for all create, update and delete operations on the stack. The caller's own credentials are used only when no service role is specified.
    • CIncorrect. CloudFormation does not evaluate both identities together. It acts with the service role's credentials, so the developer's own resource permissions do not limit or widen what the stack can create.
    • DIncorrect. A service role specified at creation is used immediately, including for the initial create. The documentation says CloudFormation always uses that role for all operations performed on the stack.
  5. Question 5

    A developer has already initialized a project directory with the EB CLI and has a running AWS Elastic Beanstalk environment. The developer wants to push new code to that environment from the command line, without manually creating a ZIP file and uploading it in the console. Which EB CLI command should the developer use?

    • A`eb deploy`, which bundles the project source and deploys it to the environment
    • B`eb init`, which sets the application defaults for the project directory
    • C`eb create`, which provisions an Elastic Beanstalk environment for the application
    • D`eb setenv`, which applies updated settings to the default environment
    Show answer and explanation

    Answer: A) `eb deploy`, which bundles the project source and deploys it to the environment

    `eb deploy` packages the project's source bundle and deploys it to an existing environment directly from the command line. `eb init`, `eb create`, and `eb setenv` handle project setup, environment creation, and environment properties instead.

    • A`eb deploy` creates a source bundle from the project directory (using git archive of the latest commit when Git is used, or the directory contents when .ebignore is present). It then deploys that bundle as a new application version to the running environment.
    • B`eb init` configures default values and creates the Elastic Beanstalk application. It doesn't deploy code to an environment.
    • C`eb create` creates a new environment. The developer wants to update the existing running environment, which is what `eb deploy` does.
    • D`eb setenv` only sets environment properties (environment variables). It doesn't package or deploy application code.
  6. Question 6

    A team runs two versions of a public API behind separate endpoints in the same AWS Region. Neither endpoint uses an Application Load Balancer or AWS CodeDeploy. The team wants to send 5% of client traffic to the new version first, then raise that share step by step until the old version gets no traffic. Which Amazon Route 53 configuration meets this requirement?

    • AWeighted records with the same name for each endpoint, adjusting each record's relative weight over time
    • BFailover records with the new endpoint as primary and the old endpoint as secondary, linked to health checks
    • CLatency records for each endpoint so Route 53 sends clients to whichever version responds fastest
    • DMultivalue answer records for each endpoint so Route 53 returns healthy records selected at random
    Show answer and explanation

    Answer: A) Weighted records with the same name for each endpoint, adjusting each record's relative weight over time

    Route 53 weighted routing splits traffic among records with the same name in proportion to their weights. Changing the weights over time gives a gradual, DNS-level shift between versions without an ALB or CodeDeploy.

    • ACorrect. With weighted routing, Route 53 sends each record a share of traffic equal to its weight divided by the total weight of the group. The team can change the weights gradually and set the old record's weight to 0 to stop sending it traffic.
    • BIncorrect. Failover routing is active-passive. All traffic goes to the primary while it is healthy, so traffic cannot be split in set proportions.
    • CIncorrect. Latency routing picks the AWS Region with the lowest latency for the client. Both endpoints are in the same Region, and this policy gives no control over traffic proportions.
    • DIncorrect. Multivalue answer routing returns up to eight healthy records chosen at random. It does not let the team set or gradually change how much traffic each endpoint receives.
  7. Question 7

    A developer uses AWS CodeDeploy to shift traffic on a Lambda function alias to a new function version with a canary configuration. Before any traffic moves to the new version, a separate validation Lambda function must invoke the new version and report Succeeded or Failed to CodeDeploy, so that a failure stops the deployment and triggers a rollback. Which AppSpec lifecycle event hook should the developer use for the validation function?

    • ABeforeAllowTraffic
    • BAfterAllowTraffic
    • CAllowTraffic
    • DBeforeInstall
    Show answer and explanation

    Answer: A) BeforeAllowTraffic

    In a CodeDeploy Lambda deployment, only BeforeAllowTraffic and AfterAllowTraffic can be hooks. BeforeAllowTraffic is the one that validates the new version before any traffic shifts. AllowTraffic itself is reserved for CodeDeploy and can't be scripted.

    • AIn a Lambda deployment, BeforeAllowTraffic runs tasks before traffic shifts to the new function version. The validation function reports its result with PutLifecycleEventHookExecutionStatus, and a Failed result fails the deployment.
    • BAfterAllowTraffic runs after all traffic has shifted to the new version. That's too late for a check that must pass before any traffic moves.
    • CAllowTraffic is the event in which CodeDeploy shifts the traffic. Like Start and End, it's reserved and can't be scripted, so no hook function can be attached to it.
    • DBeforeInstall is a hook for EC2/On-Premises and Amazon ECS deployments. Lambda deployments support only BeforeAllowTraffic and AfterAllowTraffic hooks.
  8. Question 8

    A CloudFormation template has a UseSSL parameter (AllowedValues: Yes, No) and a CertificateArn parameter that defaults to an empty string. The team wants CloudFormation to reject a stack create or update before any resources are provisioned whenever UseSSL is Yes and CertificateArn is empty. Which template feature meets this requirement?

    • AA Rules entry whose RuleCondition checks that UseSSL equals Yes and whose Assert requires CertificateArn to be non-empty
    • BAn AllowedPattern on the CertificateArn parameter that requires the value to match the ACM certificate ARN format
    • CA Conditions entry that evaluates UseSSL and is attached to every resource that references the certificate
    • DA Mappings entry keyed by UseSSL values that lists the certificate ARN required for each setting
    Show answer and explanation

    Answer: A) A Rules entry whose RuleCondition checks that UseSSL equals Yes and whose Assert requires CertificateArn to be non-empty

    The Rules section is CloudFormation's built-in way to validate parameters, including checks across more than one parameter, before any resources are created or updated. Per-parameter constraints, Conditions and Mappings can't do this.

    • ARules validate parameter values before CloudFormation creates or updates resources. A RuleCondition decides when the assertions apply, and a failed Assert stops the stack operation and shows the AssertDescription. That makes it a fit for checks that depend on another parameter.
    • BAllowedPattern checks one parameter by itself, so it can't depend on UseSSL. It would also reject the empty default when UseSSL is No.
    • CConditions control whether resources or properties are created. They don't reject a stack operation because a parameter combination is invalid.
    • DMappings are static lookup tables read with Fn::FindInMap. They don't check user-supplied parameter values or cause a stack operation to fail.
  9. Question 9

    What does CodePipeline's "superseded" execution mode do when a new pipeline execution starts while a previous one for the same pipeline is still in progress?

    • AIt stops the older, in-progress execution at its current stage boundary and lets the newer execution proceed, rather than making the new one wait in a queue behind the old one
    • BIt runs every triggered execution fully in parallel with no interaction between them
    • CIt queues every execution and processes them one at a time in strict order with no skipping
    • DIt has no effect on how concurrent executions are handled
    Show answer and explanation

    Answer: A) It stops the older, in-progress execution at its current stage boundary and lets the newer execution proceed, rather than making the new one wait in a queue behind the old one

    • ASuperseded mode (a common default) means that when newer source changes trigger a fresh execution while an older one is still running, the older execution is superseded (stopped) at its next stage transition and the pipeline moves forward with the newer, more current execution instead of processing every stale execution one after another.
    • BThat describes parallel execution mode, a different, separate configuration option — not what superseded mode does, which specifically supersedes (stops) the older execution rather than running both concurrently.
    • CThat describes queued execution mode, a different option — superseded mode specifically allows skipping past a stale, still-running older execution rather than strictly processing every one in order.
    • DExecution mode is specifically the setting that determines how CodePipeline handles overlapping executions — it has a very real, defined effect on this behavior.
  10. Question 10

    A team built its production workload in us-east-1 by hand in the AWS Management Console. It is planning a backup-and-restore disaster recovery strategy that uses us-west-2 as the recovery Region. What is the main benefit of first defining the workload's infrastructure in AWS CloudFormation templates?

    • AThe same templates can redeploy the infrastructure in us-west-2 quickly and consistently, which helps the team meet its recovery time objective (RTO)
    • BDeploying the stack in us-west-2 automatically copies the DynamoDB items and S3 objects from us-east-1 into the new resources
    • CCloudFormation keeps a standby copy of each stack running in us-west-2 and redirects user traffic to it when us-east-1 fails
    • DTemplates lower the recovery point objective (RPO) because CloudFormation stores point-in-time snapshots of each resource's data
    Show answer and explanation

    Answer: A) The same templates can redeploy the infrastructure in us-west-2 quickly and consistently, which helps the team meet its recovery time objective (RTO)

    For disaster recovery, infrastructure as code lets you redeploy the same infrastructure quickly and reliably in another Region or account, which supports the RTO. Application data still needs its own backup or replication, and traffic failover is handled by other services.

    • ACorrect. AWS guidance for backup and restore is to deploy with infrastructure as code (CloudFormation or CDK) so that infrastructure can be redeployed in the recovery Region quickly and without errors. Without IaC, restoring in the recovery Region is complex, which increases recovery time and may exceed the RTO.
    • BIncorrect. A template defines resources, not their contents. Data needs its own backup or replication, for example AWS Backup cross-Region copies, DynamoDB backups or global tables, or S3 Cross-Region Replication.
    • CIncorrect. CloudFormation does not run standby stacks or fail traffic over. Traffic failover is done with services such as Amazon Route 53 health checks or Amazon Application Recovery Controller (ARC).
    • DIncorrect. RPO depends on how often data is backed up or replicated. CloudFormation does not take snapshots of resource data. IaC mainly helps with how fast infrastructure is redeployed, which affects RTO.

Deployment: FAQs

How much of the DVA-C02 exam is Deployment?

Deployment is 24% of the DVA-C02 exam by the official exam guide's weighting, which on a 65-question form works out to roughly 16 questions. The real exam's exact split varies by form.

What does the Deployment domain cover?

Packaging and releasing applications: CI/CD with the AWS developer tools, infrastructure as code and deployment strategies.

How should I study Deployment for DVA-C02?

Memorise what each deployment policy does to availability and rollback time; the questions give a constraint and ask for the policy.

Where can I practise more Deployment questions?

This page has 10 free Deployment questions with answers. CertRidge's DVA-C02 question bank has 142 questions in this domain. Every practice exam result breaks your score down by domain, and Review Mode re-drills the questions you missed.

Get Deployment exam-ready

The full DVA-C02 bank has 142 Deployment questions. Timed practice exams match the real exam's length and domain weights, every result shows your score per domain, and Review Mode re-drills the questions you missed.

Not affiliated with AWS; questions are original and never copied from the real exam.