I am trying to copy a file from an sftp server I created on the "aws transfer family" using the aws lambda function (java) and save that file to s3 storage. How can i do this? I would be grateful if anyone could provide some lambda code
Asked
Active
Viewed 430 times
1
-
What have you tried? Where are you stuck? Why aren't you using the built-in AWS Transfer Family support for S3 instead of writing your own Lambda function? – Mark B Mar 23 '21 at 11:42
-
Are you able to read the file from the Lambda function? – smac2020 Mar 23 '21 at 11:49
-
@MarkB We have a task in which there is an external sftp server that is currently not available to us. We need to implement the logic for copying files from this sftp server to our s3 storage. At the moment, we have made an sftp server on aws and are trying to copy lambda data from this server to s3 in order to implement the logic that can be tested at the moment – Sasha Mar 23 '21 at 12:06
-
@smac2020 No I can't – Sasha Mar 23 '21 at 12:07
-
OK, so you will need to write some code that connects to an SFTP server and downloads a file using some SFTP library for your programming language, and then some more code using the AWS SDK for your programming language to upload that file to S3. At this point you haven't provided any information about what you have tried, or where you are stuck. What does your current code look like? What errors or issues are you encountering? – Mark B Mar 23 '21 at 12:08
-
@MarkB I used this article https://www.baeldung.com/java-file-sftp (2.1. Maven Configuration, 2.2. Setting Up JSch, 2.4. Downloading a File With JSch) for connect to sftp server but I don't understand where I can get remoteHostName, userName and Password – Sasha Mar 23 '21 at 12:21
-
Those would be things you get from AWS Transfer Family when you created the SFTP server. – Mark B Mar 23 '21 at 12:22
1 Answers
0
AWS Transfer family already has functionality for SFTP to be backed by S3. So there is no need to create an additional Lambda function.

Mark Sailes
- 727
- 4
- 16