Deploying New Versions in Elastic Beanstalk: Deployment Strategy for Node.js Applications

Deploying New Versions in Elastic Beanstalk

Prev Question Next Question

Question

A company has a Node.js application deployed in an Elastic Beanstalk environment.

At the moment the environment uses an “All at once” deployment strategy.

The new versions are deployed in all instances simultaneously and there is an outage for a short time.

If there is a problem with the new version, another deployment is required to perform a rollback.

Your manager asks you to use another method that deploys newer versions to a fresh group of instances and the new instances should serve traffic only after the health check has passed.

In the meantime, you do not want to maintain two environments in Elastic Beanstalk.

Which deployment strategy should you select?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer - D.

In order to deploy new versions in new instances, the Immutable deployment strategy should be chozen.

The references can be found in https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.rolling-version-deploy.html and.

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environmentmgmt-updates-immutable.html.

Option A is incorrect: For Rolling update, the original instances are detached from the load balancer for the deployment.

This update strategy does not create new instances.

Option B is incorrect: The Rolling with additional batch strategy still performs the deployments in existing instances although it creates another batch to maintain full capacity.

Option C is incorrect: For the swapping environment URLs feature in blue/green deployments, two environments are required in Elastic Beanstalk.

It does not meet the requirement of the question.

Option D is CORRECT: With Immutable deployment, a second, temporary Auto Scaling group with new instances is created for the update.

The deployments are immutable and not performed on old instances.

The answer to this question is A. Configure a Rolling update strategy in the Elastic Beanstalk environment. Deploy newer application versions on newer instances and then attach those instances to the original load balancer.

Explanation:

The Elastic Beanstalk service provides various deployment strategies for updating the applications. The two most commonly used deployment strategies are rolling updates and blue/green deployments.

Rolling Update Deployment: In the rolling update deployment strategy, the new version of the application is deployed in batches across the instances, rather than deploying to all instances at once. During a rolling update deployment, the Elastic Beanstalk deploys new instances with the latest application version alongside the existing instances, and gradually shifts the traffic to the new instances as they pass the health checks. Once all the new instances have passed the health checks and are ready to receive traffic, the Elastic Beanstalk terminates the old instances.

The rolling update strategy provides a smooth and seamless update process, with minimal downtime and no need to maintain two separate environments. This strategy is suitable for most applications, especially those with multiple instances that can handle the traffic.

Blue/Green Deployment: In a blue/green deployment strategy, two separate environments, the blue environment, and the green environment, are maintained, with only one environment serving traffic at any given time. The new version of the application is deployed to the inactive environment, and once the deployment is complete and passes the health checks, the Elastic Beanstalk swaps the environment URLs, and the new version of the application becomes active.

The blue/green deployment strategy provides a zero-downtime deployment process, with the ability to roll back to the previous version quickly. However, it requires maintaining two separate environments, which can increase the infrastructure and maintenance costs.

Now let's analyze the given answers:

A. Configure a Rolling update strategy in the Elastic Beanstalk environment. Deploy newer application versions on newer instances and then attach those instances to the original load balancer. This answer is correct. The rolling update deployment strategy is suitable for this scenario, as it deploys new versions to fresh instances and ensures that the new instances are healthy before they start serving traffic. This approach minimizes the downtime and provides a smooth update process. Also, there is no need to maintain two separate environments.

B. Set up a Rolling with additional batch strategy which launches an extra batch of instances for new deployments. This answer is incorrect. The "Rolling with additional batch" strategy launches extra instances, which can increase the infrastructure costs, and it is not required for this scenario.

C. Configure a blue/green deployment strategy by swapping environment URLs in Elastic Beanstalk. This answer is incorrect. Blue/green deployment strategy requires maintaining two separate environments, which is not desired in this scenario.

D. Configure an Immutable deployment strategy in the Elastic Beanstalk environment. This answer is incorrect. Immutable deployment strategy deploys new instances with the new version of the application, and once they pass the health checks, the Elastic Beanstalk replaces the old instances with the new ones. This strategy can cause downtime, as the old instances are terminated before the new ones are ready to serve traffic. It is not suitable for this scenario, as the requirement is to minimize the downtime.