Having Trouble SSH’ing into CentOS 9 AMI on EC2

0
5
Asked By CuriousCat42 On

Hey everyone! I'm having a strange issue with Amazon EC2. I'm trying to launch a t2.micro instance using an AMI with the ID ami-05ccec3207f126458, but every time I attempt to SSH into it, my SSH keys are refused, even though I set them correctly during the launch. I thought maybe I messed up the keys, so I generated a new pair and used the downloaded version without changing anything. However, even with matching fingerprints, I still can't get in. This is my first time facing this problem and I'm at a loss. I've also tried logging in with both ec2-user and centos as usernames. Just an update: I finally solved it thanks to a user; it turns out I needed to use 'cloud-user'!

5 Answers

Answered By InfoSeeker99 On

I would double-check the AMI ID. Sometimes, using the wrong AMI can lead to issues like this. You can refer to the CentOS AWS images documentation for further verification. If you need to check the AMI ID, ensure you're looking in the right place.

Answered By ServeSecure88 On

Another option could be to use SSM. It's often much more secure than attempting to SSH into instances, and setting it up via cloud-init can streamline your process.

Answered By CloudGuru77 On

Did you check the permissions on your SSH key file? Sometimes if the permissions are too open, SSH will refuse to use the key.

Answered By TechWizard88 On

The issue you're experiencing is most likely due to the user name for that specific AMI. You should be using 'cloud-user' instead of 'ec2-user' or 'centos'. I ran into the same problem when I first started with this AMI. Good luck!

CuriousCat42 -

YES! This was the answer! Indeed, trying with cloud-user worked! Thanks!

Answered By TheOldPro On

You might want to consider generating ed25519 keys if the problem persists. Some newer instances might require those for proper authentication.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.