Phasing Out Instances and Replacing with New Instance Types | Auto Scaling Group and Elastic Load Balancer

Two Ways to Replace Instances in an Auto Scaling Group

Prev Question Next Question

Question

You currently have an Auto Scaling group with an Elastic Load Balancer and need to phase out all instances and replace them with a new instance type.

What are 2 ways by which this can be achieved?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - C and D.

When using theOldestLaunchConfiguration policy, Auto Scaling terminates instances that have the oldest launch configuration.

This policy is useful when you're updating a group and phasing out the instances from a previous configuration.

For more information on Autoscaling instance termination, please visit the below URL:

http://docs.aws.amazon.com/autoscaling/latest/userguide/as-instance-termination.html

Option D is an example of Blue Green Deployments.

A blue group carries the production load while a green group is staged and deployed with the new code.

When it's time to deploy, you simply attach the green group to the existing load balancer to introduce traffic to the new environment.

For HTTP/HTTPS listeners, the load balancer favors the green Auto Scaling group because it uses the least outstanding requests routing algorithm.

As you scale up the green Auto Scaling group, you can take blue Auto Scaling group instances out of service by either terminating them or putting them in Standby state,

For more information on Blue Green Deployments, please refer to the below document link: from AWS.

https://d0.awsstatic.com/whitepapers/AWS_Blue_Green_Deployments.pdf
‘Amazon Route 53
DNS Endpoint

Sure, I'd be happy to help explain the answer to this question.

The scenario described in the question involves replacing existing instances in an Auto Scaling group with a new instance type. This can be achieved in a couple of different ways:

A. Use NewestInstance to phase out all instances that use the previous configuration.

With this approach, you would configure your Auto Scaling group to use the NewestInstance termination policy. This policy terminates instances that are closest to the next billing hour first and replaces them with instances that match the latest launch configuration. This would cause the Auto Scaling group to gradually replace the existing instances with new instances using the updated launch configuration.

B. Attach an additional ELB to your Auto Scaling configuration and phase in newer instances while removing older instances.

With this approach, you would add a new Elastic Load Balancer (ELB) to your Auto Scaling group and configure it to send traffic only to the new instances using the updated launch configuration. You would then gradually replace the existing instances with new instances by increasing the desired capacity of the Auto Scaling group for the new configuration and decreasing it for the old configuration. Once all the old instances have been terminated, you can remove the old ELB.

C. Use OldestLaunchConfiguration to phase out all instances that use the previous configuration.

With this approach, you would configure your Auto Scaling group to use the OldestLaunchConfiguration termination policy. This policy terminates instances that are using the oldest launch configuration first and replaces them with instances that match the latest launch configuration. This would cause the Auto Scaling group to gradually replace the existing instances with new instances using the updated launch configuration.

D. Attach an additional Auto Scaling configuration behind the ELB and phase in newer instances while removing older instances.

With this approach, you would create a new Auto Scaling group with the updated launch configuration and attach it to the existing ELB. You would then gradually increase the desired capacity of the new Auto Scaling group and decrease the desired capacity of the old Auto Scaling group until all the old instances have been terminated.

So, options A and C involve replacing instances in the existing Auto Scaling group using termination policies based on launch configuration, while options B and D involve creating new Auto Scaling groups and ELBs and gradually transitioning traffic to the new instances.

It's worth noting that there may be other factors to consider when choosing an approach for phasing out instances, such as the impact on application availability, cost, and the time it takes to replace all the instances.