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

The authenticity of host ' (' can't be established.
ECDSA key fingerprint is SHA256:vKk0YZCPqhBS6sHPwjEySqMq2SISglIBMC3h7LdoX4Q.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (ECDSA) to the list of known hosts.
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

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@

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

Last login: Mon Oct  2 12:26:03 2017 from
[ec2-user@ip- ~]$
uname -a
Linux ip- 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: