- Newest
- Most votes
- Most comments
Based on your description, your EC2 instance appears to be running (status is green) but is not accessible intermittently. This is different from a shutdown scenario, as the instance remains active according to AWS. Here are several potential causes and troubleshooting steps:
-
Resource constraints: Your t3.medium instance might be experiencing CPU or memory pressure. T3 instances use a CPU credit system, and if you exhaust your CPU credits, performance can be throttled, making your application appear unresponsive even though the instance is technically running.
-
Application issues: Your application might be crashing or becoming unresponsive while the underlying instance continues to run. This is common when applications run out of memory or encounter unhandled exceptions.
-
Network configuration: Check your security groups, network ACLs, and VPC settings to ensure they haven't been inadvertently changed.
-
Operating system issues: The AlmaLinux OS might be experiencing issues that make it unresponsive while still appearing to be running from AWS's perspective.
Troubleshooting steps:
-
Monitor resource usage: Set up CloudWatch alarms to monitor CPU, memory, and disk utilization to identify potential resource constraints.
-
Check system logs: Examine system logs for error messages or warnings that might indicate the root cause.
-
Implement proper logging: Ensure your application has comprehensive error logging to capture any issues.
-
Consider using a process manager: Tools like Supervisor or systemd can automatically restart your application if it crashes.
-
Enable detailed monitoring: Temporarily enable detailed monitoring in the EC2 console to get more granular metrics during periods of unavailability.
-
Check the "State transition message" for your instance in the EC2 console if it does actually stop at any point.
If these steps don't resolve the issue, you might want to consider:
- Upgrading to a larger instance type with more resources
- Implementing an architecture with multiple instances behind a load balancer
- Using an auto-scaling group to improve reliability
Sources
EC2 stops running intermittently | AWS re:Post
Instance or Server keeps shutting down | AWS re:Post
EC2 suddenly gets online and offline randomly | AWS re:Post
answered a year ago
Check you EC2 metrics in CloudWatch, I think you have reach the t3 burst limit and therefore the EC2 cannot serve further requests making your EC2 'not available'. You can change your instance type to m5 or c5 depending om your need and the issue might resolve. You might also need to change the instance size from medium to large depending on CPU consumption.
Troubleshoot:
Use CloudWatch to check CPU, Disk and Memory (configure CloudWatch Agent). Since you use t3.medium (a burstable instance), monitor CPU credit balance. If it drops too low, performance can be affected without the instance being marked as unhealthy. Docs: [https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-credits-baseline-concepts.html]
CloudTrail
Events like: StopInstances, RebootInstances, ModifyInstanceAttribute, TerminateInstances, or CreateImage
Filter by: Resource name: your EC2 instance ID
Docs: [https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-insights.html] [https://repost.aws/knowledge-center/ec2-unexpected-shutdown]
answered a year ago
Relevant content
asked 8 years ago
asked 3 months ago
asked 2 years ago
- AWS OFFICIALUpdated 5 months ago
