Q47 — AWS DVA-C02 Ch.1
Question 47 of 100 | ← Chapter 1
A company has an AWS Lambda function that runs hourly to read log files stored in Amazon S3 and then sends alerts to an Amazon Simple Notification Service (Amazon SNS) topic based on defined criteria. A developer wants to add custom metrics to the Lambda function to track the count of each alert type per hourly execution. The developer needs to log this information in Amazon CloudWatch under a metric named 'Lambda/AlertCounts'. How should the developer modify the Lambda function to meet this requirement with minimal operational overhead?
- A. Add a print statement to standard output for each alert type and occurrence count.
- B. Add a call to the PutMetricData API operation. Pass the alert array along with occurrence counts in the Value and Count fields, using the namespace 'Lambda/AlertCounts'. ✓
- C. Add a call to the PutMetricAlarm API operation. Pass a set of alerts in the MetricName field of a metric with namespace 'Lambda/AlertCounts'.
- D. Add a call to the PutDashboard API operation. Pass a set of alerts in the MetricName field of a metric with namespace 'Lambda/AlertCounts'.
Correct Answer: B. Add a call to the PutMetricData API operation. Pass the alert array along with occurrence counts in the Value and Count fields, using the namespace 'Lambda/AlertCounts'.
Explanation
https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_PutMetricData.html