Cannot SSH into AWS EC2

0

I’ve been trying to set up a simple test EC2 instance for a web application but something weird is going on.

I initially started by creating an instance with the following settings:

Platform: Ubuntu Instance Size: t2.nano (Free Tier) Storage: 8GB Security Group: Allow all SSH, HTTP and HTTPS (For testing purposes)

The instance booted fine and using its public key and public IP Address, I could SSH into the box. After a short while I lost connection to the box and every subsequent SSH attempt resulted in a timeout. The only way I could SSH into the box again was to Stop the instance and then start it again, giving me a new public IP address.

My first thoughts were that the box was running out of memory for some reason, so I tried to increase the instance type to t2.small. This led to the exact same behaviour, after a short while of interacting with the box, I lost connection and then every SSH connection timed out.

I tried creating a whole new instance this time using Amazon Linux 2023 hoping that the operating system change might solve my issues. It didn’t.

After some googling and troubleshooting I came across this answer on stackoverflow Can't SSH into AWS EC2 instance. This person suggests that the whole account could be in some kind of billing isolation due to theirs being reactivated and that AWS Support need to action something their side to get things moving once more. The AWS account I have been given access to by a client is old and I am not sure how much it has been used in the past.

Can anyone help identify what this might be.

Tom J
asked 23 days ago147 views
2 Answers
0

Hello.

It is certainly possible that there is a problem with your AWS account, but I recommend that you start by checking the EC2 OS system logs to see if there are any errors.
Also, Is the CPU usage rate high?
I think it would be a good idea to try using Systems Manager Session Manager as described in the following document.
https://repost.aws/knowledge-center/ec2-linux-resolve-ssh-connection-errors

Also, although this may not be very relevant, it is better to set the security group to only allow your own IP address.
If you select "My IP" when adding a rule, the IP address will be automatically entered.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/working-with-security-groups.html#adding-security-group-rule

profile picture
EXPERT
answered 23 days ago
profile picture
EXPERT
reviewed 23 days ago
0

Contact AWS Support to investigate potential account-level restrictions.

profile picture
EXPERT
answered 23 days 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.

Guidelines for Answering Questions