Skip to content

Instantly share code, notes, and snippets.

@tomfa
Last active May 12, 2023 14:44
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
AWS Lambda: Python Hello World HTTP API
# 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 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