Which solution will meet these requirements?
Configure an Amazon GuardDuty finding that is based on EC2 CPU utilization. Associate an AWS Lambda function with the GuardDuty finding to terminate any instances that are identified as idle.
Configure an Amazon Simple Notification Service (Amazon SNS) topic to receive EC2 utilization messages from the AWS Health Dashboard. Create an AWS Lambda function. Subscribe the Lambda function to the SNS topic. Use the ec2.stop_instances operation to terminate idle instances.
Configure a Low Utilization Amazon EC2 Instances check in AWS Trusted Advisor to publish status changes to an Amazon Simple Notification Service (Amazon SNS) topic. Create an AWS Lambda function. Subscribe the Lambda function to the SNS topic. Use the ec2.stop_instances operation to terminate idle instances.
Configure an Amazon EventBridge rule for the Low Utilization Amazon EC2 Instances check in AWS Trusted Advisor. Select the EC2 Terminatelnstances API call as the target.
Explanations:
Amazon GuardDuty is primarily a security monitoring service and does not monitor EC2 CPU utilization directly. GuardDuty findings cannot be used to trigger Lambda functions for instance termination based on CPU usage.
The AWS Health Dashboard does not provide real-time metrics about EC2 utilization that can trigger notifications. Furthermore,ec2.stop_instancesis used to stop instances, not terminate them, and does not directly relate to CPU utilization monitoring.
AWS Trusted Advisor can check for low utilization instances, but it does not publish status changes directly to SNS. While a Lambda function can be subscribed to an SNS topic, the process outlined does not provide a proactive, automated way to terminate idle instances.
Configuring an EventBridge rule for the Low Utilization EC2 Instances check allows for automatic monitoring and action. By setting the EC2 TerminateInstances API call as the target, it directly addresses the requirement to automatically terminate underutilized instances based on Trusted Advisor’s checks.