Setup node.js
Run npm install
in root folder
Setup AWS Cli in local side
npm install -g aws-cli
Setup AWS access-key-id and secret-access-key in local side
aws configure
Set environment variables
environment:
aws_access_key_id: # Add aws_access_key_id here
aws_secret_access_key: # Add aws_secret_access_key here
Set bucket name
bucket: uploads-11111 # Change into the bucket name you want
Here, uploads-11111
means bucket name
sls deploy
Go to https://s3.console.aws.amazon.com/s3/home, and select the bucket. You will be able to see new bucket name you set in this lambda function
Go to the bucket(https://s3.console.aws.amazon.com/s3/home), create new folder "Incoming". And to test this lambda function, upload a file into the folder.
Go to Cloud watch(https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logs:) Search this lambda function with prefix, ie. "/aws/lambda/file. And then you can see logs for this function.