why is my elastic beanstalk instance being replaced when I deploy?
I have a docker based elastic beanstalk environment, hosting a ruby on rails web application. The environment is a single instance box.
whenever I issue an
eb deploy command, elastic beanstalk terminates the instance and launches a new one. I was expecting that EB would launch a new container in the same instance and swap it with the old one.
This instance termination is causing downtime. Is there an automated way to deploy docker into elastic beanstalk without downtime?
the only solution I found was the “swap URLs” feature. but I found it cumbersome.
2 Solutions collect form web for “why is my elastic beanstalk instance being replaced when I deploy?”
Under your configuration settings for your Elastic Beanstalk environment you will find Updates and Deployments. Under Application Deployments you can set the Batch type to meet your requirements.
For this process you will be required to increase your running instances to at least two.
Is there an automated way to deploy docker into elastic beanstalk without downtime?
- Push a new docker image to the same dockerbub/dockerregistry repository with the same tag that you used in elastic beanstalk.
- Change the Beanstalk size to 2 to launch a new server with the new version of your docker container.
- Terminate the older instance and allow EB to replace it, wait until replacement becomes healthy.*
- Change EB size back to 1.
* If your do not let the second instance get healthy when your reduce size to 1 it may terminate the healthy one.