- Newest
- Most votes
- Most comments
- Check Instance Status in the AWS Console: Go to the EC2 Dashboard in the AWS Management Console. Look at the Instance State and Status Checks. If the status checks show any failures, this indicates an issue with the instance.
- Review Logs and Metrics: In the Monitoring tab of the EC2 instance, check for any unusual CPU, memory, or network activity that might indicate why the instance is unresponsive. Review CloudWatch Logs if they are configured, as they can provide more details on what might have gone wrong.
- Stop and Start the Instance: If the instance is unresponsive and you cannot connect to it, try stopping and then starting the instance. This will move it to a new host and might resolve the issue. Note: Stopping and starting the instance will change the public IP address (unless you have an Elastic IP associated with it). Auto-scaling shouldn't be an issue unless your instance is part of an Auto Scaling Group, which might automatically terminate and replace instances. Since you mentioned a warning about auto-scaling, ensure that stopping and starting the instance will not cause it to be replaced.
- Detach and Re-Attach the EBS Volume: If the instance is still unresponsive after restarting, consider detaching the EBS volume (the one you were editing) from the instance and then trying to reconnect. If you can reconnect after detaching the volume, the issue may be related to the EBS volume. You can try re-attaching it to see if the issue persists.
- Check Security Group and Network ACLs: Ensure that the Security Group associated with the instance allows SSH (port 22) and HTTP/HTTPS (ports 80/443) traffic. Verify that the Network ACLs for the subnet where the instance is located are not blocking incoming or outgoing traffic.
- Connect via SSM (Systems Manager) Session Manager: If you have AWS Systems Manager (SSM) Agent installed and configured on your instance, you can try connecting to it via Session Manager. This can be useful if SSH or EC2 Instance Connect isn’t working.
- Reboot the Instance: If all else fails, consider rebooting the instance. This might resolve transient issues, but be aware that if there's an underlying issue (e.g., disk corruption or a kernel panic), it may persist after reboot.
- Create a Snapshot of the EBS Volume: Before making any significant changes, you might want to create a snapshot of your EBS volumes for backup purposes.
- Review Instance System Logs: If you can connect via SSH or SSM, check the system logs (/var/log/messages or /var/log/syslog) to see if there are any errors or warnings that might indicate what went wrong.
Hello.
Is it possible to connect to EC2 with Systems Manager Session Manager instead of SSH?
Session Manager requires an IAM role attached to EC2, but I think you can try it as a connection method other than SSH.
https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-prerequisites.html
By the way, can you check the EC2 system log?
Depending on the instance type you are using with EC2, you may not be able to view it, but if you can check the system log, please check to see if any errors are output.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/troubleshoot-unreachable-instance.html#instance-console-console-output
You should also be able to take a snapshot of your EC2 and create another EC2 from the snapshot to troubleshoot.
https://docs.aws.amazon.com/prescriptive-guidance/latest/backup-recovery/restore.html
I can download the system log. I think what I'm seeing is my reboot. I don't see anything that looks like an error, but there are entries like this, [ 36.551149] zram_generator::config[1884]: zram0: system has too much memory (904MB), limit is 800MB, ignoring. [ 36.870411] zram_generator::config[1912]: zram0: system has too much memory (904MB), limit is 800MB, ignoring. [ 37.167638] zram_generator::config[1940]: zram0: system has too much memory (904MB), limit is 800MB, ignoring.
From the message perspective, it looks like it's stuck due to lack of memory. Therefore, if the problem occurs again, please try taking measures such as increasing the instance type to another level or creating a swap area. https://repost.aws/knowledge-center/ec2-memory-swap-file
Relevant content
- Accepted Answerasked a year ago
- asked a year ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 3 months ago
About 30 minutes after the reboot (step 7) - it started working again.