All exams← All AWS Developer Associate (DVA-C02) notes

Deployment (CI/CD, CodePipeline, Elastic Beanstalk): AWS Developer Associate (DVA-C02) revision notes

Revision notes

CI/CD on AWS

CI/CD pipelines automate build, test and release so code ships safely and often. The exam leans on three services working together: CodeCommit (or GitHub) for source, CodeBuild for build/test, CodeDeploy for release, all orchestrated by CodePipeline.

CodePipeline basics

  • A pipeline is made of stages, and stages contain actions (source, build, test, deploy, approval).
  • Stages run sequentially; actions within a stage can run in parallel.
  • Add a Manual Approval action to pause a pipeline until a human approves - useful before a production deploy.
  • Pipeline changes trigger automatically on a source change (via CloudWatch Events/EventBridge for CodeCommit, or webhooks for GitHub) - it is event-driven, not purely polling by default.
  • Artifacts pass between stages via an S3 bucket - CodePipeline needs an S3 artifact store.

CodeBuild

  • Defined by a buildspec.yml with phases: install, pre_build, build, post_build.
  • Runs in managed, ephemeral containers - you pay per build minute, no servers to manage.
  • Can output build artifacts and logs to CloudWatch Logs.

CodeDeploy deployment types

  • EC2/On-Premises: uses an AppSpec file (appspec.yml) with hooks like BeforeInstall, ApplicationStop, AfterInstall, ApplicationStart, ValidateService.
  • Lambda: deployment configs control traffic shifting - Canary (small % first, then rest after a wait), Linear (steady % increases at intervals), All-at-once.
  • ECS: supports Blue/Green deployments via CodeDeploy, shifting traffic between task sets using an ALB.
  • CodeDeploy can auto-rollback on CloudWatch alarm breach or deployment failure.

