Skip to content

Instantly share code, notes, and snippets.

@tomfa
Last active May 12, 2023 14:44
Show Gist options
  • Save tomfa/22f2a1f7567377d6fbfcd5ce5106642d to your computer and use it in GitHub Desktop.
Save tomfa/22f2a1f7567377d6fbfcd5ce5106642d to your computer and use it in GitHub Desktop.
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