
Ultimate access to all questions.
Deep dive into the quiz with AI chat providers.
We prepare a focused prompt with your quiz and certificate details so each AI can offer a more tailored, in-depth explanation.
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?
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 invoked by the EC2 Auto Scaling group when the instance starts and is terminated.
Explanation:
Correct Answer: 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.
Lifecycle Hooks Purpose: EC2 Auto Scaling lifecycle hooks are specifically designed to pause instances in specific states (like launching or terminating) to perform custom actions.
Both Launch and Termination Events: Lifecycle hooks can be configured for both EC2_INSTANCE_LAUNCHING and EC2_INSTANCE_TERMINATING events, which perfectly matches the requirement to send data "as soon as they are launched and terminated."
Immediate Execution: When a lifecycle hook is triggered, the instance is paused in its current state, allowing scripts to run immediately before the instance transitions to the next state.
Reliability: Lifecycle hooks ensure the script runs even if the instance fails to boot properly or terminates unexpectedly.
Option A (Scheduled Lambda function):
Option C (User data in launch configuration):
Option D (Custom script invoked by Auto Scaling group):
EC2_INSTANCE_LAUNCHING and EC2_INSTANCE_TERMINATINGThis solution provides the most efficient, reliable, and AWS-native approach to meet the requirements.