Our support customers use a wide range of web hosting companies to host their websites. Many host with us, but most are using one of the million web hosts available. But while the companies may vary, the general hosting configuration is the same for 99%. Most of our customers are on a traditional Linux based server, using cPanel, Plesk, or something similar. This gives us easy tools to set up SFTP accounts and access the site database easily.
Recently, we’ve had a few customers signing up using Amazon as their web host. Since Amazon doesn’t have a traditional web hosting admin, I thought I’d detail how we connect our systems.
A caveat or two first…
This post will not be a step by step guide on how to connect to Amazon via SFTP. Most tutorials assume you are the account owner and set up the account initially. Since this isn’t and won’t be the case for us, this post is meant as a general guide, and a nice reminder for us to look back on.
The first thing to realize is that Amazon EC2 uses SSH Keys to authenticate rather than a standard password. This creates a more secure environment, but it’s also a few more hoops to jump through.
SSH Keys are essentially two matching keys – one public, one private that have to match to authenticate. The public key is stored on the server, and the private key is stored locally on your computer, to be used in what ever application you’re connecting with – whether that be the Terminal or an SFTP client.
You need the original keys
Amazon gives you the option to set up multiple key pairs, but from what I can tell, you can’t access the server via SFTP without the original private key. I’m assuming the public half of the newly created key pair would need to somehow get onto the server, but how do you do that without access to the original key pair? Perhaps someone with more experience can explain in the comments…
Bottom line for us – to connect to an Amazon EC2 server via SFTP, the original Private Key must be available.
We’ll connect using Transmit, but the steps will be the same for any SFTP client you choose to use:
Let’s go through each of these settings:
Address / Hostname
This is the server address. You can find it by logging into your Amazon EC2 instance and looking for the Public DNS (IPv4) setting. It will look something like this:
This was a bit weird to find, but as far as I can tell, every user here is:
Password / Key
In the password field, click on the key icon and choose the public key that we talked about earlier. Hopefully you have it stored somewhere safe.
Overall this isn’t that hard… once you know what these values are it’s straight forward. But again – we banged our heads for a while and now we know. And now you know too ;)