Skip to content

EC2 instance rebooted unexpectedly

0

Hey guys,

In the early hours of the 16th (yesterday), one of my EC2 instance suddenly restarted. I checked my OS and did not find a shutdown date, just the boot time:

# last reboot
boot time                                  Sun Feb 16 03:23

In the system logs, there was also no recorded reboot or shutdown event, only the system boot:

(/var/log/messages)
Jan 27 18:52:49 copernicus pkg[59385]: git-2.48.1 installed  
Feb 16 03:23:07 copernicus syslogd: kernel boot file is /boot/kernel/kernel  
Feb 16 03:23:07 copernicus kernel: ---<<BOOT>>---  
Feb 16 03:23:07 copernicus kernel: Copyright (c) 1992-2023 The FreeBSD Project.  
.......

On the system, there was no SIGINT, SIGTERM, coredump or any reboot instruction. So the shutdown occurred outside of the system (EC2 instance), abruptly.

But on AWS, I checked CloudTrail, and the last recorded reboot was in Jan 20:

# aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=RebootInstances --region us-east-1 --query 'Events[*].{Time:EventTime,User:Username,Instance:Resources[0].ResourceName}' --output table --profile cloudtrail

-------------------------------------------------
|                 LookupEvents                  |
+----------------------+----------------+-------+
|       Instance       |     Time       | User  |
+----------------------+----------------+-------+
|  i-<redacted_text> |  1737407400.0  |  root |
+----------------------+----------------+-------+

I have some instances, and this happened with only one. I have good knowledge of the operating system (FreeBSD), and there is nothing in it indicating a shutdown. It seems like something such as a shutdown due to power failure. On the AWS side, besides CloudTrail, is there another way to track what might have happened?

Thanks, Rafael Grether

asked 2 years ago376 views

2 Answers
0

Unexpected EC2 instance reboots can occur for several reasons, and it's important to investigate thoroughly to determine the cause. Based on the information you've provided, it seems that the reboot was not initiated from within your instance or through AWS API calls, as there are no logs indicating a planned shutdown or reboot command.

Given that the reboot appears to have been abrupt and without warning, here are some possible explanations and steps you can take to investigate further:

  1. Underlying hardware issues: AWS may reboot your instance if there's a problem with the physical hardware hosting it. In such cases, EC2 might move the instance to healthy hardware, which could explain the sudden reboot without any logs on your end.

  2. Resource exhaustion: Although less likely for a sudden reboot without logs, if your instance ran out of memory or other critical resources, it might have triggered a reboot.

  3. AWS-initiated maintenance: While you didn't receive a notification, it's possible that AWS performed emergency maintenance that required a reboot of your instance.

To further investigate and prevent future occurrences:

  1. Check the EC2 console's Event History for any scheduled maintenance or system status events around the time of the reboot. This might provide insights into AWS-initiated actions.

  2. Review CloudWatch logs and metrics for any unusual activity or resource utilization spikes before the reboot.

  3. Consider setting up the CloudWatch agent to collect more detailed system logs, which can provide insights into resource usage and system behavior that might not be captured in your current logs.

  4. Set up CloudWatch alarms for key metrics like CPU, memory, and disk utilization to get early warnings of potential problems that could lead to instability.

  5. If you're unable to determine the cause or if the issue persists, it's recommended to open a support case with AWS. They can provide more detailed information about any AWS-initiated reboots and offer tailored advice for your specific situation. AWS support would have access to more detailed logs and information about the underlying infrastructure that might explain the unexpected reboot.

Remember, while unexpected reboots are rare, they can happen due to various factors, some of which may be outside of your control. Implementing robust monitoring and having a good understanding of your instance's normal behavior will help you quickly identify and respond to such incidents in the future.
Sources
Unexpected EC2 Reboot Without Prior Notice | AWS re:Post
Sudden reboot of t2.small EC2 Instance Sept 5 2024 12:51 UTC | AWS re:Post
Unscheduled EC2 Instance Reboot Inquiry | AWS re:Post

answered 2 years ago

EXPERT

reviewed 2 years ago

EXPERT

reviewed 2 years ago

0

If your instance appears to have been offline and then unexpectedly rebooted, it might have undergone automatic instance recovery in response to an underlying hardware or software issue. You can verify this by checking for automatic instance recovery events in your AWS Health Dashboard. You can also check whether an underlying hardware or software issue was detected for your instance by checking the StatusCheckFailed_System Amazon CloudWatch metric.

For more information, see the following documentation: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/verify-if-automatic-recovery-occurred.html

AWS

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.