AWS Certified Solutions Architect – Associate (SAA-C02) — Question 92
A company recently deployed a new auditing system to centralize information about operating system versions, patching, and installed software for Amazon EC2 instances. A solutions architect must ensure all instances provisioned through EC2 Auto Scaling groups successfully send reports to the auditing system as soon as they are launched and terminated.
Which solution achieves these goals MOST efficiently?
Answer options
- A. Use a scheduled AWS Lambda function and run a script remotely on all EC2 instances to send data to the audit system.
- B. Use EC2 Auto Scaling lifecycle hooks to run a custom script to send data to the audit system when instances are launched and terminated.
- C. Use an EC2 Auto Scaling launch configuration to run a custom script through user data to send data to the audit system when instances are launched and terminated.
- D. Run a custom script on the instance operating system to send data to the audit system. Configure the script to be executed by the EC2 Auto Scaling group when the instance starts and is terminated.
Correct answer: B
Explanation
The correct answer is B because EC2 Auto Scaling lifecycle hooks allow you to run a custom script at specific points in the instance lifecycle, ensuring timely reporting both at launch and termination. Option A is less efficient as it relies on a scheduled function rather than immediate actions during instance events. Option C executes the script only at launch, missing out on termination reports, while option D lacks the automation provided by lifecycle hooks.