SAP-C02 Question 373
Select 2Your company has a fleet of EC2 instances in an Auto Scaling group serving a high-traffic web application. Occasionally, one of the instances becomes unresponsive due to an application issue, leading to customer impact. You are tasked with implementing a solution that detects unresponsive instances and automatically remediates the issue by replacing them. How can you achieve this using AWS services?
- A
Set up a CloudWatch Alarm based on a custom metric to detect unresponsive instances and configure the Auto Scaling group to replace unhealthy instances.
- B
Use AWS Config to monitor EC2 instance health and create a remediation rule to terminate unresponsive instances.
- C
Implement an AWS Lambda function triggered by a CloudWatch Alarm to stop and start unresponsive instances.
- D
Enable EC2 Auto Recovery for all instances to detect and recover from unresponsiveness automatically.
- E
Create a CloudWatch Alarm using the StatusCheckFailed_System metric and integrate it with the Auto Scaling group to replace unhealthy instances.
Show answer and explanation
Correct answers: A, E
Explanation
To detect and automatically remediate unresponsive instances, a combination of CloudWatch Alarms and Auto Scaling group configurations is the most effective approach. Custom metrics or predefined metrics like StatusCheckFailed_System can be used to monitor instance health, and Auto Scaling can automatically terminate and replace unhealthy instances to maintain application availability.
- A. Correct.
Correct. Setting up a CloudWatch Alarm based on a custom metric, such as responsiveness or a health check, and configuring the Auto Scaling group to replace unhealthy instances is an effective way to detect and remediate unresponsive instances.
- B. Incorrect.
Incorrect. AWS Config is designed for compliance and configuration monitoring rather than real-time health monitoring or automatic remediation of unresponsive instances.
- C. Incorrect.
Incorrect. While AWS Lambda can be used for custom automation, stopping and starting unresponsive instances does not guarantee that the issue is resolved. Replacing the instance is a more robust solution.
- D. Incorrect.
Incorrect. EC2 Auto Recovery only works for hardware or system-level failures and does not address application-level unresponsiveness. It is not suitable for this scenario.
- E. Correct.
Correct. The StatusCheckFailed_System metric in CloudWatch can be used to detect unresponsive instances, and integrating it with the Auto Scaling group allows automatic instance replacement.