TurnKey Linux Virtual Appliance Library

How do you get data in and out of an EC2 instance.

invalid's picture

This is a newbie question but I'm been unable to figure it out.  I've got an instance of the Django appliance running on Amazon's EC2 service and I need to move a bunch of swf files over to it.  I found a file upload in the webmin file manager but it only seems to upload a single file at a time.

I thought that FTP would be the thing I need.  I found the instructions and installed several different ftp servers but I was unable to connect to either of them.  I don't even know what host name I need to be using to connect.  If my webmin address was https://ec2-xxx.amazonaws.com:12321/, I tried to connect to ftp://ec2-xxx.amazonaws.com.  I also tried connecting the IP address like ftp://xxx.xxx.xxx.xxx. but was unable to do that either.

I checked and there doesn't seem to be any firewall running and as far as I can tell, my FTP settings are correct but I keep getting an "unable to connect" error message.

In doing some additional searching on the forum, I found a mention that FTP isn't supported and that you should use SFTP instead.  How does that work?  Do I need to set something up on the server side?  What Windows SFTP client works best?  What do you use to specify the host name in the client?

Sorry to be asking so many questions that are probably painfully basic.  I think I've spent too many years in the Windows world.

Alon Swartz's picture

EC2 security groups / SFTP

Amazon EC2 use security groups, which are basically firewall configurations. So, to allow FTP to your instance, you would need to update the security group. That said, I wouldn't use FTP.

SFTP (secure FTP) is already supported by all appliances and most modern FTP clients. It's encrypted so your password won't be transmited over the Internet in the clear and the implementation is also much more secure and robust. I've heard some good things about filezilla on windows, which might be what your looking for.
Joe Goldthwaite's picture

Thanks for the reply

Thanks for the reply Alon,

I checked into the security groups settings on EC2.  It looks like my instance is in the default security group. It also looks like the default security group already has access set up for SSH on Port 22.

So it sounds like sftp is running and configured and I don't have to do anything to enable it in my Turnkey Django instance. Are there other settings you need to make on the Linux side to allow the sftp connections?  Do I have the correct address when I try to connet to ftp://ec2-xxx.amazonaws.com.?

Jeremy Davis's picture

+1 for Filezilla

There are probably plenty of different Win FTP apps, but I personally try to use open source whenever possible. Filezilla is a free (in both senses of the word) FTP client that supports SFTP. Not that it matters to you but it works pretty nice on Linux too. It's what I use in both my Windows and Ubuntu desktops.

Joe Goldthwaite's picture

Thanks JedMeister.  I

Thanks JedMeister.  I downloaded Filezilla.  I'll try it out as soon as I'm able to connect.

Joe Goldthwaite's picture

Before I waste any more of

Before I waste any more of your time, I just got it to work.  I typed in sftp://myamazonaddress to Filezilla with my login and password on port 22 and it fired up.  I guess what I was missing was the "s" in the address.

Thanksa gain for your help.

Guest's picture

SFTP User / Password

Thanks, John.

FYI for others, needed to use "ec2-user" for User, blank password

Jeremy Davis's picture

That shouldn't work with TKL

