Open the Amazon EC2 console.
In the navigation pane, choose Instances.
Select the instance that you want to configure.
Choose Actions, and then choose Monitor and troubleshoot. Then, choose Manage CloudWatch alarms.
Choose Create an alarm.
Note: To create an alarm, you must have AWS Identity and Access Management (IAM) permissions to stop and start the associated instance. For more information, see Creating IAM roles.
For Alarm notification, choose an existing Amazon Simple Notification Service (Amazon SNS) topic. To create a new topic, see Creating an Amazon SNS topic.
Note: To receive notifications when an alarm is triggered, you must be subscribed to the SNS topic.
Toggle on Alarm action, and then choose Recover.
For Group samples by and Type of data to sample, choose an appropriate statistic and metric for your use case.
For Consecutive period and Period, specify the evaluation period for the alarm.
(Optional) Modify the automatically created Alarm name.
Choose Create.
https://aws.amazon.com/premiumsupport/knowledge-center/automatic-recovery-ec2-cloudwatch/