Home > Amazon web services > SFTP on Amazon EC2

SFTP on Amazon EC2

Amazon Elastic Compute Cloud as well as Rackspacecloud (and many others) allows you to set up a remote server and deploy your web application (among other things).
I have setup my own account and run a small instance. For this I have used Amazon Web Toolkit plugin for Eclipse.
The documentation provided with this toolkit is fine. Unfortunately for me, as usual, it doesn’t work as expected: I have tried to run an instance located in the US but it seems that’s way too far ! I used to have this popup screen:

mmm… why did I do that ? Because I thought my fellows there would have a better time response and therefore a better user experience for the prototype that I did. I have changed the settings to point to a European instance.

This time it was starting up fine with AWS.

But running a simple dynamic web application as described in their tutorials (you don’t even need a tutorial though to create that) caused some trouble.

Another solution was to transfer the WAR file on the server and then put it into the webapps folder of tomcat. To do that why not use sftp, said Loïc to himself… 🙂
As the picture above shows you can right-click on the live server and select open shell. Your command is written at the top of the shell window. Here is what you should have:
Last login: Fri Jan 29 14:01:11 on ttys005
/usr/bin/ssh -o CheckHostIP=no -o TCPKeepAlive=yes -o StrictHostKeyChecking=no -o ServerAliveInterval=120 -o ServerAliveCountMax=100 -i /Users/loic/.ec2/eclipse-keypair.pem root@ec2-xxx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com
loic-talbots-macbook-pro:~ loic$ /usr/bin/ssh -o CheckHostIP=no -o TCPKeepAlive=yes -o StrictHostKeyChecking=no -o ServerAliveInterval=120 -o ServerAliveCountMax=100 -i /Users/loic/.ec2/eclipse-keypair.pem root@ec2-xxx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com

We have a pem file that manages the access keys to the server. In order to use them with sftp just type:
ssh-add ~/.ec2/eclipse-keypair.pem
and then you can use sftp to transfer your WAR file:
sftp root@ec2-xxx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com

Advertisements
Categories: Amazon web services Tags: , , , ,
  1. April 29, 2013 at 9:21 pm

    I’m amazed, I have to admit. Seldom do I come across a blog that’s
    both equally educative and amusing, and let me tell you, you have hit the nail on the head.

    The issue is something that not enough folks are speaking intelligently about.
    I am very happy that I came across this during my search for something relating to this.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: