I’m working on a project I have inherited and need to connect to an AWS EC2 instance. But I can not seem to connect to it. If I go into the EC2 Console, select the instance then connect. I would normally use SSH Client, but if I select this I get the following error:
No associated key pair
This instance is not associated with a key pair. Without a key pair, you can’t connect to the instance through SSH.
If I try Session Manager I get this error: We weren't able to connect to your instance
And If I try EC2 instance connect I get Failed to Connect to you instance error
.
I only need to run some very basic maintenance tasks and keep this alive for another month or so. So do not want to jump in too deep!
If anyone can help me here would be most grateful.
2
Answers
Here are docs describing how to connect to the instance: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstances.html
Referring to the two methods you mentioned:
AmazonSSMManagedInstanceCore
Fallow these steps:
Open an SSH client.
Locate your private key file. The key used to launch this instance is
key.pem
Run this command, if necessary, to ensure your key is not publicly viewable.
Connect to your instance using its Public DNS:
Example:
Go to aws Security Groups edit inbound rules to allow ssh to defult port 22
if you have a firewall configured for your server, you must also update the firewall rules to allow access on the new SSH port: