Automate EC2 Reboot with Systems Manager Maintenance Windows
A company's application runs on Amazon EC2 instances behind an Application Load Balancer (ALB). The company has configured an Amazon CloudWatch alarm to monitor the HTTPCode_Target_5XX_Count metric. The application crashes every few days during business hours. The crashes trigger the CloudWatch alarm and result in service disruption. The cause of the crashes is a memory leak in the application. While developers work to fix the problem, a CloudOps engineer needs to implement a temporary solution. The solution must automatically reboot the EC2 instances every day and must minimize application disruption during business hours. Which solution will meet these requirements?
Community Insight
The core trap is choosing CloudWatch alarms for scheduled daily reboots; alarms are event-driven and cannot trigger on a calendar schedule, whereas Systems Manager Maintenance Windows are designed specifically for scheduled maintenance tasks.
This question tests the use of AWS Systems Manager Maintenance Windows to schedule automated EC2 instance restarts during low-traffic periods, minimizing business disruption caused by application memory leaks.
Candidates often select Option C, assuming that monitoring system health metrics can automate a scheduled reboot. However, CloudWatch alarms only react to threshold breaches, not time-based schedules, making them unsuitable for this specific requirement.
Community Discussion (1 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option B is the correct solution because AWS Systems Manager Maintenance Windows allow you to define specific windows of time for performing maintenance tasks. By scheduling the window outside of business hours and using theAWS-RestartEC2Instance runbook, the engineer ensures that instances are automatically rebooted daily without impacting users during peak times. This approach provides the necessary automation while adhering to the constraint of minimizing disruption.Why the Other Options Are Wrong
Option A is incorrect because Amazon EventBridge rules can be scheduled, but theStartInstances API call starts stopped instances; it does not reboot running instances. To reboot an instance via EventBridge, you would need a Lambda function or another mechanism, making it less direct than SSM. Option C is incorrect because CloudWatch alarms are triggered by metric thresholds (like status checks failing), not by a daily schedule. They cannot enforce a proactive daily reboot. Option D is incorrect for similar reasons: alarms react to events after they happen, and restarting an application is not the same as rebooting the instance, nor does it solve the timing issue of doing it during business hours.Community Comment Notes
Community consensus strongly favors Option B. As Bad_Mat noted, "Use AWS Systems Manager to create a daily maintenance window..." is the standard best practice for scheduled maintenance on EC2 fleets. The comments highlight that other options fail to meet the 'automatically' and 'outside business hours' constraints simultaneously.Exam Strategy
Always distinguish between event-driven actions (CloudWatch Alarms) and time-driven actions (EventBridge Schedules or Systems Manager Maintenance Windows). For scheduled maintenance on AWS resources, Maintenance Windows is the dedicated service.
Frequently Asked Questions
Why can't I use a CloudWatch alarm to reboot instances daily?
CloudWatch alarms are event-driven and trigger when a metric crosses a threshold. They cannot be scheduled to fire at a specific time every day.
Does StartInstances reboot a running EC2 instance?
No. StartInstances starts an instance that is in a stopped state. To reboot a running instance, you must use StopInstances followed by StartInstances, or use the Restart action in SSM.
Related Analysis
Practice All SOA-C03 Questions
Access 100 questions with complete answers and detailed explanations.
View Full SOA-C03 Practice Test →