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 toLinux/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:
cp /path/to/my_key.pem ~/.ssh/
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:
sudo vim config
In this file add the following lines (instructions of each line are after the # mark so you may remove information after these):
Host 184.108.40.206 # your elastic IP or Public DNS address IdentityFile ~/.ssh/my_key.pem # or /path/to/my_key.pem StrictHostKeyChecking no UserKnownHostsFile /dev/null IdentitiesOnly yes ForwardAgent no
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:
ssh -v firstname.lastname@example.org
(instead of root you may be asked to use ubuntu instead, i.e.
ssh -v email@example.com
If you receive any
Permission denied (public key)
errors at the bottom of the text you will have to change the permission of your key file, to do this enter:
chmod 600 ~/.ssh/my_key.pem
chmod 600 /path/to/my_key.pem
Then try running the previous command again.
If you find upon running the
ssh -v firstname.lastname@example.org
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. 220.127.116.11 (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:
sudo chown -R ubuntu:www-data /var/www