AWS Certified Machine Learning Engineer Associate · Free Practice Question Medium

Question 2

A financial services company uses an AWS Lambda function to monitor transaction fraud detection metrics from an ML model deployed in Amazon SageMaker. The company wants to be notified via email whenever the fraud detection model’s confidence score drops below a specific threshold, such as 80%. The ML engineer needs to implement an automated solution that triggers email notifications whenever the confidence score breaches the threshold.

Which of the following options should be combined to develop a solution that addresses these requirements? (Select two)

  • A

    Log the metrics from the Lambda function to AWS CloudWatch

  • B

    Log the metrics from the Lambda function to AWS CloudFormation

  • C

    Set up a CloudFormation change set to send the email message

  • D

    Set up a CloudWatch alarm to send the email message

  • E

    Log the metrics from the Lambda function to AWS CloudTrail

Reveal correct answers

Correct answers: A, D

Explanation

Correct options:

Log the metrics from the Lambda function to AWS CloudWatch

AWS Lambda integrates seamlessly with Amazon CloudWatch, allowing you to log custom metrics directly from the Lambda function. These metrics can be used to monitor the performance and health of the ML model.

Lambda integrates natively with CloudWatch, allowing you to log custom metrics using the CloudWatch API from the AWS SDK. For example, you can use the putMetricData method to log performance metrics such as execution duration, memory usage, or invocation counts. Additionally, you can use the Lambda execution environment to automatically capture logs like errors or custom messages with console.log, which appear in the CloudWatch Logs console. These metrics and logs can then be visualized in dashboards, used to set up alarms for anomalies, or analyzed further to optimize your function's performance and cost efficiency. To implement this, ensure the Lambda function has the necessary IAM permissions to write to CloudWatch.

Set up a CloudWatch alarm to send the email message

CloudWatch Alarms offer a native way to monitor metrics and automate notifications via Amazon SNS. Setting up a CloudWatch alarm to send an email message involves monitoring a specific metric and configuring Amazon Simple Notification Service (SNS) for email notifications. First, identify the metric you want to monitor and create an alarm in the CloudWatch console. During the alarm configuration, define the threshold conditions (e.g., metric value breaching a certain value) and the evaluation period. Next, create an SNS topic and subscribe the desired email addresses to this topic. When setting up the alarm's actions, specify the SNS topic as the target for notifications when the alarm state changes (e.g., from OK to ALARM). Once configured, the alarm will automatically send email alerts to the subscribers whenever the specified condition is met (such as, for the given use case, the fraud detection model’s confidence score drops below a specific threshold of 80%), ensuring timely notifications about critical events or performance issues.

Incorrect options:

Log the metrics from the Lambda function to AWS CloudTrail - AWS CloudTrail is designed for auditing API calls and tracking changes in AWS accounts, not for logging or monitoring application metrics.

Log the metrics from the Lambda function to AWS CloudFormation - AWS CloudFormation is a service used for defining and provisioning infrastructure as code; it is not a logging or monitoring service.

Set up a CloudFormation change set to send the email message - Email notifications based on metrics are managed through CloudWatch and SNS, and not via a CloudFormation change set. CloudFormation change sets allow you to see how your changes might impact your running resources (managed via CloudFormation), especially for critical resources, before implementing them.

References:

https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html

https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need