Course contentsShow
← Cloud and Infrastructure
Lesson 1836 of 2,98938. AWS Native CI/CDFree lesson

Deployment Configurations and Rollback

Configure deployment strategies like AllAtOnce, HalfAtATime, OneAtATime, and automatic rollback on failures.

Deployment Configurations and Rollback

What you'll learn: How to control deployment speed and automatically revert failed deployments in AWS CodeDeploy.

When deploying updates to production, you rarely want an "all-or-nothing" approach. AWS CodeDeploy provides deployment configurations that control how fast your new application version rolls out across your fleet, giving you fine-grained control over risk and downtime.

Understanding Deployment Configurations

Think of deployment configurations like different speeds on a production line. You can choose:

  • CodeDeployDefault.AllAtOnce – Updates all instances simultaneously. Fastest, but highest risk. If something breaks, everything breaks at once.
  • CodeDeployDefault.HalfAtATime – Updates 50% of instances, waits for success, then updates the remaining 50%. Balances speed with safety.
  • CodeDeployDefault.OneAtATime – Updates one instance at a time. Slowest, but safest—minimal blast radius if issues occur.

You can also create custom configurations specifying exact percentages or instance counts (e.g., "update 25% at a time" or "update 5 instances per batch").

Automatic Rollback

CodeDeploy monitors deployments and can automatically trigger rollbacks when:

  • Deployment fails on any instance in the current batch
  • CloudWatch alarms breach (e.g., elevated error rates, CPU spikes)
  • Manual stop is triggered

During rollback, CodeDeploy redeploys the last known good revision—essentially rewinding your application to its previous stable state. This happens using the same deployment configuration, ensuring a controlled recovery.

Analogy: It's like testing a new recipe in a restaurant. OneAtATime serves it to one table first. If customers complain, you rollback to the old menu before the whole dining room gets the bad dish.

Key Takeaway: Deployment configurations let you balance deployment speed with risk tolerance, while automatic rollback provides a safety net that reverts to the last working version when failures are detected.