Question

Difficulty: EasyAuto Scaling and Elasticity

A SysOps administrator notices that an Amazon EC2 Auto Scaling group is routing client traffic to new instances before the application's configuration script has finished installing required dependencies. To resolve this issue, the administrator configures an EC2_INSTANCE_LAUNCHING lifecycle hook. What is the correct sequence of events required to ensure the instances are properly configured before they start receiving traffic?

  1. 1The Auto Scaling group initiates the launch of a new EC2 instance in response to a scale-out trigger.
  2. 2The instance is placed into the Pending:Wait state, pausing the default launching process.
  3. 3The configuration script completes the installation of dependencies and invokes the CompleteLifecycleAction API call.
  4. 4The instance state transitions to InService, allowing traffic to be routed to the instance.

Answer

The correct sequence begins with the Auto Scaling group initiating the launch of a new EC2 instance, followed by the instance pausing in the Pending:Wait state. Next, the configuration script completes the setup and calls the CompleteLifecycleAction API, and finally, the instance transitions to the InService state to serve traffic.
The sequence starts with the launch initiation. The lifecycle hook then immediately pauses the launch by putting the instance into the Pending:Wait state. The configuration script runs and calls the CompleteLifecycleAction API, allowing the instance to transition to the InService state and accept traffic.

Step-by-Step Solution

1
Identify the scale-out initiation trigger.
The Auto Scaling group starts launching the instance.
Before any state transitions or lifecycle hooks can occur, the instance launch must be initiated by the Auto Scaling group.
2
Trace the effect of the lifecycle hook on the state transition.
The instance enters the Pending:Wait state.
The EC2_INSTANCE_LAUNCHING lifecycle hook pauses the default flow and prevents the instance from immediately transitioning to the InService state.
3
Determine how the script signals completion.
The configuration script runs and sends a CompleteLifecycleAction API call.
An explicit signal is required to notify the Auto Scaling group that the custom initialization tasks have finished.
4
Identify the final operational state of the instance.
The instance state transitions to InService.
Once the API call is processed successfully, the instance completes its launch flow and begins receiving traffic.

Key Concept

Auto Scaling lifecycle hooks allow you to pause instance state transitions (such as Pending:Wait during scale-out) to run custom configuration tasks, which must be completed via the CompleteLifecycleAction API before the instance is marked InService.
Rate this question