AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Globals: Api: BinaryMediaTypes: # These are equivalent to image/gif and image/png when deployed - image~1png Resources: MyApi: Type: AWS::Serverless::Api Properties: StageName: dev Variables: VarName: varValue Cors: AllowOrigin: "'*''" AllowMethods: "'GET'" AllowHeaders: "'origin, x-requested-with'" AllowCredentials: "'true'" MaxAge: "'510'" DefinitionBody: swagger: "2.0" info: title: Ref: AWS::StackName "x-amazon-apigateway-binary-media-types": - image/gif paths: "/functionwithnoapievent": get: x-amazon-apigateway-integration: httpMethod: POST type: aws_proxy uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${NoApiEventFunction.Arn}/invocations responses: {} "/anyandall": x-amazon-apigateway-any-method: x-amazon-apigateway-integration: httpMethod: POST type: aws_proxy uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MyLambdaFunction.Arn}/invocations responses: {} "/nonsensitiveanyandall": x-amazon-apigateway-any-method: x-amazon-apigateway-integration: httpMethod: POST type: AWS_PROXY uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MyLambdaFunction.Arn}/invocations responses: { } "/nonserverlessfunction": get: x-amazon-apigateway-integration: httpMethod: POST type: aws_proxy uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MyNonServerlessLambdaFunction.Arn}/invocations "/nofunctionfound": get: x-amazon-apigateway-integration: httpMethod: POST type: aws_proxy uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${WhatFunction.Arn}/invocations "/base64response": get: x-amazon-apigateway-integration: httpMethod: POST type: aws_proxy uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${Base64ResponseFunction.Arn}/invocations "/nondecodedbase64response": get: x-amazon-apigateway-integration: httpMethod: POST type: aws_proxy uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${Base64ResponseFunctionWithFalseIsBase64EncodedField.Arn}/invocations "/decodedbase64responsebas64encoded": get: x-amazon-apigateway-integration: httpMethod: POST type: aws_proxy uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${Base64ResponseFunctionWithTrueBase64EncodedField.Arn}/invocations "/decodedbase64responsebas64encodedpriority": get: x-amazon-apigateway-integration: httpMethod: POST type: aws_proxy uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${Base64ResponseFunctionWithBase64EncodedFieldPriority.Arn}/invocations "/echobase64eventbody": post: x-amazon-apigateway-integration: httpMethod: POST type: aws_proxy uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${EchoBase64EventBodyFunction.Arn}/invocations "/echoeventbody": post: x-amazon-apigateway-integration: httpMethod: POST type: aws_proxy uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${EchoEventHandlerFunction.Arn}/invocations MyLambdaFunction: Type: AWS::Serverless::Function Properties: Handler: main.handler Runtime: python3.9 CodeUri: . Timeout: 600 Events: GetApi: Type: Api Properties: Path: /get Method: GET RestApiId: Ref: MyApi NoApiEventFunction: Type: AWS::Serverless::Function Properties: Handler: main.handler Runtime: python3.9 CodeUri: . Timeout: 600 MyNonServerlessLambdaFunction: Type: AWS::Lambda::Function Properties: Handler: main.handler Runtime: python3.9 CodeUri: . Timeout: 600 Base64ResponseFunction: Type: AWS::Serverless::Function Properties: Handler: main.base64_response Runtime: python3.9 CodeUri: . Timeout: 600 Base64ResponseFunctionWithFalseIsBase64EncodedField: Type: AWS::Serverless::Function Properties: Handler: main.base64_with_False_isBase64Encoded_response Runtime: python3.9 CodeUri: . Timeout: 600 Base64ResponseFunctionWithTrueBase64EncodedField: Type: AWS::Serverless::Function Properties: Handler: main.base64_with_True_Base64Encoded_response Runtime: python3.9 CodeUri: . Timeout: 600 Base64ResponseFunctionWithBase64EncodedFieldPriority: Type: AWS::Serverless::Function Properties: Handler: main.base64_with_Base64Encoded_priority_response Runtime: python3.9 CodeUri: . Timeout: 600 EchoBase64EventBodyFunction: Type: AWS::Serverless::Function Properties: Handler: main.echo_base64_event_body Runtime: python3.9 CodeUri: . Timeout: 600 EchoEventHandlerFunction: Type: AWS::Serverless::Function Properties: Handler: main.echo_event_handler Runtime: python3.9 CodeUri: . Timeout: 600 Events: GetApi: Type: Api Properties: Path: /{proxy+} Method: GET RestApiId: Ref: MyApi