[英]Failed to create API Gateway
我正在尝试使用Authorizer和ANY方法创建此API网关( gist )。
我遇到这个错误:
The following resource(s) failed to create: [BaseLambdaExecutionPolicy, ApiGatewayDeployment]
我检查了从其他堆栈传递到此模板的参数,它们是正确的。 我已经检查了此模板,它是有效的。
我的模板是使用"Runtime": "nodejs8.10"
从该模板修改而来的。
这是使用swagger 2
成功创建的同一堆栈( 要点 )。 我只想用AWS::ApiGateway::Method
替换swagger 2
。
2019年6月6日更新:
我尝试使用API网关堆栈的工作版本创建整个嵌套堆栈,然后使用与该嵌套堆栈中获取的参数不兼容的模板创建另一个API网关,然后得到以下信息:
The REST API doesn't contain any methods (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: ID)
但是我确实在AWS文档之后的模板中指定了该方法:
"GatewayMethod": {
"Type" : "AWS::ApiGateway::Method",
"DependsOn": ["LambdaRole", "ApiGateway"],
"Properties" : {
"ApiKeyRequired" : false,
"AuthorizationType" : "Cognito",
"HttpMethod" : "ANY",
"Integration" : {
"IntegrationHttpMethod" : "ANY",
"Type" : "AWS",
"Uri" : {
"Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${LambdaFunction.Arn}/invocations"
}
},
"MethodResponses" : [{
"ResponseModels": {
"application/json": "Empty"
},
"StatusCode": 200
}],
"RequestModels" : {"application/json": "Empty"},
"ResourceId" : {
"Fn::GetAtt": ["ApiGateway", "RootResourceId"]
},
"RestApiId" : {
"Ref": "ApiGateway"
}
}
},
感谢@John的建议。 我试图用有效的版本创建嵌套堆栈,并为无效的版本传递参数。
该错误的原因是:
CloudFormation可能在创建Method之前尝试创建Deployment
从巴拉吉 在这里的答案。
这就是我所做的:
"methodANY": {
"Type": "AWS::ApiGateway::Method",
"Properties": {
"AuthorizationType": "COGNITO_USER_POOLS",
...},
"ApiGatewayDeployment": {
"Type": "AWS::ApiGateway::Deployment",
"DependsOn": "methodANY",
...
我还发现Michael Wittig在cloudonaut.io上的这篇文章很有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.