Archive

Posts Tagged ‘AWS’

SFTP on Amazon EC2

January 29, 2010 1 comment

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

Categories: Amazon web services Tags: , , , ,