Q8 — AWS DOP-C02 Ch.1
Question 8 of 100 | ← Chapter 1
A company runs an application on an Amazon EC2 instance. Application metadata is stored in Amazon S3 and must be retrieved when the instance restarts or recovers automatically.
- A. Create an Amazon CloudWatch alarm for the StatusCheckFailed metric. Use recovery actions to stop and start the instance. When the instance is back online, use S3 event notifications to push metadata to the instance.
- B. Configure AWS OpsWorks with auto-healing enabled to stop and start the instance. Use OpsWorks lifecycle events to fetch metadata from Amazon S3 and update it on the instance. ✓
- C. Use EC2 Auto Recovery to automatically stop and start the instance upon failure. When the instance is back online, use S3 event notifications to push metadata to the instance.
- D. Use AWS CloudFormation to create an EC2 instance with a UserData property. Include a command in UserData to retrieve application metadata from Amazon S3.
Correct Answer: B. Configure AWS OpsWorks with auto-healing enabled to stop and start the instance. Use OpsWorks lifecycle events to fetch metadata from Amazon S3 and update it on the instance.
Explanation
UserData is executed once at instance launch—ideal for retrieving metadata from S3 during initial boot or after recovery (since Auto Recovery and reboot trigger UserData re-execution on EBS-backed instances). It requires no external services, is declarative, and guarantees metadata availability before application startup. Options A, C, and S3 event notifications assume metadata delivery *after* boot, creating race conditions. CloudWatch alarms and Auto Recovery do not inherently trigger UserData re-execution unless the instance is truly relaunched (not just rebooted). Option B adds unnecessary operational overhead with OpsWorks. Option D is simplest, most reliable, and fully satisfies the requirement with zero additional resources.