Home > database >  cloudformation apigateway missing HTTP Status: Proxy
cloudformation apigateway missing HTTP Status: Proxy

Time:12-09

I am standing up an API Gateway resource using cloudformation, and I noticed that the Method Response field does not contain HTTP Status: Proxy as it does if you create a proxy resource from the console.

My CF code:

  Api:
    Type: AWS::ApiGateway::RestApi
    Properties:
      EndpointConfiguration:
        Types:
          - 'PRIVATE'
      Name: 'why_did_aws_have_to_crash_today_APIG'
  Resource:
    Type: 'AWS::ApiGateway::Resource'
    Properties:
      ParentId: !GetAtt Api.RootResourceId
      PathPart: '{proxy }'
      RestApiId: !Ref Api
  Method:
    Type: 'AWS::ApiGateway::Method'
    Properties:
      RestApiId: !Ref Api
      ResourceId: !Ref Resource
      HttpMethod: ANY
      AuthorizationType: NONE
      Integration:
        IntegrationHttpMethod: ANY
        Type: AWS_PROXY
        Uri: arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:execute-api:us-east-1:why-did-aws-have-to-crash-today/invocations

enter image description here

CodePudding user response:

First, it should be:

IntegrationHttpMethod: POST

From docs:

or Lambda integrations, you must use the HTTP method of POST for the integration request,

Second, if you want to explicitly add MethodResponses, then it should be:

      MethodResponses: 
        - ResponseModels: {"application/json": "Empty"}
          StatusCode: 200    
  • Related