After developing software, you need to deploy it to deliver it to users. But deploying a new version to a service already used by many people is trickier than it sounds. The AWS DVA-C02 exam asks which deployment strategy to choose in these situations.
Comparing Deployment Strategies
A deployment strategy is a method for how to apply a new version of software to existing servers. Let's compare the four main strategies.
All-at-once
Installs the new version on all servers simultaneously. Completes fastest but the service may have downtime during deployment. If something goes wrong, you must redeploy the previous version.
Think of it like closing a shop for renovation and reopening afterward.
Rolling
Deploys to servers in small groups (batches) in sequence. During deployment, some servers run the old version while others run the new version simultaneously.
Blue/Green
Keeps the existing environment (Blue) running while building an entirely new environment (Green) for the new version. Once ready, all traffic is switched to Green at once. If problems arise, you can instantly switch back to Blue. It is the safest approach, but running two full environments doubles the cost.
Think of it as building a brand-new store next door, then redirecting all customers there once it is ready.
Canary
Only a small portion of traffic (e.g., 10%) is sent to the new version first. If no issues appear, the percentage is gradually increased until it reaches 100%.
The name comes from miners sending canary birds into mines first to check the air — testing with a small group before fully committing.
!4 deployment strategies: All-at-once, Rolling, Blue/Green, Canary
Lambda Deployment Strategies
Lambda Versions and Aliases
Version: An immutable snapshot of the Lambda function. $LATEST always points to the most recently modified state. Alias: A named label that points to a specific version. For example, "prod" or "dev".
Think of a version as a photograph, and an alias as the name tag you attach to it.
Traffic Shifting with Aliases
You can connect two versions to a single alias and set a traffic weight percentage for each.
Example: prod Alias -> version 1 (90%) + version 2 (10%) = canary deployment.
When integrated with AWS CodeDeploy, traffic shifts automatically in steps: Canary10Percent5Minutes: Send 10% for 5 minutes, then switch the rest. Linear10PercentEvery1Minute: Increase by 10% every minute until 100%. AllAtOnce: Switch 100% immediately.
Rollback
Lambda: Change the version the Alias points to. Completes almost instantly. ECS: Update the service to a previous Task Definition. EC2: Roll back to a previous revision via CodeDeploy.
Exam Key Points
"Build new environment, switch traffic, instant rollback" -- Blue/Green
"Test with small traffic first, then gradually expand" -- Canary
"Deploy in sequential batches" -- Rolling
"Name a Lambda version" -- Lambda Alias
"Split Lambda traffic across two versions" -- Alias weighted routing
"Send 10% for 5 minutes then switch all" -- Canary10Percent5Minutes
"Increase by 10% every minute" -- Linear10PercentEvery1Minute
"Switch 100% immediately" -- AllAtOnce
Blue/Green is the safest strategy but doubles the cost