Skip to content

Instantly share code, notes, and snippets.

@colindjk
Last active March 17, 2021 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colindjk/25b030c05e795fa5b3deee3d8b8c9b84 to your computer and use it in GitHub Desktop.
Save colindjk/25b030c05e795fa5b3deee3d8b8c9b84 to your computer and use it in GitHub Desktop.
# Example config where two `Function`s use the same underlying function
# but will have different results based on parameters.
# `function handler(event, context)`
Globals:
# Definitions used by all `AWS::Serverless::Function`s.
Function:
Runtime: nodejs12.x
Timeout: 180
# Directory where the callable function is stored.
CodeUri: src/
# The callback function which takes two parameters (event, context).
Handler: index.handler
Environment:
Variables:
TABLE_NAME: data-table
# Resources can be anything (Functions, Api, HttpApi, LayerVersion etc.)
Resources:
HelloWorldFunction:
# This will by default use `index.handler` as it's calling function.
Type: AWS::Serverless::Function
Properties:
Environment:
Variables:
MESSAGE: "Hello From SAM"
# Handles the "Thumbnail" event.
ThumbnailFunction:
# This will by default use `index.handler` as it's calling function.
Type: AWS::Serverless::Function
Properties:
Events:
Thumbnail: # Arbitrary name for event. Useful for code-gen.
Type: Api
Properties:
Path: /thumbnail
Method: POST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment