Ftp – Directory Listing not rendered when connecting to EC2 Windows 2012 Instance

amazon ec2ftpwindows-server-2012

I've created an Amazon EC2 Windows 2012 instance. I installed FTP via IIS and ensured that both the Amazon firewall and the instance's firewall allow traffic on port 21. When I connect to the instance from my Filezilla FTP client, the connection is accepted, but the directory listing is not rendered.

Here's the output when attempting to connect using Filezilla:

Response:   501 Server cannot accept argument.
Command:    PASV
Response:   227 Entering Passive Mode (204,236,224,103,192,56).
Command:    LIST
Response:   150 Opening BINARY mode data connection. 
Error:  The data connection could not be established: ETIMEDOUT - Connection attempt 
timed out 
Error:  Connection timed out
Error:  Failed to retrieve directory listing

While connected to the server via RDP, I open IE and enter ftp://localhost and can connect without problem. In my local browser, when I enter the ftp://ElasticIP I am unable to connect. Note that I set the FTP Server in IIS with bindings to to all IP addresses unassigned listening on port 21. The FTP Firewall support has the Elastic IP entered as well.

What additional steps must be taken to ensure FTP works correctly? Thanks much for your help and guidance.

Best Answer

From this link: https://forums.aws.amazon.com/thread.jspa?messageID=361644&tstart=0#

"IIS FTP uses Active Mode while EC2 only supports Passive Mode FTP connections because instances have a private and public IP addresses.

The only work around to this is:

  1. Please make sure that Windows Firewall is disabled on the Public Profile.

  2. Open this port range on the Security Group (EC2): TCP 49152-65535

  3. Make sure that you are using an Elastic IP Address (EIP) on this instance.

  4. Add this EIP as the external IP address in the FTP firewall configuration. http://learn.iis.net/page.aspx/309/configuring-ftp-firewall-settings-in-iis-7/ Please see "Step 2: Configure the external IPv4 Address for a Specific FTP Site" on the above page.

I tested this on Windows Server 2008 R2 (IIS 7.5). If you follow these steps, your IIS FTP should configured to use Passive Mode FTP which works with EC2."

Doing this worked for us.