AWS Certified Developer – Associate / Question #575 of 557

Question #575

A company is using an AWS Lambda function to process files uploaded to an Amazon S3 bucket. The Lambda function invokes an external validation API for each file. During load testing, the developer observes that the external validation API occasionally times out and returns errors. The company expects some validation API errors but wants the operations team to receive near-real-time notifications only when the error rate exceeds 10% of total file validations within a 30-minute period. Developers must use an existing Amazon Simple Notification Service (Amazon SNS) topic already configured to alert the operations team.

Which solution meets these requirements?

A

Log the results of the validation API calls to Amazon CloudWatch. Use CloudWatch Logs Insights to query the logs hourly. Configure a scheduled Lambda function to analyze the logs and publish alerts to the existing SNS topic.

B

Publish custom CloudWatch metrics for validation API successes and failures. Configure a CloudWatch alarm to trigger when the error rate exceeds 10% over 30 minutes and notify the existing SNS topic.

C

Publish all validation API error results to a new Amazon SNS topic. Subscribe the operations team to this topic and apply a filter to suppress notifications below the 10% error threshold.

D

Write validation API results to an Amazon DynamoDB table. Schedule an AWS Step Function to query the table every 30 minutes and invoke the existing SNS topic if the error rate exceeds 10%.

Explanation

Option B is correct because:
1. Custom CloudWatch Metrics: Publishing success/failure metrics enables tracking the error rate dynamically.
2. CloudWatch Alarm: Configuring an alarm with a 30-minute evaluation period and a 10% error threshold ensures near-real-time detection.
3. SNS Integration: Directly linking the alarm to the existing SNS topic provides immediate notifications.

Other options fail because:
- A: Hourly checks via Lambda introduce delays, violating the 'near-real-time' requirement.
- C: SNS lacks built-in error rate calculation over time, making threshold enforcement impossible.
- D: Step Functions' 30-minute polling introduces latency and complexity compared to CloudWatch's real-time monitoring.

Key Points: Use CloudWatch Metrics/Alarms for real-time thresholds and SNS for notifications. Avoid solutions relying on delayed checks or insufficient metric calculations.

Answer

The correct answer is: B