Elastic Beanstalk

  • PaaS: upload code (or a Docker image), Beanstalk provisions EC2, ASG, ELB, and RDS (optional) for you - you don't manage the underlying resources directly.
  • Deployment policies: All at once (fastest, downtime), Rolling (batches, reduced capacity), Rolling with additional batch (no capacity loss, launches extra batch first), Immutable (new ASG entirely, safest, slowest, easy rollback), Traffic Splitting (canary-style, % of traffic to new version).
  • Configuration lives in .ebextensions/*.config files (YAML/JSON) inside your app bundle, applied in alphabetical order.
  • Environments: separate Web Server (fronts an ALB) vs Worker (polls an SQS queue) environment tiers.
  • Beanstalk is NOT for zero-downtime by default with All-at-once - pick Immutable or Traffic Splitting when zero downtime matters.

Common exam traps

  • CodeDeploy needs an IAM service role AND an appspec.yml at the root of the deployment bundle - a missing appspec.yml fails deployment.
  • Blue/Green on EC2 needs an ASG and ELB; on Lambda it's really traffic shifting between versions/aliases, not separate EC2 fleets.
  • Beanstalk swap environment URLs (CNAME swap) gives a near-zero-downtime blue/green style cutover between two full environments.

Key facts

Flashcards

What are the four phases of a CodeBuild buildspec.yml?
install, pre_build, build, post_build
tap to reveal
Which file does CodeDeploy require for EC2/On-Premises deployments, and where must it sit?
appspec.yml, at the root of the deployment bundle
tap to reveal
Name the five hooks available in an EC2 CodeDeploy appspec.yml lifecycle.
BeforeInstall, ApplicationStop, AfterInstall, ApplicationStart, ValidateService
tap to reveal
What are the three Lambda CodeDeploy traffic-shifting deployment types?
Canary, Linear, All-at-once
tap to reveal
List the five Elastic Beanstalk deployment policies.
All at once, Rolling, Rolling with additional batch, Immutable, Traffic Splitting
tap to reveal
Which Elastic Beanstalk deployment policy is safest and easiest to roll back, but slowest?
Immutable - it launches a whole new ASG before switching traffic
tap to reveal
What does CodePipeline need to pass artifacts between stages?
An S3 bucket configured as the artifact store
tap to reveal
How do you pause a CodePipeline pipeline for human sign-off before deploying to production?
Add a Manual Approval action to a stage
tap to reveal
What triggers a CodePipeline run when CodeCommit is the source?
An EventBridge/CloudWatch Events rule on the repository change (event-driven, not just polling)
tap to reveal
In what order are .ebextensions config files applied in Elastic Beanstalk?
Alphabetical order, from the root of the application bundle
tap to reveal
What are the two Elastic Beanstalk environment tiers and what fronts each?
Web Server tier (fronted by an ALB) and Worker tier (polls an SQS queue)
tap to reveal
How does Elastic Beanstalk achieve a near-zero-downtime blue/green cutover?
By swapping CNAMEs between two separate, fully deployed environments
tap to reveal
What triggers an automatic CodeDeploy rollback?
A CloudWatch alarm breach or a deployment failure
tap to reveal
On ECS, how does CodeDeploy perform Blue/Green deployments?
It shifts ALB traffic between two ECS task sets
tap to reveal
Practice questions

Deployment (CI/CD, CodePipeline, Elastic Beanstalk): 5 practice questions

Q1. A developer wants a fully managed CI/CD service that orchestrates source, build, test, and deploy stages, invoking other AWS services at each stage. Which service should they use to model this workflow?
  • A.  AWS CodeBuild
  • B.  AWS CodeArtifact
  • C.  AWS CodeDeploy
  • D.  AWS CodePipeline
Show answer & explanation
✓ Answer: D. AWS CodePipeline
CodePipeline is the orchestration service that defines stages (source, build, test, deploy) and triggers other services such as CodeBuild and CodeDeploy at each stage. CodeBuild only compiles and tests code, CodeDeploy only handles the deployment step, and CodeArtifact is a package repository, not an orchestrator.
Q2. In AWS CodeBuild, which file in the root of the source repository defines the build phases such as install, pre_build, build, and post_build?
  • A.  Dockerfile
  • B.  appspec.yml
  • C.  buildspec.yml
  • D.  template.yaml
Show answer & explanation
✓ Answer: C. buildspec.yml
buildspec.yml is the CodeBuild build specification file that lists commands to run in each phase. appspec.yml is used by CodeDeploy, and template.yaml is used by CloudFormation/SAM.
Q3. A CodeDeploy deployment to EC2 instances must specify hooks such as BeforeInstall and AfterInstall, plus the files to copy. Which file defines this configuration?
  • A.  buildspec.yml
  • B.  appspec.yml
  • C.  pipeline.json
  • D.  deployspec.json
Show answer & explanation
✓ Answer: B. appspec.yml
appspec.yml (or appspec.json) is the CodeDeploy application specification file that maps source files to destinations and defines lifecycle event hooks like BeforeInstall, ApplicationStart, and AfterInstall. buildspec.yml belongs to CodeBuild, and the other two are not real CodeDeploy artifacts.
Q4. Which CodePipeline concept represents the versioned output produced by one stage and consumed as input by the next stage, typically stored in Amazon S3?
  • A.  Transition
  • B.  Stage
  • C.  Action
  • D.  Artifact
Show answer & explanation
✓ Answer: D. Artifact
Artifacts are the files passed between pipeline stages, stored by default in an S3 artifact bucket. Actions are individual tasks within a stage, stages group related actions, and transitions control whether flow moves between stages.
Q5. An Elastic Beanstalk environment currently runs 4 EC2 instances behind a load balancer. The team wants zero downtime with the least reduction in capacity during a deployment, and can tolerate a mixed-version fleet briefly. Which deployment policy fits best?
  • A.  Rolling with additional batch
  • B.  Rolling
  • C.  Immutable
  • D.  All at once
Show answer & explanation
✓ Answer: A. Rolling with additional batch
Rolling with additional batch launches new instances before taking any old ones out of service, so full capacity is maintained throughout, unlike plain Rolling which temporarily reduces capacity by removing a batch first. All at once causes downtime, and Immutable is more resource-heavy and slower though it also avoids capacity loss.
Test yourself
See the AWS Developer Associate (DVA-C02) page

More AWS Developer Associate (DVA-C02) topics