You have an application running on Amazon EC2 in an Auto Scaling group.
Instances are being bootstrapped dynamically, and the bootstrapping takes over 15 minutes to complete.
You find that instances are reported by Auto Scaling as being In Service before bootstrapping has been completed.
You are receiving application alarms related to new instances before they have completed bootstrapping, which is confusing.
You find the cause: your application monitoring tool is polling the Auto Scaling Service API for instances in Service and creating alarms for new previously unknown instances.
Which of the following will ensure that new instances are not added to your application monitoring tool before bootstrapping is completed?
Click on the arrows to vote for the correct answer
A. B. C. D.Answer - A.
Auto Scaling lifecycle hooks enable you to perform custom actions as Auto Scaling launches or terminates instances.
For example, you could install or configure software on newly launched instances or download log files from an instance before it terminates.
After you add lifecycle hooks to your Auto Scaling group, they work as follows:
Auto Scaling responds to scale out events by launching instances and scale in events by terminating instances.
Auto Scaling puts the instance into a wait state (Pending:Wait orTerminating:Wait)
The instance remains in this state until either you tell Auto Scaling to continue or the timeout period ends.
For more information on rolling updates, please visit the below link:
http://docs.aws.amazon.com/autoscaling/latest/userguide/lifecycle-hooks.htmlThe correct answer to ensure that new instances are not added to your application monitoring tool before bootstrapping is completed is option A: Create an Auto Scaling group lifecycle hook to hold the instance in a pending: wait state until your bootstrapping is complete. Once bootstrapping is complete, notify Auto Scaling to complete the lifecycle hook and move the instance into a pending: proceed state.
Auto Scaling is a service that automatically adjusts the number of Amazon EC2 instances in an Auto Scaling group according to user-defined policies. Auto Scaling enables users to maintain application availability and automatically scale up or down as needed to meet changing demand. However, when using dynamic bootstrapping, the bootstrapping process can take a significant amount of time, causing confusion and problems for the application monitoring tool.
A lifecycle hook is a feature of Auto Scaling that pauses the launching or terminating of an EC2 instance in an Auto Scaling group until an action is taken. A lifecycle hook can be used to hold the instance in a pending: wait state until bootstrapping is completed. Once the bootstrapping is complete, the lifecycle hook can notify Auto Scaling to complete the lifecycle hook and move the instance into a pending: proceed state.
Option B, to use the default Amazon CloudWatch application metrics to monitor the application's health and configure an Amazon SNS topic to send these CloudWatch alarms to the correct recipients, is incorrect because it does not address the issue of instances being reported as in service before bootstrapping is completed.
Option C, to tag all instances on launch to identify that they are in a pending state, change the application monitoring tool to look for this tag before adding new instances, and use the Amazon API to set the instance state to ‘pending' until bootstrapping is complete, is incorrect because it involves a more complicated approach to solving the problem than using a lifecycle hook.
Option D, to increase the desired number of instances in the Auto Scaling group configuration to reduce the time it takes to bootstrap future instances, is incorrect because it does not address the issue of instances being reported as in service before bootstrapping is completed. Additionally, increasing the desired number of instances may not necessarily decrease the time it takes to bootstrap each instance.
In conclusion, the correct option to ensure that new instances are not added to the application monitoring tool before bootstrapping is completed is to use an Auto Scaling group lifecycle hook to hold the instance in a pending: wait state until bootstrapping is completed.