Monday 2 October 2017

Amazon AWS / EC2 - My first foray

Today I mainly be tinkering with AWS and EC2, as that's what my client is using.

Having built out a new Ubuntu VM, I hit a few newbie 101 errors, including: -

ssh -i ~/Downloads/IHS01.pem 1.2.3.4

The authenticity of host '52.23.166.202 (52.23.166.202)' can't be established.
ECDSA key fingerprint is SHA256:vKk0YZCPqhBS6sHPwjEySqMq2SISglIBMC3h7LdoX4Q.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '52.23.166.202' (ECDSA) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/Users/foobar/Downloads/IHS01.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/Users/foobar/Downloads/IHS01.pem": bad permissions
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).


So I fixed this: -

chmod 600 ~/Downloads/IHS01.pem 

and retried: -

ssh -i ~/Downloads/IHS01.pem 1.2.3.4

and then got this: -

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

which flummoxed me for a while.

And then I realised that I wasn't actually asserting a user ID on the SSH command, so it was defaulting to my logged-in user ID.

Given that it's EC2, I tried this: -

ssh -i ~/Downloads/IHS01.pem ec2-user@1.2.3.4

and, c'est voila, I'm in: -

Last login: Mon Oct  2 12:26:03 2017 from 4.5.6.7.dyn.plus.net
[ec2-user@ip-1.2.3.4 ~]$
uname -a
Linux ip-1.2.3.4.ec2.internal 3.10.0-514.el7.x86_64 #1 SMP Wed Oct 19 11:24:13 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

Job's a good 'un :-)

No comments:

Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...