Issue
I have a requirement to send files from S3 bucket to an external client. FTP or SFTP can be used for this. Based on certain research I found this can be done using Lambda or using EC2 but couldn't find detailed steps for it. Please let me know how this can be done.
Solution
Amazon S3 cannot "send" files anywhere.
Therefore, you will need some code running 'somewhere' that will:
- Download the file(s) from Amazon S3
- Send the file(s) to the external client via SFTP
This is all easily scriptable. The difficulty probably comes in deciding which files to send and how to handle any errors.
You probably couldn't find any documentation on the topic because sending files via SFTP has nothing specifically related to AWS. Just do it the way you would from anywhere.
For example, let's say you wanted to do it via a Python program running either on an Amazon EC2 instance or as an AWS Lambda function:
- Download the desired files by using the AWS SDK for Python (boto3). See: Amazon S3 examples
- Send the files via SFTP. See: Transfer file from AWS S3 to SFTP using Boto 3
Answered By - John Rotenstein