Wednesday, December 28, 2011

Set up an FTP server on Amazon AWS EC2

You really don't need to set up an FTP server if you simply want to tranfer files between your EC2 instance and your local machine. You can use PSFTP (coming with putty package) with a saved putty session for your EC2 conection. Open a command window, type in psftp your_saved_putty_session_name. Type ec2-user for  login as and you are connected.


If you don't like commandline tool, you can use Filezilla instead. Download and install Filezilla client.  Lauch Filezilla. Click Edit -> Settings and select SFTP under Connction. Click Add Keyfile to add the private key file you use for putty connection. Click OK.


Click File -> Site Manager, Click New Site, enter your AWS EC2's public DNS or IP in Host field. Choose SFTP, enter ec2-user in User field and click Connect.

Now you are connected to your EC2 instance with FileZilla.


If you still want to set up an FTP server on your AWS EC2. Below are steps to install VSFTP.
  1. login to  your AWS management console.
    • Go to EC2 and click the Security Groups link.
    • Then choose the default group and switch to the inbound tab (at the bottom of the page)
    • Add the port ranges as above (20-21 and 40000-41000) and apply the rule changes
  2. connect to your instance with putty.
  3. login as ec2-user
  4. sudo su
  5. yum vsftpd
  6. change the conf file. vim /etc/vsftpd/vsftpd.conf. Add
    write_enable=YES 
    pasv_max_port=41000
    pasv_min_port=40000
    port_enable=YES
    pasv_enable=YES
  7. Add an FTP user (see instruction here)
  8. Start the FTP server. service vsftpd start

9 comments:

  1. This worked flawlessly. Thank you.

    ReplyDelete
  2. Excellent. Thanks for this. Works like a dream.

    ReplyDelete
  3. Thanks alot you are a life saver

    ReplyDelete
  4. One of the biggest challenges that organizations face today is having inaccurate data and being unresponsive to the needs of the Amazon AWS Users Email List organization.

    ReplyDelete
  5. Thanks for this great post! - This provides good insight. You might also be interested to know more about generating more leads and getting the right intelligence to engage prospects.
    Techno Data Group implements new lead gen ideas and strategies for generating more leads and targeting the right leads and accounts.
    Amazon AWS Users Email & Mailing List

    ReplyDelete
  6. i was trying to use filezilla to connect with ec2 but it is giving connection timed out error i have done all the configuration but no luck. Should i add anything else to configure on this website ifsccode.com end like servers or dns records

    ReplyDelete