Last active
May 12, 2023 14:44
-
-
Save tomfa/22f2a1f7567377d6fbfcd5ce5106642d to your computer and use it in GitHub Desktop.
AWS Lambda: Python Hello World HTTP API
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
# This file is your Lambda function | |
import json | |
def mirror_query_strings(event, context): | |
body = { | |
"queryStrings": event['queryStringParameters'] | |
} | |
return { | |
"statusCode": 200, | |
"body": json.dumps(body) | |
} |
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
# This file will generate an API endpoint for your handler, | |
# using serverless (see www.serverless.com) | |
# | |
# For full config options, check the docs: | |
# docs.serverless.com | |
# | |
service: hello-world-functions | |
provider: | |
name: aws | |
runtime: python3.6 | |
region: eu-central-1 | |
functions: | |
helloworld: | |
handler: handler.mirror_query_strings | |
events: | |
- http: | |
path: helloworld/mirror_query_strings | |
method: get | |
cors: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment