A SysOps administrator is configuring a launching lifecycle hook (`EC2_INSTANCE_LAUNCHING`) for an Amazon EC2 Auto Scaling group (ASG) integrated with an Application Load Balancer (ALB) target group. The administrator needs to ensure that custom software setup and patching are completed before instances receive traffic. Arrange the steps of the instance startup sequence in the correct chronological order from the initiation of the scale-out event to the instance serving active load-balanced traffic.
- 1The Auto Scaling group allocates a new EC2 instance, transitioning its state to `Pending`.
- 2The `EC2_INSTANCE_LAUNCHING` lifecycle hook triggers, pausing the launch process and placing the instance into the `Pending:Wait` state.
- 3The instance boots up and executes its custom user data script to download software patches and application binaries.
- 4A post-launch script calls the `CompleteLifecycleAction` API with the `CONTINUE` action token.
- 5The Auto Scaling group transitions the instance to `Pending:Proceed` and registers it with the Application Load Balancer (ALB) target group.
- 6The ALB target group health checks pass, and the Auto Scaling group transitions the instance to the `InService` state.
Cevap
The correct sequence begins with the Auto Scaling group allocating a new instance and placing it into the `Pending` state. The lifecycle hook then immediately triggers, shifting the instance to `Pending:Wait`. While in this state, the instance boots up and runs its user data script. Once the script finishes, a call is made to `CompleteLifecycleAction` with the `CONTINUE` outcome. The instance then moves to `Pending:Proceed` and is registered with the ALB target group. Finally, the ALB health checks pass, and the instance is transitioned to the `InService` state.
The correct sequence ensures that the instance is allocated (`Pending`), paused (`Pending:Wait`), configured (user data runs), resumed via API (`CompleteLifecycleAction`), registered with the ALB (`Pending:Proceed`), and finally validated (`InService`). This order prevents premature routing of client traffic before configuration is complete.
Adım Adım Çözüm
Anahtar Kavram
Amazon EC2 Auto Scaling instance lifecycle hooks control the state transitions of newly launched instances, ensuring they execute configuration scripts and pass load balancer health checks before transitioning to the InService state.