An Auto Scaling group uses a Pending:Wait lifecycle hook with its default heartbeat timeout to let a configuration management agent finish installing software before a new instance enters service. The install job unpredictably takes anywhere from 10 minutes to just under 4 hours. With no heartbeat calls sent from the instance and everything left at its defaults, what happens for an install that takes 3 hours?
- The instance times out of the wait state after the default 1-hour heartbeat timeout, and Auto Scaling proceeds using the hook's configured default result before the 3-hour install finishes
- The instance waits the full 3 hours, because the default heartbeat timeout is 4 hours
- The instance waits indefinitely, because lifecycle hooks never time out unless a heartbeat explicitly ends them
- The instance is terminated immediately once the hook is created, before the install can even start
Why A? And why not the others?
Correct answer: A. The instance times out of the wait state after the default 1-hour heartbeat timeout, and Auto Scaling proceeds using the hook's configured default result before the 3-hour install finishes
A lifecycle hook's default heartbeat timeout is 3600 seconds, or one hour; if nothing calls RecordLifecycleActionHeartbeat or completes the lifecycle action before that hour elapses, Auto Scaling stops waiting and proceeds using the hook's configured default result, so an installation still running at the one-hour mark is cut off from the Pending:Wait state well before a 3-hour job would finish. Stretching the wait beyond the default requires the instance to actively send heartbeats, each of which resets the countdown, and doing this repeatedly can extend the total wait up to a documented maximum of 48 hours — but that requires deliberate heartbeat calls, which this scenario explicitly says are not happening. There is no Auto Scaling lifecycle hook setting with a default heartbeat timeout of 4 hours, so that option describes a number that doesn't exist in the service. Lifecycle hooks are also not indefinite by default; without heartbeats or a completion call, they always resolve once the heartbeat timeout expires, and nothing about merely creating the hook causes an immediate termination.
Source: AWS documentation: Amazon EC2 Auto Scaling — lifecycle hooks (Pending:Wait/Terminating:Wait, heartbeat timeout)