Reputation: 23558
Is it possible to achieve zero downtime deployments with in place deployment? I know that in the in deployment group description (for in place deployment) we have this:
Updates the instances in the deployment group with the latest application revision. During a deployment, each instance will be briefly taken offline for its update.
My question is: supposed I have at least two instances connected to a load balancer. Is it possible to do in place deployment using this sequence:
Is the above possible? and if so how do i set it up? I've experimented with deploy one at a time, all at once etc but what happened is that in all cases the deployment always happened to all instances at the same time, and so there was some downtime.
Upvotes: 2
Views: 2263
Reputation: 150
I think one option would be to create a revision for each deployment in a separate folder and eventually link it via symlink using afterInstall hook after deployment is complete.
eg.
releases
├── release1
└── release2
public_html -> (symlink) release2
Upvotes: 0
Reputation: 7464
Yes, you can do exactly what you describe. If you configure your deployment group with the deployment option WITH_TRAFFIC_CONTROL
and configure a load balancer, CodeDeploy will remove your instances from the load balancer before it runs the usual set of Lifecycle hook scripts.
You can see a chart here that demonstrates the order that the hooks are executed (note that BlockTraffic
and AllowTraffic
are performing the binding and unbinding). The host selection logic will be the same - your minimum healthy host settings. If you set your deployment to one at a time, CodeDeploy will not deploy to multiple instances at the same time.
Upvotes: 0