You have a web application hosted in AWS cloud where the application logs are sent to Amazon CloudWatch. Lately, the web application has recently been encountering some errors which can be resolved simply by restarting the instance. What will you do to automatically restart the EC2 instances whenever the same application error occurs?

Respuesta :

Answer/Explanation:

In this scenario, you can:

- look at the existing CloudWatch logs for keywords related to the application error to create a custom metric;

- create a CloudWatch alarm for that custom metric which invokes an action to restart the EC2 instance;

- create alarms that automatically stop, terminate, reboot, or recover your EC2 instances using Amazon CloudWatch alarm actions;

- use the stop or terminate actions to help you save money when you no longer need an instance to be running; and

- use the reboot and recover actions to automatically reboot those instances or recover them onto new hardware if a system impairment occurs.

Cheers