The only username available for use should be 'root' and it should require your root password (if you set it in the Hub) or the security key (if you set that in the Hub) or the random password that you can get from the server logs (if you diidn't set a password in the Hub).

Jomy Muttathil's picture

Just to clarify...

port 21 which is typically used by FTP, is disabled by default in EC2 Security Groups.

port 22 which is used by SFTP and SSH is enabled and supported by both TL appliances and EC2.

In your file transfer client change the protocol to SFTP and the port to 22.

If you are a Mac user, I highly recommend Transit and CyberDuck.  Both support SFTP and S3.

Guest's picture

could not connect to server while connecting to ec2 through file


I am totally new to the ec2. i tried connecting to ec2 instance using filezilla so that i can upload the files but i am unable to do it. it says could not connect to server.tried everything specified above!pls help.

Alon Swartz's picture

Did you specify SFTP?

Make sure you specify SFTP in filezilla when connecting. Also make sure that the security group allows port 22 (SSH/SFTP).

Guest's picture

can't ftp to my amazon EC2 instance

I have both 21 and 22 ports added to my security group, using filezilla still get connection refused while trying to access my instance.  Any thoughts

Jeremy Davis's picture

How did you launch it? Via the Hub?

If not I strongly suggest you sign up and use that (link top right of page) because it makes it seriously easy! All the security group stuff etc is taken care of for you and you can also apply a free tklapp.com dynamic domain name! As well as other cool features.

If you did launch via the Hub then there is a problem (it should just work OOTB). Did you set a root password? If not it sets one randomly and you'll need to set up keys so you can connect. If you set a root password and still no good, then I'd send 'feedback' (blue button on the left hand side when logged into the Hub) and the devs will help you work it out.

If you didn't use the Hub and wish to continue then you're on your own. My guess is that it's to do with the root password (as mentioned above). You should be able to manually preseed a root password but I have never used AWS without the Hub so wouldn't know where to start.

Liraz Siri's picture

Yep, this is why the Hub exists

When we first started making TurnKey available as Amazon Machine Images we ran into lots of these little annoying issues. I call them paper cuts. They don't kill you right away, but if you get enough of them you bleed to death (or call it quits).

It didn't make any sense that you would have to be an expert to get a TurnKey system up and running and running - as that goes against everything TurnKey is trying to accomplish!

The Hub makes things simple. I might even say deceptively simple because it actually makes rather complex use of Amazon's APIs behind the scenes to make everything work seamlessly.

Guest's picture

use filezilla to connection to EC2

Did you have your settings correct? If you are able to connect to your EC2 instance with putty, you should be able to use filezilla to connect it. See http://lzw-programmingjourney.blogspot.com/2011/12/set-up-ftp-server-on-amazon-aws-ec2.html for details.

Guest's picture

yup i specified it as

yup i specified it as sftp://ec2-xxx.compute.amazonaws.com and also specified the port as 22..the error is

Status:    Resolving address of ec2-xxx.compute.amazonaws.com
Status:    Connecting to xxx...
Error:    Connection timed out
Error:    Could not connect to server

wat might be the issue? any ideas..


Guest's picture

also i have a really basic

also i have a really basic doubt..pls excuse me..

the user name and password to be specified in filezilla is the one which we use to login to amazon s3 rite? i am not so sure about that too..

Guest's picture

you have to use your Ec2

you have to use your Ec2 instance's user name and not AWS account login.

this is the same username you will be using for SSH

for my ubuntu 10.10 the username is 'ubuntu'

Guest's picture

Write permission denied using Filezilla to EC2

I have a permissioning problem with uploading files into my EC2 instance.

I got Filezilla to connect over SSH using my .ppk file and connected using the 'ec2-user' account.

My problem comes when I attempt to upload a file to /var/www/html/ where I get write permission denied.  I can upload files if I chmod /html to 755, but obvioulsy that means that my ec2-user user does not have the proper permissons or I need to create a new user with the appropriate permissions.

Fairly new to Linux so any suggestions on the best way to handle this?


Jeremy Davis's picture

I haven't played with EC2 enough

But going on my assumption of how it should work (in my mind at least) you probably need to add the user 'ec2user' to the 'www-data' group. AFAIK by default the /var/www folder is owned by www-data:www-data (ie user www-data, group www-data). Thus adding this user to the www-data group should give it the correct permissions without interfering with the operation of the appliance or creating potential security issues.

Guest's picture

Try sudo chown -R ec2-user


sudo chown -R ec2-user /var/www/html

Guest's picture

excuse me for basic questions

I have the same questions about the login and password to connect to the ec2 using filezilla.


When it says, instance's username, does it mean the 'instance ID' in form of 'i-xxx5d4xx'?

and what should be the password? amazon  website login password?

and also I wanna make sure that....

I inputted: "sftp://amazon-instance-address" for host and ''22" for port. Am I correct?


Prior to the connecting to ec2 from ftp... When I type "amazon-instance-public-dns-url" in a firefox webbrowser, I only see error msg saying the server is responding too slow and unable to connect to the server although I'm supposed to see a test server page. Does this mean my instance is not launched properly? though the status of instance in elasticfox is "running"? I do have this error page every public AMI is used.... I do not even sure which AMI im sopposed to use...for livestreaming application for wowza...

Plz excuse for these basic questions...

Jeremy Davis's picture

When you connect via SFTP use your appliance credentials

So by default you would use root as the username and the predefined root password (set up on launch from Hub).

As to your problems accessing the appliance via the net, I'm not sure about that. There is obviously something not quite right although I don't know enough about EC2 to be of much help to you. I need to spend some time having a play with it so I understand it all a bit better.

If there is something wrong with the instance itself, you may still not be able to log in via SFTP.

Guest's picture

login thourgh sftp with root.

I'm having the same problems i launched several frech instances set the root password and I cannot login trough sftp via root  to acces read-write all the files on the server.

any help here ?

Guest's picture

sftp login

sftp -oIdentityFile=[mykey].pem root@[myinstance].amazonaws.com

Guest's picture

First get .ppk

First you need to generate .pk file: Refer the link to generate private key (.pk) file: http://codingthis.com/platforms/ec2/getting-started-for-free-with-amazon...

Then in Filezilla: Edit -> Settings -> SFTP Click on 'Add keyFile' and select the .pk file.

Close the Settings window.

Enter Host: like: ec2-107-22-137-202.compute-1.amazonaws.com and enter port: 22 click on Quick connect. It will connect

Guest's picture

FTP on EC2

Thanks. That worked perfectly. FileZilla does the conversion. So its a one step process.

Add the key file to FileZilla. FileZilla does the conversion of the key file for you. Connect. That's it.

Guest's picture

EC2 permissions denied

hi all,

I have similar issue regarding permission denied. but it is not via ftp but while uploading data via javaapp(web) in tomcat server.
I took a free instance and logged in as ec2-user. My application has to upload the page from filesystem to specified directory.The same app is working properly in linux.but in aws Everything is working apart from uploading. So it is a permission issue. Can anybody help me to sort out this issue.

thanks in advance



Jeremy Davis's picture

Which appliance are you using?

If your appliance requires you to access a non-standard (ie non-pre-configured port) then you may need to open the relevant port with AWS (TKL appliances have their internal firewall disabled by default by AWS has a firewall type arrangement AFAIK).

I don't know anything about how that is done at all. Thanks to the magic of the Hub (and the fact I haven't needed to use a non standard port) I don't have to! :)

Guest's picture

Connecting to EC2 instance

Thanks Krishnan Nair. Your instructions helped me to connect via FileZilla.

Guest's picture

connection refused

jnias@ubuntu:~/.euca$ euca-authorize default -P tcp -p 22 -s
[Errno 111] Connection refused

this is what i am getting and fully tired what to do next, can you please help me out what to do..

Guest's picture

Thanks you

Gracias a todos.

Los comentarios me han sido de mucha ayuda.

No conseguía entrar por FTP y al añadir el archivo .PEM en filezilla todo se arreglo.

Ahora al fin puedo entrar y mover archivos a mi gusto

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)