在部署CloudFormation堆栈时获取以下信息:
REST API不包含任何方法(服务:AmazonApiGateway; 状态码:400;错误代码:BadRequestException;要求编号: d527f56e-a1e1-11e9-a0a4-af7563b2b15a)
该堆栈具有一个由具有单个资源和方法的API触发的Lambda:
FailureReporting:
Type: "AWS::ApiGateway::RestApi"
DependsOn: "MyLambdaFunction"
Properties:
Name: "FailureReporting"
FailOnWarnings: true
FailureReportingDeployment:
Type: AWS::ApiGateway::Deployment
Properties:
RestApiId:
Ref: "FailureReporting"
Description: "Production environment supporting version-1 of the interface."
StageName: "v1"
Failures:
Type: "AWS::ApiGateway::Resource"
Properties:
RestApiId: !Ref "FailureReporting"
ParentId: !GetAtt ["FailureReporting", "RootResourceId"]
PathPart: "failures"
FailuresMethodGet:
Type: "AWS::ApiGateway::Method"
Properties:
RestApiId: !Ref "FailureReporting"
ResourceId: !Ref "Failures"
HttpMethod: "GET"
AuthorizationType: "NONE"
MethodResponses:
- StatusCode: "200"
Integration:
IntegrationHttpMethod: "POST"
Type: "AWS_PROXY"
IntegrationResponses:
- StatusCode: "200"
Credentials: !GetAtt [ 3FailureReportingExecuteAPI, Arn ]
Uri: !Sub
- "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${lambdaArn}/invocations"
- lambdaArn: !GetAtt [ GetFailureKeysByOrderNumber, Arn ]
我想念我的位置。
答案 0 :(得分:2)
放入Description
部署资源:
DependsOn
这不直观。埋在the docs中,您会发现以下内容:
如果您创建AWS :: ApiGateway :: RestApi资源及其方法 (使用AWS :: ApiGateway :: Method)与您的模板位于同一模板中 部署,部署必须取决于RestApi的方法。至 创建依赖项,然后将DependsOn属性添加到部署中。如果 您没有,AWS CloudFormation会在部署之后立即创建部署 创建不包含任何方法的RestApi资源,然后使用AWS CloudFormation遇到以下错误:REST API没有 包含任何方法。