Send an S3 file, whenever it is uploaded, to a remote server using SFTP
Warning: This repository is not under development or maintenance anymore, I strongly recommend using the yunojuno's fork instead
- If you are using a private key to connect to SFTP, edit
main.py
and put its value inside thePRIVATE_KEY
var make package
- Upload
package.zip
to AWS Lambda (on console or command line)
- Select Python 2.7 as the runtime environment.
- In AWS Lambda, you can define a trigger. Select S3 and then PUT. you can limit the triggers to a particular folder there.
- Set the handler name to "main.lambda_handler"
- Make sure you give Lambda permission to read from S3
- S3 PUT
Name | Description | Required |
---|---|---|
SSH_HOST | SSH server name or ip address | Yes |
SSH_PORT | SSH server port | Not (default: 22) |
SSH_DIR | Directory where the uploaded files should be placed in the SSH server | No (default: SFTP home folder) |
SSH_USERNAME | SSH username for the connection | Yes |
SSH_PASSWORD | SSH server password | Not (default: None ) |
This function does not replicates the S3 directory structure, it just copies every file uploaded to S3 to the SSH_DIR
in the SSH_HOST
.