1

I don't have ssh key but I have access to aws portal and console where the ec2 machine is there.

I tried using the steps in this link to connect ec2 instance.

Method 1:

using only instance-id and mssh

mssh i-038317982dc6a7c64 Unable to init server: Could not connect: Connection refused (mssh:2876): Gtk-WARNING **: 14:03:20.071: cannot open display: 

Method 2: To generate a new ssh key and push that to ec2 instance.

aws ec2-instance-connect send-ssh-public-key --instance-id i-038317982dc6a7c64 --availability-zone us-east-1b --instance-os-user ec2-user --ssh-public-key file://my_key.pub An error occurred (EC2InstanceNotFoundException) when calling the SendSSHPublicKey operation: Instance not found. 

But that machine is there.

So I tried by providing region also.

aws ec2-instance-connect send-ssh-public-key --instance-id i-038317982dc6a7c64 --availability-zone us-east-1b --region us-east-1 --instance-os-user ec2-user --ssh-public-key file://my_key.pub { "RequestId": "9ecd1748-1ef3-4b7b-b1a5-5ae4370df452", "Success": true } 

Then, I tried connecting with ssh.

But with dns name or ip address, I am getting permission denied only.

ssh -o "IdentitiesOnly=yes" -i my_key [email protected] The authenticity of host '54.174.85.61 (54.174.85.61)' can't be established. ECDSA key fingerprint is SHA256:7hTrm5wLeicqFVbNG9MW7HDEqUZQDi/H/OzJ3AwL0zU. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '54.174.85.61' (ECDSA) to the list of known hosts. [email protected]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic). ssh -o "IdentitiesOnly=yes" -i my_key [email protected] The authenticity of host 'ec2-54-174-85-61.compute-1.amazonaws.com (54.174.85.61)' can't be established. ECDSA key fingerprint is SHA256:7hTrm5wLeicqFVbNG9MW7HDEqUZQDi/H/OzJ3AwL0zU. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added 'ec2-54-174-85-61.compute-1.amazonaws.com' (ECDSA) to the list of known hosts. [email protected]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic). 

Please suggest what are the options available to connect aws linux 2 machine with aws credentials configured in the console and having instanceid/machine dns name or ip address

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.