guide to work with aws lambdas and it best practices
sam init --runtime python3.7 --dependency-manager pip --app-template hello-world --name sample_lambda
# Generate the event that S3 sends to your Lambda function when a new object is uploaded
sam local generate-event s3 [put/delete]
# Generate the event that SQS sends to your Lambda function when something is sended to the queue
sam local generate-event sqs [put/delete]
{
"MyFunction1": {
"TABLE_NAME": "localtable",
"BUCKET_NAME": "testBucket"
},
"MyFunction2": {
"TABLE_NAME": "localtable",
"STAGE": "dev"
},
}
# To build on your workstation, run this command in folder containing SAM template. Built artifacts will be written to .aws-sam/build folder
sam build
# To build inside a AWS Lambda like Docker container
sam build --use-container
sam local invoke --event events/event.json --env-vars local.env.json
sam local start-api --env-vars local.env.json
sam validate template.yml
sam package --template-file template.yml --output-template-file package.yml
# To publish an application
sam publish --template packaged.yaml --region us-east-1
sam deploy --guided