I've been running an EC2 instance without issues, but suddenly I can't access it via SSH or HTTP. I've double-checked everything: the public IP, security groups, VPC settings, subnets, network ACLs, and route tables—all seem to be correctly configured. I even tried connecting from different networks to rule out local blocks, but no luck. Is there something I'm overlooking?
6 Answers
I've experienced this a few times, and often the problem lies inside the instance rather than with AWS. Check if the OS firewall is blocking connections or if the network stack is misbehaving. If a console screenshot shows the instance is alive, try stopping and starting it; that can sometimes fix things. If it still won’t work, consider attaching the volume to another instance for troubleshooting.
Always start by reviewing the official troubleshooting guide for connecting to your Amazon EC2 Linux instance. It covers many potential issues you might encounter.
I faced a similar issue before. If your instance is EBS-backed, try stopping it (you might need to force stop) and then starting it again. This process allows AWS to possibly move your instance to a new physical device, and it can sometimes resolve connectivity issues. If that doesn’t work, consider rebooting it.
There are two frequent culprits for this issue: 1) Your instance might be running out of memory and crashing. For Linux, set up a cron job to log the output of the 'free' command to monitor memory usage. If freeable memory drops too low, consider increasing the instance size or adding swap space. 2) If you’re on a burstable instance, you may be running out of CPU credits. Check CloudWatch metrics for CPU credits—if they’re running low, consider switching to Unlimited mode or a non-burstable instance.
Don’t forget to check the throughput of your EBS root volume if it’s EBS-backed; throttling could lead to connectivity issues.
One common problem could be that your public IP has changed. Run `curl ifconfig.me` on the instance and compare it with your security group’s allowed IPs to make sure they match. If the IP is fine, you might want to check if there's an OS-level issue by verifying the instance state with `aws ec2 describe-instance-status --instance-ids [INSTANCE_ID]`.

Related Questions
How To Get Your Domain Unblocked From Facebook
How To Find A String In a Directory of Files Using Linux