Connecting remote FTPS server from EC2 instance

0

Hello. I have a PHP script which downloads some files from my EC2 instance using cURL. I connect to a remote FTPS server on port 990 and range port 50000-50010 is also used to download the files. When I run the script in local or in my Plesk production server, the script runs without problems but from EC2 I only get the message "Failed to connect to aaa.bbb.ccc port 990: Connection refused". I checked inbound and outbound rules for the security group, created new rules, allowed all traffic, tested different combinations, etc. I even created a new security group exclusively with rules for allowing inbound and outbound traffic, but it's not working. I don't know if besides the security group rules there is something else that I have to configure. I don't know what else can I check. Normally, when I wanted to access through SSH to my EC2 instance I only have to configure the inbound rule with my IP and that all, but with this I'm a bit lost. Thanks in advance for your help!

  • I'm sorry, I'm not following your question... So your PHP script is running on EC2 and attempting to cURL to some remote server on port 990 and ports 50000-50010 to download files. This script works locally and on another production server, but not on your EC2 instance, correct? Are other sites accessible from your EC2 instance (meaning your EC2 instance can access the internet)?

1 Answer
0

Hello Dear Customer,

It seems like your EC2 Instance doesn’t have the capability to connect to a remote server, that is why when you try to run the scripts locally, they work but not through your instance in the cloud. You need to make sure, your EC2 instance can talk to remote servers on the internet, either through giving the instance itself a Public IP address or by using a NAT gateway. Additionally, you can also utilize the LFTP tool in order to determine what is causing the connection failure. You can use the debug option -T or -o when connecting to your ftp server though the command line. Here are some resources you can utilize. Hope they will be of help.

Resources:

https://aws.amazon.com/premiumsupport/knowledge-center/nat-gateway-vpc-private-subnet/

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html

https://lftp.yar.ru/lftp-man.html

answered 2 years ago
AWS
SUPPORT ENGINEER
reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions