AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Globals: Function: Timeout: 3 MemorySize: 128 Parameters: AuthOverride: Default: RequestAuthorizerV2 Type: String AuthHandler: Default: app.auth_handler Type: String AuthSimpleHandler: Default: app.simple_handler Type: String Resources: TestServerlessHttpApi: Type: AWS::Serverless::HttpApi Properties: StageName: http Auth: DefaultAuthorizer: RequestAuthorizerV2 Authorizers: RequestAuthorizerV2: AuthorizerPayloadFormatVersion: "2.0" EnableSimpleResponses: false FunctionArn: !GetAtt AuthorizerFunction.Arn Identity: Headers: - header QueryStrings: - query RequestAuthorizerV1: AuthorizerPayloadFormatVersion: "1.0" EnableSimpleResponses: false FunctionArn: !GetAtt AuthorizerFunction.Arn Identity: Headers: - header QueryStrings: - query RequestAuthorizerV2Simple: AuthorizerPayloadFormatVersion: "2.0" EnableSimpleResponses: true FunctionArn: !GetAtt AuthorizerFunctionSimple.Arn Identity: Headers: - header QueryStrings: - query HelloWorldFunction: Type: AWS::Serverless::Function Properties: CodeUri: ./ Handler: app.lambda_handler Runtime: python3.8 Architectures: - x86_64 Events: ApiEvent: Type: HttpApi Properties: Auth: Authorizer: !Ref AuthOverride Path: /requestauthorizer Method: get ApiId: !Ref TestServerlessHttpApi AuthorizerFunction: Type: AWS::Serverless::Function Properties: CodeUri: ./ Handler: !Ref AuthHandler Runtime: python3.8 Architectures: - x86_64 AuthorizerPermission: Type: AWS::Lambda::Permission Properties: FunctionName: !Ref AuthorizerFunction Action: lambda:InvokeFunction Principal: apigateway.amazonaws.com AuthorizerFunctionSimple: Type: AWS::Serverless::Function Properties: CodeUri: ./ Handler: !Ref AuthSimpleHandler Runtime: python3.8 Architectures: - x86_64 AuthorizerSimplePermission: Type: AWS::Lambda::Permission Properties: FunctionName: !Ref AuthorizerFunctionSimple Action: lambda:InvokeFunction Principal: apigateway.amazonaws.com