I have been trying to upload a file to FTP in a AWS EC2 instance. I have created a ROOT user for the same. I am getting an Operation timed out error. Below is my code:
    ftp = ftplib.FTP()
    host = "ec2-my-ip.compute-1.amazonaws.com"
    port = 21
    username = 'username'
    password = 'password'
    ftp.connect(host, port)
    print (ftp.getwelcome())
    ftp.login(username, password)
    print 'logged in'
    ftp.cwd("/home/user/")
    print 'changed directory'
    ftp.retrbinary('RETR abc.png', open('/Users/Subhrajyoti/Downloads/abc.png', 'wb').write)
    print 'file transferred'
    ftp.quit()
Below is the output that i am getting:
    220 (vsFTPd 2.3.5)
    abc
    changed directory
    [Errno 60] Operation timed out
When i am using filezilla to connect i am getting the following error:
Status:         Resolving address of ec2-my_ip.compute-1.amazonaws.com
Status:         Connecting to my_ip:21...
Status:         Connection established, waiting for welcome message...
Status:         Insecure server, it does not support FTP over TLS.
Status:         Logged in
Status:         Retrieving directory listing...
Command:        PWD
Response:       257 "/home/user"
Command:        TYPE I
Response:       200 Switching to Binary mode.
Command:        PASV
Response:       227 Entering Passive Mode (my,machine,ip,25,4,1).
Command:        LIST
Error:          Connection timed out after 20 seconds of inactivity
Error:          Failed to retrieve directory listing
I have followed the instructions provided in the python FTPLIB. What am i doing wrong?