Under the hood, EC2 instances are in the Auto Scaling Group. It's essential for you to understand the lifecycle of those EC2 instances when they are in the Auto Scaling Group. The lifecycle of the EC2 instances in the Auto Scaling Group is different from those that are not part of the Auto Scaling Group. Understanding lifecycle events will help you to properly architect a deployment strategy for your application. The following diagram helps you to understand lifecycle events.
When a Scale-Out event occurs, the Auto Scaling Group launches new EC2 instances using the associated launch configuration. All newly launched EC2 instances start in the Pending state. This is the state in which you can add a lifecycle hook and perform a custom action. Lifecycle hooks give you the ability to perform actions before an EC2 instance is InService state, or before...