AWS EC2 instance inaccessible (even) through instance connect in the dashboard

I’m running a free tier EC2 instance.

What gives? I was using this EC2 last night connecting through ssh. It seems to go up and down on its own. It happened last night too and I was able to get after trying an hour later.

I never changed any security/inbound rules. It has been working consistently the past week. I’ve rebooted it.

It’s just running some docker-compose containers. The public ip does not work either. I am using the correct ports.

Is this common behavior in AWS?

edit:

thanks for all the notes; I’m still learning the lingo (which would help when using particular tools :)) and I appreciate everyone that commented; I shut down the server so I could quickly move on, I got one with extra RAM in case that was getting filled preventing the connection

Are the instance status checks all good? You can also try stopping and starting the instance (this is not the same as rebooting) though note that if you do not have an elastic IP assigned, your public IP will change

Is it a spot priced instance? If so, that is exactly what you are paying for. Edit: ignore that, free tier.

Likewise if you are using CPU credits, make sure you haven’t used all those credits up, otherwise your instance will freeze until those credits recover again.

I’d also suggest setting up SSM on your EC2 instances and using that to connect to verify it isn’t just an issue with SSH.

If this is something that cannot have any downtime, in a cloud environment you should be provisioning the application across multiple availability zones, additionally. If the rack running your EC2 instance were to fail due to a hardware fault, you have no redundancy. Same with any hardware.

You might want to consider something like ECS rather than docker in an EC2 instance if you do not want to fiddle with lower level stuff like EC2 and networking, redundancy, etc.

Of course you get what you pay for, so to speak. The free tier has an SLA of > 99.9% uptime though, so if you are getting less than that and you can prove it is not a problem with your instance, CPU credits, resource usage on that instance, etc, then you can always ask AWS Support for assistance.

yes. 2/2… I asked chatgpt for help. told me to ping the server; it sent back a response.

Now I just checked it again and it is working again.

ah thanks! that is insightful… felt like I was getting gaslit by my cloud provider.

I’m guessing I made way too many requests since I was fiddling around with setting up a database in a naive way and doing many, albeit small POST requests. I’ll just pay out of pocket since I’m on a crunch to get my demo up and running before an interview.

thanks again

If I still worked customer service and someone told me they used chatgpt to admin a server, I’d just hang up the phone.

edit: LOL that hit a nerve. The army of junior admins gettin’ ANGSTY today.

cool

If it’s stupid but it works, it’s not stupid.

Does it look like it’s working?

OP literally said it’s working fine now, so yes.

His server is bouncing and he has no idea why.

That’s not working.

I’ve seen instances with low memory not accessible with SSH because OOM decided to kill sshd. Also with the right conditions Linux could get stuck due to kswapd0 taking all of the CPU trying to do the impossible. In that case SSH won’t be responsive.

In both cases a restart fixes those temporarily.

Cool, definitely don’t install GitHub copilot and find out that it makes you insanely more productive, your coworkers will enjoy their promotions.

just check the monitoring tab on the AWS console. It will tell you if you ran out of credits or anything!

What I mentioned about SSM… that is always good to set up anyway. You install it in the EC2 instance and enable the service, open an egress security group rule on port 443 for 0.0.0.0/0 or a dedicated VPC endpoint, and add the AmazonSSMManagedInstanceCore IAM profile.

Then you can do stuff like

  • Log into your EC2 like you do with SSH but by running aws ssm start-session on your local computer.
  • Log into your EC2 like you do with SSH but in your browser on AWS console.
  • Port forward
  • Manage auto updating your EC2

Hope you find the solution though, good luck!

(Edit: not me downvoting you, btw)

So you are upset ai is replacing you?

LMAO :joy:

ha, thanks ya I set a budget. I built an app last month that was smaller scaler without any issue, all the way through to SSL/nginx to make it accessible on a new domain. But DevOps is my biggest blind spot across the stack,

so I appreciate your comments/time immensely, i’ll be bookmarking your comments to reference later.

The only thing that won’t be monitored in the AWS dashboard is memory usage. If you are using something like a database or other process that can use increasingly more memory it can run out with some instance types. I had a self hosted mysql db on there for a site I used to work when I first started and had to add swap file to help handle the amount of memory.

The memory outage should show up in the system or service logs inside the server, but its not guaranteed.

I never changed any security/inbound rules.

Did your IP change?

oh yes… i checked that to confirm as well. thanks for asking.