Created
December 6, 2018 17:43
-
-
Save palanglung/0c50dae6d03e1b9f6b795db837b600cc to your computer and use it in GitHub Desktop.
Sample Python 3.7 AWS Lambda SAM template.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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