Lambda service dedicated to upload events to a SFTP server.
This service uses the SSH2 NPM package to handle SFTP.
- FTP_HOST
default: localhost
- FTP_PORT
default: 22
- FTP_USER
default: testuser
- FTP_PASS
default: testpass
- UPLOAD_PATH
default: /upload
- FILE_EXTENSION
default: txt
The file name is generated as:
Math.round(new Date().getTime() / 1000)
- Full file name is:
${UPLOAD_PATH}/${fileName}.${FILE_EXTENSION}
- Start a local FTP server
npm run start-local-sftp
- Execute the function
sls invoke local -f uploadFtp -d "HELLO SFTP WORLD"
docker exec -ti localsftpserver /bin/bash
cd home/testuser/upload/
Warning: Check your local serverless configuration before deploying.
sls deploy