Q3 — AWS DOP-C02 Ch.1
Question 3 of 100 | ← Chapter 1
A company operates a file retrieval application that saves files to a database running on Amazon EC2 instances. Regulatory requirements mandate that the company delete files daily from specific EC2 instances. The company also retains database records for no more than 60 days. Database record deletion occurs after file deletion. The company has created a script to delete both files and database records. If the deletion script fails, the company must receive an email notification.
- A. Use AWS Systems Manager State Manager to automatically invoke a Systems Manager Automation document at a scheduled time each day. Configure the Automation document to run the deletion script sequentially using Run Command. Create an Amazon EventBridge rule to send failure notifications to the company via Amazon Simple Notification Service (Amazon SNS). ✓
- B. Use AWS Systems Manager State Manager to automatically invoke a Systems Manager Automation document at a scheduled time each day. Configure the Automation document to run the deletion script sequentially using Run Command. Add a conditional statement in the Automation document as a final step to check for errors. Use Amazon Simple Email Service (Amazon SES) to send failure notifications as emails to the company.
- C. Create an Amazon EventBridge rule that invokes an AWS Lambda function at a scheduled time. Add required invocation permissions to the Lambda function’s resource-based policy. Configure the Lambda function to run the deletion script sequentially. Configure the Lambda function to send failure notifications to the company via Amazon Simple Notification Service (Amazon SNS).
- D. Create an Amazon EventBridge rule that invokes an AWS Lambda function at a scheduled time. Add required invocation permissions to the Lambda function’s resource-based policy. Configure the Lambda function to run the deletion script sequentially. Configure the Lambda function to use Amazon Simple Email Service (Amazon SES) to send failure notifications as emails to the company.
Correct Answer: A. Use AWS Systems Manager State Manager to automatically invoke a Systems Manager Automation document at a scheduled time each day. Configure the Automation document to run the deletion script sequentially using Run Command. Create an Amazon EventBridge rule to send failure notifications to the company via Amazon Simple Notification Service (Amazon SNS).
Explanation
Option A is optimal because Systems Manager Automation provides built-in error handling and integration with EventBridge for failure detection, eliminating custom error-checking logic. State Manager reliably schedules the Automation document daily. Run Command executes the script on target EC2 instances. EventBridge rules can natively trigger on Automation execution failures and forward notifications via SNS—requiring minimal development effort. Options B, C, and D introduce unnecessary complexity: B requires manual error-checking logic in Automation; C and D rely on Lambda, which lacks native OS-level script execution context and requires additional IAM and network configuration for EC2 interaction, increasing implementation overhead.