DEV Community

Cover image for ๐Ÿš€ Zero-Downtime In-Place Deployments with AWS CodeDeploy, Auto Scaling, and Rollback
Latchu@DevOps
Latchu@DevOps

Posted on โ€ข Edited on

๐Ÿš€ Zero-Downtime In-Place Deployments with AWS CodeDeploy, Auto Scaling, and Rollback

If you're managing deployments with AWS CodeDeploy, especially in combination with Auto Scaling Groups (ASGs) and Load Balancers, here's something important you should know โ€” you can deploy safely, one instance at a time, without downtime, and even rollback on failure.

Let me explain how it works ๐Ÿ‘‡


๐Ÿงฑ Deployment Strategy: CodeDeployDefault.OneAtATime

With this strategy, AWS deploys your application to one EC2 instance at a time. If you have 3 instances in your Auto Scaling Group, hereโ€™s how the deployment flows:


๐Ÿ”„ Step-by-Step Flow

  • CodeDeploy picks 1 instance (out of 3).
  • That instance is temporarily removed from the Load Balancer so users donโ€™t see downtime or errors.
  • The application is updated in place (old version replaced with new).
  • After a successful install + health check, the instance is added back to the Load Balancer.
  • The same steps repeat for the next instance, one by one, until all are updated.

๐Ÿ’ฅ What If a Deployment Fails?

  • CodeDeploy immediately stops the deployment process.
  • Any instance that already received the new version will automatically roll back to the last stable revision.
  • Your ASG stays healthy, and only working instances remain in service.
  • โœ… No full outage, no broken app across all nodes.

โœ… Why This Is Great for Production

  • Zero-downtime updates (thanks to Load Balancer integration)
  • Safe, gradual rollout
  • Automatic rollback on failure
  • Scales perfectly with Auto Scaling Groups

๐Ÿง  TL;DR

Use CodeDeployDefault.OneAtATime strategy for safe in-place deployments with:
Auto Scaling Groups (ASG)
Elastic Load Balancer (ELB/ALB)
Rollback on failure

It's reliable, simple to set up, and ideal for production environments where uptime matters.


Have you used this strategy? Or do you prefer Blue/Green deployments? Letโ€™s discuss in the comments! ๐Ÿ‘‡

I โค๏ธ building dashboards for my customers

I โค๏ธ building dashboards for my customers

Said nobody, ever. Embeddable's dashboard toolkit is built to save dev time. It loads fast, looks native and doesn't suck like an embedded BI tool.

Get early access

Top comments (0)

Feature flag article image

Create a feature flag in your IDE in 5 minutes with LaunchDarklyโ€™s MCP server ๐Ÿ

How to create, evaluate, and modify flags from within your IDE or AI client using natural language with LaunchDarkly's new MCP server. Follow along with this tutorial for step by step instructions.

Read full post

๐Ÿ‘‹ Kindness is contagious

Explore this insightful write-up embraced by the inclusive DEV Community. Tech enthusiasts of all skill levels can contribute insights and expand our shared knowledge.

Spreading a simple "thank you" uplifts creatorsโ€”let them know your thoughts in the discussion below!

At DEV, collaborative learning fuels growth and forges stronger connections. If this piece resonated with you, a brief note of thanks goes a long way.

Okay