Elastic Beanstalk Deployment Models

Types of Deployment

  • All at Once
  • Rolling
  • Rolling with additional batches
  • Immutable

Legend for below diagrams

All at Once

In the above diagram 4 instances running V1 version of code. When we try to deploy a new version of code using All at once model we do the following steps:

  • All instances are stopped and V2 version of code is deployed.
  • All instances are started back to serve a new code.

When/Why do you choose this deployment model?

  1. Fastest Deployment
  2. Application can have downtime
  3. No Additional cost

Rolling

In the above diagram, we have 4 instances running V1 version of the code. When we try to deploy using Rolling model of deployment we do the following steps:

  • Stop some servers (Bucket Size).
  • Deploy code new version of code to stopped Instances
  • Start those Instances back
  • Repeat the same steps for rest of the Instances

Bucket size = No of server on which, you do not want your application to run when you are rolling out new versions

When/Why do you choose this deployment model?

  1. Application can run below capacity
  2. Application does not go down at any time
  3. Both versions of code run simultaneously
  4. No Additional cost

Rolling with Additional Batches

In the above diagram we have 4 instances running V1 version of the code. When we try to deploy using Rolling with Additional Batches model of deployment we do the following steps:

  • Stage 1: Create new server
  • Stage 2: Deploy code to new batch of Instances
  • Stage 3: Stop few Instances which are running older version of the code
  • Stage 4: Deploy new version of the code and start
  • Stage 5 and 6: Repeat step 3 and 4 with other set of Instances
  • Stage 7: Terminate additional batch of Instances

When/Why do you choose this deployment model?

  1. Good for production as Application is running at Capacity
  2. Ok to have small Additional cost
  3. Ok to have Longer Deployment times

Immutable

In the above diagram, we have 2 instances running V1 version of the code. When we try to deploy using Immutable model of deployment we do the following steps:

  • Stage 1: BeanStalk will launch one instance in the ASG and check for the health of the server
  • Stage 2: If the instance works well then it will turn up multiple Instances
  • Stage 3: If these Instances looks good then BeanStalk will move all instances from Temp to Current ASG
  • Stage 4: Current ASG will remove old instances.

When/Why do you choose this deployment model?

  1. High cost, double capacity
  2. Quick rollback
  3. Longest Deployment time
  4. Great for production.

Blue/Green Deployment

  • Blue-Green Deployment is a direct feature of Elastic BeanStalk
  • Route 53 can be setup using weighted policies to redirect
  • Create a new environment and deploy V2 version
  • “Swap URLs” when a new environment is ready

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.deploy-existing-version.html

Grow your business the smart way with digital World