Sarmen (5) [Avatar] Offline
#1
Hello!

I have been working through the firewall example and when I try to enter this code with $PathToKey and $BastionHostPublicName properly listed with the appropriate input:
ssh -i $PathToKey/mykey.pem -A ec2-user@$BastionHostPublicName


[ec2-user@ip-172-31-0-22 ~]$ ssh --i C:/Users/"SARMEN LAPTOP"/Desktop/"AMAZON WEB SERVICES"/opsworkskey.pem -A ec2-user@ec2-107-21-181-180.compute-1.amazonaws.com
ssh: Could not resolve hostname C:/Users/SARMEN LAPTOP/Desktop/AMAZON WEB SERVICES/opsworkskey.pem: Name or service not known
[ec2-user@ip-172-31-0-22 ~]$ ssh -i C:/Users/"SARMEN LAPTOP"/Desktop/"AMAZON WEB SERVICES"/opsworkskey.pem -A ec2-user@ec2-107-21-181-180.compute-1.amazonaws.com
Warning: Identity file C:/Users/SARMEN LAPTOP/Desktop/AMAZON WEB SERVICES/opsworkskey.pem not accessible: No such file or directory.
The authenticity of host 'ec2-107-21-181-180.compute-1.amazonaws.com (172.31.0.22)' can't be established.
ECDSA key fingerprint is 3f:28:ee:35:7d:f0:de:38:87:c1:20:f6:27:c6:d9:3f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ec2-107-21-181-180.compute-1.amazonaws.com,172.31.0.22' (ECDSA) to the list of known hosts.
Permission denied (publickey).

I've entered the path in many ways and nothing seems to work.

Any ideas out there?

Best,
-Sarmen
Sarmen (5) [Avatar] Offline
#2
Can anyone give me a pointer as to why I am unable to connect to the bastion host/authenticate?
Sarmen (5) [Avatar] Offline
#3
Do any of the AWS specialists know how to get around the issue?
Michael Wittig (88) [Avatar] Offline
#4
Hi Sarmen,

1. I don't understand how your example relates to chapter 6 which is not about Ops Works but about the bastion host pattern. Can you explain what you try to achieve?
2. It looks like you are on Windows? We suggest to use Putty on Windows.
3. It looks like that the private key you use does not match with the public key on the server. ssh comes with the -v argument to show more verbose ouput which might helo to debug the problem.

Thanks
Michael
Sarmen (5) [Avatar] Offline
#5
Michael Wittig wrote:Hi Sarmen,

1. I don't understand how your example relates to chapter 6 which is not about Ops Works but about the bastion host pattern. Can you explain what you try to achieve?
2. It looks like you are on Windows? We suggest to use Putty on Windows.
3. It looks like that the private key you use does not match with the public key on the server. ssh comes with the -v argument to show more verbose ouput which might helo to debug the problem.

Thanks
Michael


Thanks for the reply, Michael.

The example is from Chapter 6 page 172. I am doing the bastion host example with firewall5.json being used as the stack template. I am using putty/ssh. I am trying to access the bastion host but am not being authenticated with my key. The fact that the name of the key is "opsworkskey" is moot I believe.

Any suggestions?
Sarmen (5) [Avatar] Offline
#6
Basically the files on my system are not being recognized when I search for them even though I can successfully change default directory to the folder that contains the file.
Michael Wittig (88) [Avatar] Offline
#7
Hi Sarmen,

to debug this problem I need
1.) screenshot of the KeyPairs section in EC2
2.) screenshot of the EC2 Instance details of the bastion host
3.) screenshots of all the putty Settings you enter while connecting

Thanks
Michael
399289 (1) [Avatar] Offline
#8
without know all that is going on with your computer. you say that you are using putty. did you convert the pem to a ppk file for putty use? and when using putty did you make sure that you added the key pair under the auth section of putty and save the data then try to get in? I vaguely remember having this same issue when i was doing the lectures from acloudguru and the problem was that i was not using putty correctly. I ended up having to delete my keypairs and the instance and redoing the whole thing over. Once i created an instance but i never configured the security group correctly and i could not gain access either. well i know that the post is sort of old and most likely you figured it out already but let me know what the issue was and if anything that i stated could have fixed it. It helps with my learning also. I just got my AWS CSAA last month and I am working on the Sysops currently. anyway i hope it all works out and you have no further issues.