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.

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.