SAA-C03 Practice Question 84: ASG Lifecycle Hook Log Drain
AWS Certified Solutions Architect – Associate (SAA-C03) · Test 9 · question 4 of 10
A batch of EC2 instances in an Auto Scaling group writes diagnostic files to a local directory and ships them to S3 every ten minutes. Whenever the group scales in, the most recent files on the terminated instances are lost, and support cases go uninvestigated. The team needs each instance to finish uploading before it disappears, without keeping instances running longer than necessary.
What should the architect configure?
Show answer and explanation
Answer:
A termination lifecycle hook pauses the instance in a wait state before it is terminated and emits an event, giving you a window, one hour by default, to perform a custom action. AWS gives downloading logs or other data from an instance before it is fully terminated as the example use case. The automation uploads the files and then calls complete-lifecycle-action, so the instance is terminated as soon as the work is done rather than after a fixed delay. That satisfies both halves of the requirement: nothing is lost, and nothing lingers.
Option A changes how long Auto Scaling waits before the *next* scaling activity. A cooldown does not delay the termination of the instance that is already being removed, so the files are lost exactly as before.
Option C prevents instances from being selected for scale-in at all. Applied to every instance it blocks scale-in entirely, so the group never shrinks, the opposite of not keeping instances running longer than necessary.
Option D only changes *which* instance is chosen. Whichever instance is picked still terminates without flushing its directory, so unshipped files on that instance are lost just the same.
Reference: Amazon EC2 Auto Scaling lifecycle hooks