Recently, I needed to import my own RSA SSH key to EC2. Here is a quick way to import to all regions

NB: You need the ec2 tools set up before you can run this. You will also need to have setup an x509 certificate pair.

You can read more about the ec2-import-keypair command in the EC2 documentation.

Remotely Connect to Your EC2 Server Using Coda FTP

Getting Coda to Remotely Connect to Your EC2 Server

Okay, so let’s jump to it. How do you get Coda to connect to your EC2 server?

First thing you will need is your private key (the file that you should have received from Amazon that ends in PEM). If you don’t have one of these babies then you’re going to need to go through Amazon’s getting started guide paying specific attention to section 3 & 4 on the “Launch Instance” section and the “Connect to Linux/Unix/Windows Instance”.

For the purposes of this walk through we’ll assume that the name of your private key is: my_key.pem

Now that you have your key you will need to move it to your ssh directory. Opening up Terminal, go to your ssh directory by typing:

You may either choose to copy your key into this folder, or, you can leave your private key wherever it so provided you know the path to it. Copying the file to the ssh directory would require you to do this:

Once you have either copied your key or noted its exact location in the ssh directory that you are actively in edit the config

Even if you don’t have that file, by doing the above you will be creating it. You may also need to be super-user if no permission is given:

In this file add the following lines (instructions of each line are after the # mark so you may remove information after these):

To save this document in vim you will need to exit by hitting :wq and then hitenter to save the document.

When this done, if you private key hasn’t been added you should do that now by entering:


To test that there are no problems with connecting to your server, enter in terminal the next command:

(instead of root you may be asked to use ubuntu instead, i.e.

If you receive any

errors at the bottom of the text you will have to change the permission of your key file, to do this enter:


Then try running the previous command again.

If you find upon running the

that you are faced with a prompt that asks you a yes/no question, enter “yes”.

Once you have successfully gained access to your EC2 server from the terminal window you are now almost ready to interface your server with Coda!

Open up Coda, click on the Sites tab button, click Add Site…and in all the text-boxes add the appropriate information according to your settings from the image above. A little more detail is provided here:

  • Nickname: can be anything you want to help you identify the site in Coda.
  • Root URL: URL to access the site.
  • Local URL: local location of the site (I use MAMP to test my sites)
  • Remote Root: where the server files are located that are directly correlated to the local structure
  • Local Root: where the local file/folder structure can be found
  • Server: the “Host” name you inserted in the config file above, i.e. (or the public DNS address)
  • User Name: either “root” or “ubuntu” or whatever the server requests as a user to log in to the server
  • Password: LEAVE BLANK!
  • Port: leave on the default 22
  • Protocal: SFTP

When all this has been done you can click on “Save”. When you’re sure that all the details match up correctly, click connect in the “Remote” tab area and hopefully everything should work as it should! If you do get password prompts check that your key file has been chmod to 600 (see above) and that your ~/.ssh directory has been chmod to 700.

If you still run into problems PLEASE check that all the server details and username details are correct. I had my server IP address round the wrong way and that threw out a few attempts.

Anyway, hopefully this helps you integrate Coda and your EC2 server together quicker.

PS: make sure your folder has permissions for the user you are uploading the data to, I had to run this command in terminal before it allowed me to upload files from within Coda:

How to configure Coda to work for Amazon EC2 instances

Coda should pick up settings from your ssh config so you can configure this fairly easily.

If you’ve saved your EC2 ssh keypair in ~/.ssh/ec2_rsa then simply edit ~/.ssh/config to look like:

You can also restrict the IdentityFile directive to just your AWS resource with:

If everything’s configured properly then you should be able to, from the command line, run:
ssh [email protected] and you will get a log in prompt

If you continue to have problems you can always enable password authentication on your instance by editing /etc/ssh/sshd_config and adding the line PasswordAuthentication yes to the end of the file, then setting a password for your user with passwd

I use the following settings in my .ssh/config to automatically apply my EC2 keypairs for EC2 resources:

Generate RSA Keypair and SSH into server

First, make sure you have an RSA keypair generated with the ssh-keygen command:

2. It will ask you for a location. Accept the default.

Enter file in which to save the key (/Users/evan/.ssh/id_rsa):

3. Next, it will ask you for a password. Don’t give it one (that is, just hit enter twice):

Enter passphrase (empty for no passphrase):
Enter same passphrase again:

4. Finally, it will tell you that it’s generated the keypair and give you its location. If you’re on Mac OS X, it will also print some ASCII art, in true mac form.

Your identification has been saved in /Users/evan/.ssh/id_rsa.
Your public key has been saved in /Users/evan/.ssh/

5. Now that you have a freshly minted set of crypto credentials, you need to let the servers know about them. This can get tedious. For each server to which you want to authenticate, you’ll need to do the following:

5.1. Upload your key (and type in your password):

5.2. SSH into the server (and type in your password):

5.3. Setup your ~/.ssh folder:

5.4. Logout, login again (without having to type in your password), and log out again:

5.5. Repeat steps 5.1 through 5.4 for each server you’d like to be able to access quickly.

6. Repeat steps 1 through 5.5 on each machine from which you’d be able to access servers quickly.

Deploy Hadoop cluster with Ubuntu Juju

Here I’m using new features of Ubuntu Server (namely Ubuntu Juju) to easily deploy a small Hadoop cluster.

Add juju apt-repository:

Add charms NON-local:

Add charms local:

Generate your environment settings with

Then edit ~/.juju/environments.yaml to use your EC2 keys. It’ll look something like:

Bootstrap and then deploy charms NON-local

Bootstrap and then deploy charms local

Check Juju status:

Everything is finished and happy when

Optionally scale horizontally with datanode:

When all said and done: (SSH into namenode/datanode)