AWS Developer Associate Domain 3: Deployment
48 free practice questions for Deployment in the AWS Certified Developer – Associate (DVA-C02) exam. Try each question first, then open "Show answer" for the correct option and explanation.
Deployment practice questions
-
Question 1. What line marks a CloudFormation template as an AWS SAM template?
Show answer
Answer: C. Transform: AWS::Serverless-2016-10-31
The SAM transform expands resources such as AWS::Serverless::Function into standard CloudFormation.
-
Question 2. Which SAM CLI command packages code, uploads artifacts, and deploys the stack?
Show answer
Answer: C. sam deploy
sam build prepares artifacts, and sam deploy uploads them and creates or updates the CloudFormation stack.
-
Question 3. A developer wants to run a Lambda function locally with a sample event before deploying. Which command fits?
Show answer
Answer: C. sam local invoke with an event file
sam local runs the function in a local container that mimics the Lambda runtime.
-
Question 4. In a SAM template, which feature grants a function common permissions, such as DynamoDB CRUD on one table, with little policy writing?
Show answer
Answer: B. SAM policy templates such as DynamoDBCrudPolicy
Policy templates generate least-privilege policies scoped to the resource you name.
-
Question 5. Which SAM setting makes each deployment of a function shift traffic gradually with CodeDeploy?
Show answer
Answer: C. AutoPublishAlias with a DeploymentPreference
SAM publishes a new version, updates the alias, and uses CodeDeploy to shift traffic.
-
Question 6. Which Lambda deployment configuration sends 10% of traffic to the new version for 5 minutes, then the rest?
Show answer
Answer: C. Canary10Percent5Minutes
Canary shifts in two steps. Linear shifts equal increments at set intervals.
-
Question 7. During a CodeDeploy Lambda deployment, which hook runs a validation function before any traffic moves to the new version?
Show answer
Answer: C. BeforeAllowTraffic
If the hook function reports failure, CodeDeploy stops and rolls back.
-
Question 8. A Lambda canary deployment should roll back automatically if errors rise. What should be linked to the deployment?
Show answer
Answer: C. CloudWatch alarms on the new version's errors
CodeDeploy watches the alarms during traffic shifting and rolls back if one fires.
-
Question 9. Which file tells CodeBuild which commands to run in each build phase?
Show answer
Answer: C. buildspec.yml
The buildspec defines phases such as install, pre_build, build, and post_build, plus artifacts.
-
Question 10. Which file tells CodeDeploy how to deploy to EC2 instances and which scripts to run at each lifecycle event?
Show answer
Answer: B. appspec.yml
The AppSpec file maps files to destinations and scripts to hooks such as BeforeInstall and ValidateService.
-
Question 11. For an EC2 in-place deployment, in which order do these CodeDeploy hooks run?
Show answer
Answer: C. ApplicationStop, BeforeInstall, AfterInstall, ApplicationStart, ValidateService
The old app is stopped, files are installed, the new app is started, and then it's validated.
-
Question 12. What must be running on EC2 instances for CodeDeploy to deploy to them?
Show answer
Answer: D. The CodeDeploy agent
The agent polls CodeDeploy and runs the AppSpec hooks. Instances also need an instance profile.
-
Question 13. Where does a CodeBuild project store dependencies to speed up later builds?
Show answer
Answer: C. A local or S3 cache configured in the project
Caching paths such as the package manager's directory avoids downloading dependencies every build.
-
Question 14. How should a CodeBuild project read a database password during the build?
Show answer
Answer: A. Reference Secrets Manager or Parameter Store in the buildspec env section
The env section can pull secrets-manager and parameter-store values at build time.
-
Question 15. A release needs sign-off from a manager before deploying to production. What should be added to CodePipeline?
Show answer
Answer: C. A manual approval action before the production stage
Manual approval pauses the pipeline and can notify reviewers through SNS.
-
Question 16. Which Elastic Beanstalk deployment policy deploys to all instances at once, with a brief outage?
Show answer
Answer: D. All at once
All at once is fastest but has downtime and a slow rollback.
-
Question 17. Which Elastic Beanstalk policy keeps full capacity during a deployment by adding a new batch of instances first?
Show answer
Answer: C. Rolling with additional batch
Rolling reduces capacity while each batch updates. The additional batch keeps capacity at 100%.
-
Question 18. Which Elastic Beanstalk policy deploys to a fresh set of instances in a new Auto Scaling group, making rollback quick?
Show answer
Answer: B. Immutable
Rollback means terminating the new instances, with no changes to the originals.
-
Question 19. How is a blue/green deployment done with Elastic Beanstalk?
Show answer
Answer: D. Deploy to a new environment, then swap environment URLs
Swapping URLs switches traffic. The old environment stays available for rollback.
-
Question 20. Where are custom Elastic Beanstalk configuration files, such as extra packages or options, placed in the source bundle?
Show answer
Answer: B. The .ebextensions folder, as .config files
.ebextensions files can set option settings, install packages, and run commands.
-
Question 21. Which CloudFormation feature previews how a stack update will change resources before it runs?
Show answer
Answer: C. A change set
Change sets list resources that will be added, modified, or replaced.
-
Question 22. One CloudFormation stack must use the VPC ID created by another stack. What should be used?
Show answer
Answer: D. An Export in the first stack and Fn::ImportValue in the second
Exported outputs can be imported by other stacks in the same account and Region.
-
Question 23. Which intrinsic function returns an attribute of a resource, such as a function's ARN?
Show answer
Answer: C. Fn::GetAtt
Ref usually returns the resource's name or ID. GetAtt returns specific attributes.
-
Question 24. A DynamoDB table in a stack must keep its data if the stack is deleted. What should be set?
Show answer
Answer: B. DeletionPolicy: Retain on the table
Retain keeps the resource when the stack is deleted. Snapshot is available for some resource types.
-
Question 25. A CloudFormation template must create a larger instance in production than in development. Which feature fits?
Show answer
Answer: A. Parameters or Mappings combined with Conditions
Parameters and Mappings select values, and Conditions include or change resources per environment.
-
Question 26. What does CloudFormation do by default if a resource fails to create during a stack creation?
Show answer
Answer: B. Roll back and delete the resources it created
Rollback on failure is the default. It can be disabled to troubleshoot.
-
Question 27. Which AWS CDK command produces the CloudFormation template from the app code?
Show answer
Answer: A. cdk synth
cdk synth generates templates. cdk deploy synthesizes and deploys them.
-
Question 28. Before the first CDK deployment in an account and Region, what must be run?
Show answer
Answer: A. cdk bootstrap
Bootstrapping creates resources such as an S3 bucket and roles that CDK uses to deploy assets.
-
Question 29. A container image built in CodeBuild must be pushed to Amazon ECR. What must happen first?
Show answer
Answer: B. Log in to ECR with a token from get-login-password
docker login uses the ECR authorization token. The CodeBuild role needs ECR push permissions.
-
Question 30. An ECS service must shift traffic to a new task set gradually with automatic rollback. What should be used?
Show answer
Answer: C. CodeDeploy blue/green deployment for ECS
CodeDeploy shifts traffic between target groups using canary, linear, or all-at-once settings.
-
Question 31. A new feature must be turned on for users without redeploying code, and turned off quickly if it misbehaves. What fits?
Show answer
Answer: C. Feature flags in AWS AppConfig
AppConfig deploys configuration gradually, validates it, and can roll back on alarms.
-
Question 32. An API Gateway REST API change must be tested on 10% of production traffic first. What should be used?
Show answer
Answer: B. A canary release on the stage
Canary settings route a percentage of stage traffic to a new deployment before promotion.
-
Question 33. A developer changes an API Gateway REST API's resources. Why don't clients see the change?
Show answer
Answer: C. The API must be deployed to a stage
Changes take effect only after a new deployment is created for a stage.
-
Question 34. Which service hosts a React single-page app with CI/CD from a Git branch and preview environments?
Show answer
Answer: D. AWS Amplify Hosting
Amplify Hosting builds and deploys web apps from Git and supports branch previews.
-
Question 35. Which pipeline stage order is typical for a CodePipeline release?
Show answer
Answer: C. Source, Build, Test, Deploy
Each stage consumes the previous stage's output artifacts.
-
Question 36. How do CodePipeline stages pass build outputs to deployment?
Show answer
Answer: B. Through output artifacts stored in the pipeline's S3 artifact store
Actions declare input and output artifacts, which CodePipeline stores in S3.
-
Question 37. Unit tests should fail the build when a test fails. Where should they run?
Show answer
Answer: B. In a CodeBuild action, where a non-zero exit fails it
CodeBuild also supports test reports for viewing results.
-
Question 38. A company wants the same CloudFormation stack deployed to many accounts and Regions. What should be used?
Show answer
Answer: C. CloudFormation StackSets
StackSets deploy a template to target accounts and Regions from one administrator account.
-
Question 39. How can a Lambda function's configuration differ between dev and prod when deployed with SAM from one template?
Show answer
Answer: D. Use template parameters with a per-environment samconfig.toml
samconfig.toml stores deploy settings, including parameter overrides, for each environment.
-
Question 40. Which CloudFormation helper script installs packages and writes files on an EC2 instance from template metadata?
Show answer
Answer: B. cfn-init
cfn-signal reports success to a CreationPolicy, and cfn-hup detects metadata changes.
-
Question 41. An Auto Scaling group in a stack should be marked complete only after its instances finish setup. What should be used?
Show answer
Answer: B. A CreationPolicy with cfn-signal from the instances
CloudFormation waits for the required number of success signals before completing.
-
Question 42. A developer changed a resource outside CloudFormation. How can this be found?
Show answer
Answer: A. Drift detection
Drift detection compares actual resource configuration with the template.
-
Question 43. Which Lambda deployment practice ensures the code running in production is exactly the code that was tested?
Show answer
Answer: A. Promote the same published version from test to production
Versions are immutable, so moving an alias to a tested version avoids differences between builds.
-
Question 44. Where should environment-specific values, such as a table name, be passed to a Lambda function?
Show answer
Answer: C. Environment variables set by the deployment template
Deployment tooling sets the values per stage, so the same code runs everywhere.
-
Question 45. Which Elastic Beanstalk option sends a percentage of traffic to new instances for a test period before full deployment?
Show answer
Answer: C. Traffic splitting
Traffic splitting is a canary-style policy that rolls back if the new instances are unhealthy.
-
Question 46. What does a Dockerfile's multi-stage build help with for Lambda container images?
Show answer
Answer: A. Smaller final images that exclude build tools
Only the final stage's files are kept, which speeds pulls and reduces attack surface.
-
Question 47. A Lambda function must use a new version of a shared layer. What must be done?
Show answer
Answer: B. Update the function to reference the new layer version
Layer versions are immutable, and functions reference a specific version ARN.
-
Question 48. A team wants to test infrastructure changes safely in isolated copies of the stack. What is a good practice?
Show answer
Answer: C. Deploy each branch or developer to a separate stack name
Parameterized stack names let many copies of the same template run side by side.
AWS, Amazon Web Services, and AWS Certified are trademarks of Amazon.com, Inc. or its affiliates. These questions are original study material, not questions from the real exam.