How can this be accomplished?
Create a scheduled Amazon EventBridge rule to run an AWS Systems Manager Automation runbook that checks if any EC2 instances are scheduled for retirement once a week. If the instance is scheduled for retirement, the runbook will hibernate the instance.
Enable EC2 Auto Recovery on all of the instances. Create an AWS Config rule to limit the recovery to occur during a maintenance window only.
Reboot all EC2 instances during an approved maintenance window that is outside of standard business hours. Set up Amazon CloudWatch alarms to send a notification in case any instance is failing EC2 instance status checks.
Set up an AWS Health Amazon EventBridge rule to run AWS Systems Manager Automation runbooks that stop and start the EC2 instance when a retirement scheduled event occurs.
Explanations:
This option suggests creating a scheduled EventBridge rule to check for EC2 retirement events weekly. However, EC2 instance retirement events are not predictable and occur based on AWS maintenance schedules. A scheduled check may not capture all relevant events in real-time, thus failing to address the need for immediate automation upon retirement notification.
Enabling EC2 Auto Recovery helps automatically recover instances if they become impaired, but it does not specifically address EC2 instance retirement events. AWS Config rules would not limit recovery to maintenance windows since auto recovery is based on instance health and does not have provisions for maintenance windows in this context.
This option involves rebooting all instances during a maintenance window, which is not a proactive solution for managing retirement events. It also does not provide real-time handling of retirement notifications, and CloudWatch alarms for status checks do not address the automation needed for scheduled retirement events specifically.
Setting up an AWS Health EventBridge rule to trigger Systems Manager Automation runbooks allows for immediate response to EC2 instance retirement events. This automation directly stops and starts the affected instances as soon as retirement events are detected, ensuring minimal downtime and manual intervention.