Skip to content

Instantly share code, notes, and snippets.

@aidansteele
Created October 19, 2021 05:58
Show Gist options
  • Save aidansteele/76b7660014b174f251989a83d9e27e36 to your computer and use it in GitHub Desktop.
Save aidansteele/76b7660014b174f251989a83d9e27e36 to your computer and use it in GitHub Desktop.
Transform: AWS::Serverless-2016-10-31
Resources:
Function:
Type: AWS::Serverless::Function
Properties:
Runtime: python3.9
Handler: index.handler
InlineCode: |
import json
import base64
def handler(event, context):
print(json.dumps(event))
if event['isBase64Encoded']:
print(base64.b64decode(event['body']).decode('utf-8'))
else:
print(event['body'])
Events:
DemoApi:
Type: HttpApi
Outputs:
Function:
Value: !Ref Function
Url:
Value: !GetAtt ServerlessHttpApi.ApiEndpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment