Skip to content

Instantly share code, notes, and snippets.

@aidansteele
Created July 20, 2021 00:51
Show Gist options
  • Save aidansteele/bd5c3b6a8e950a5b0e20c81f0bda76db to your computer and use it in GitHub Desktop.
Save aidansteele/bd5c3b6a8e950a5b0e20c81f0bda76db to your computer and use it in GitHub Desktop.
example http api gw w/ iam auth
Transform: AWS::Serverless-2016-10-31
Resources:
Function:
Type: AWS::Serverless::Function
Properties:
Runtime: python3.8
Handler: index.handler
InlineCode: |
def handler(a, b):
return {"hello": "world"}
Events:
Example:
Type: HttpApi
Properties:
ApiId: !Ref Api
Api:
Type: AWS::ApiGatewayV2::Api
Properties:
Name: myapi
ProtocolType: HTTP
Target: !GetAtt Function.Arn
Overrides:
Type: AWS::ApiGatewayV2::ApiGatewayManagedOverrides
Properties:
ApiId: !Ref Api
Route:
AuthorizationType: AWS_IAM
Outputs:
Url:
Value: !GetAtt Api.ApiEndpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment