Automating EC2 Instance Stopping with Trusted Advisor |

Stop Low Utilization EC2 Instances Automatically |

Prev Question Next Question

Question

The Trusted Advisor in your AWS account raises the “Low Utilization Amazon EC2 Instances” alerts.

You check the EC2 instances and find that some instances should be stopped as they are no longer used.

You want to automate this process so that whenever Trusted Advisor discovers a low utilization EC2 instance, the instance will be stopped and you will get an email notification.

Which of the following methods is the most appropriate?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer - B.

Users can automatically stop EC2 instances that have low utilization recommended by Trusted Advisor with Cloudwatch Events and AWS Lambda.

Details please refer to https://github.com/aws/Trusted-Advisor-Tools/tree/master/LowUtilizationEC2Instances.

Option A is incorrect: Because the SSM Run Command should not be registered as the target of the CloudWatch Event.

It cannot stop instances or send email notifications.

Option B is CORRECT: Because the Amazon Cloudwatch Event can monitor the Trusted Advisor check and the Lambda function can stop instances and provide customized notifications.

Option C is incorrect: AWS Config may work however you have to maintain a custom rule.

You can directly monitor the Trusted Advisor checks through AWS CloudWatch Events.

Option B is easier.

Option D is incorrect: Because by using CloudWatch Events, the Lambda function will be triggered whenever there is a status match.

You do not need to trigger the function periodically.

Answer B is the most appropriate method to automate the process of stopping low utilization EC2 instances detected by the Trusted Advisor check.

Explanation: Amazon Trusted Advisor is a service that provides real-time guidance to help optimize AWS resources, improve performance, and security. It analyzes your AWS account and provides recommendations on cost optimization, security, fault tolerance, and performance improvement. One of the Trusted Advisor checks is "Low Utilization Amazon EC2 Instances," which identifies idle or underutilized EC2 instances that can be stopped to save costs.

To automate the process of stopping the low utilization EC2 instances detected by the Trusted Advisor check and receive an email notification, the following steps can be followed using Answer B:

  1. Create an Amazon Cloudwatch Event rule that monitors the Trusted Advisor Low Utilization EC2 Instances check and triggers an AWS Lambda function when an instance is identified as low utilization.
  2. Configure the AWS Lambda function to stop the identified instance using the AWS SDK or AWS CLI.
  3. Configure Amazon SNS to send an email notification whenever the Lambda function stops an EC2 instance.

This approach provides a scalable and reliable solution to automatically stop low utilization EC2 instances and receive email notifications whenever an instance is stopped.

Answer A is not the best option because using SSM Run Command requires additional setup, and it is not an efficient solution for stopping EC2 instances at scale.

Answer C is not a good option because AWS Config rules are used for monitoring and enforcing compliance policies, and not ideal for stopping EC2 instances based on Trusted Advisor recommendations.

Answer D is not a good option because triggering the Lambda function periodically is not an efficient solution, and it may cause additional costs if the Lambda function runs when there are no low utilization EC2 instances.