cloudformation apigateway 缺少 HTTP 状态:代理

cloudformation apigateway missing HTTP Status: Proxy

我正在使用 cloudformation 建立一个 API 网关资源,我注意到 Method Response 字段不包含 HTTP Status: Proxy,就像您从控制台创建代理资源时那样。

我的CF码:

  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

首先应该是:

IntegrationHttpMethod: POST

来自docs

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

其次,如果要显式添加MethodResponses,那么应该是:

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