Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sample Python 3.7 AWS Lambda SAM template.
import json
def handler(event, context):
body = {
"message": "World",
"input": event
}
response = {
"statusCode": 200,
"body": json.dumps(body)
}
return response
# Use this code if you don't use the http event with the LAMBDA-PROXY
# integration
"""
return {
"message": "Go Serverless v1.0! Your function executed successfully!",
"event": event
}
"""
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: >-
Image Processor with SAM and AWS Lambda
Resources:
ImageProcessorHello:
Type: 'AWS::Serverless::Function'
Properties:
Handler: world.handler
Runtime: python3.7
CodeUri: hello
Description: >-
Trying AWS Lambda for the first time
MemorySize: 128
Timeout: 3
Events:
http:
Type: Api
Properties:
Path: /hello
Method: GET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment