Skip to content

Instantly share code, notes, and snippets.

@jahe
Last active March 14, 2022 08:16
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save jahe/3ed17705d8be1beaa4037519866d1fb7 to your computer and use it in GitHub Desktop.
Save jahe/3ed17705d8be1beaa4037519866d1fb7 to your computer and use it in GitHub Desktop.
Serverless Cheatsheet
# Create a serverless project for Node.js within AWS Lambda
serverless create --template aws-nodejs
# Create AWS credentials file in ~/.aws
serverless config credentials --provider aws --key <access-key-id> --secret <secret> --profile <profilename>
# Deploy functions from serverless.yml to AWS Lambda
sls deploy
# Invoke function
sls invoke -f <function-name-in-serverless.yml>
# Show logs of a function
serverless logs -f <function-name-in-serverless.yml>
# Tail logs of a function
serverless logs -f <function-name-in-serverless.yml> --tail
# Sample config for an Alexa AWS function
service: serverless-alexa-aws-test # resulting function name in AWS Lambda
provider:
name: aws
runtime: nodejs6.10
stage: dev
region: eu-west-1 # Ireland
profile: my-aws-credentials-profile
functions:
alexatestskill:
handler: handler.alexatestskill
events:
- alexaSkill
package:
exclude:
- node_modules/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment