Skip to content

Instantly share code, notes, and snippets.

@aidansteele
Created October 19, 2021 05:58
Show Gist options
  • Select an option

  • Save aidansteele/76b7660014b174f251989a83d9e27e36 to your computer and use it in GitHub Desktop.

Select an option

Save aidansteele/76b7660014b174f251989a83d9e27e36 to your computer and use it in GitHub Desktop.

Revisions

  1. aidansteele created this gist Oct 19, 2021.
    28 changes: 28 additions & 0 deletions template.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    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