DVA-C02 practice question 35 of 35
A company is building a serverless application on AWS. The application uses an AWS Lambda function to process customer orders 24 hours a day, 7 days…
Full set: 598 questionsDomain Development with AWS Services
The most effective and direct solution is to use Amazon CloudWatch custom metrics and alarms. The Lambda function can be instrumented to publish a custom metric for each successful and failed API call to the external vendor. A CloudWatch alarm can then be configured using Metric Math to calculate the error rate (e.g., (failures / (successes + failures)) 100) over the specified one-hour period. When this calculated rate exceeds the 5% threshold, the alarm will trigger and send a notification to the pre-configured, existing SNS topic. This approach provides near real-time monitoring and alerting, precisely meeting the requirements.
A. Scheduling a Lambda function to query CloudWatch Logs is a polling mechanism that introduces unnecessary latency and complexity, failing the "near real-time" requirement compared to a push-based alarm.
C. This would notify the support team for every API call result, not just when the error rate exceeds a specific threshold. This fails to meet the core requirement of conditional alerting.
D. Using Amazon S3 and Athena is designed for batch analytics and interactive querying, not for near real-time monitoring and alerting. This solution would have significant delays and is overly complex.
1. Amazon CloudWatch User Guide - Publishing custom metrics: "You can publish your own metrics to CloudWatch using the AWS CLI or an API. ... You can then view statistical graphs of your published metrics with the AWS Management Console." This supports the first part of the correct answer. (See section: "Publish custom metrics").
2. Amazon CloudWatch User Guide - Using Amazon CloudWatch alarms: "You can create an alarm to monitor any Amazon CloudWatch metric in your account. ... If the metric breaches the threshold for the number of evaluation periods you specify, the alarm performs one or more actions that you specify. ... For example, you can configure an alarm to send a notification to an Amazon SNS topic." This confirms the alarm-to-SNS integration. (See section: "Using Amazon CloudWatch alarms").
3. Amazon CloudWatch User Guide - Create a CloudWatch alarm based on a metric math expression: "You can create a CloudWatch alarm that evaluates a metric math expression. ... For example, you can create an alarm that is triggered if the error rate of a fleet of EC2 instances is too high." This directly addresses the requirement to monitor a calculated rate. (See section: "Metric Math alarm examples").
4. AWS Lambda Developer Guide - Instrumenting your code to generate custom metrics: "For business or application-level metrics, you can create custom metrics. For example, you can record the number of records processed or calls to a downstream service." This confirms that instrumenting the Lambda function to create these metrics is a standard practice. (See section: "Working with Lambda function metrics").
Keep practicing
Take the free DVA-C02 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DVA-C02 practice questions
- Question 1A company has a multi-node Windows legacy application that runs on premises. The applicat…
- Question 2A developer migrated a legacy application to an AWS Lambda function. The function uses a …
- Question 3A development learn has an Amazon API Gateway REST API that is backed by an AWS Lambda fu…
- Question 4A company is expanding the compatibility of its photo-snaring mobile app to hundreds of a…
- Question 5A company has an ecommerce application. To track product reviews, the company's developme…
- Question 6A social media company is designing a platform that allows users to upload data, which is…
