gpt4 book ai didi

amazon-web-services - 创建API网关失败

转载 作者:行者123 更新时间:2023-12-03 07:36:15 25 4
gpt4 key购买 nike

我正在尝试使用授权者和任何方法创建此 API 网关 ( gist )。

我遇到了这个错误:

The following resource(s) failed to create: [BaseLambdaExecutionPolicy, ApiGatewayDeployment]

我已经检查了从其他堆栈传递到此模板的参数,它们是正确的。我已检查此模板,它是有效的。

我的模板是根据这个template修改的与“运行时”:“nodejs8.10”

这与使用 swagger 2 成功创建的堆栈 ( gist ) 相同。我只想将 swagger 2 替换为 AWS::ApiGateway::Method

Update 6 Jun 2019:

我尝试使用 API 网关堆栈的工作版本创建整个嵌套堆栈,然后使用不适用于我从嵌套堆栈获取的参数的模板创建另一个 API 网关,然后我有以下内容:

The REST API doesn't contain any methods (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: ID)

但我确实在模板中指定了 AWS docs 之后的方法:

"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 might try to create Deployment before it creates Method

摘自balaji的回答 here .

这就是我所做的:

"methodANY": {
"Type": "AWS::ApiGateway::Method",
"Properties": {
"AuthorizationType": "COGNITO_USER_POOLS",
...},
"ApiGatewayDeployment": {
"Type": "AWS::ApiGateway::Deployment",
"DependsOn": "methodANY",
...

我还发现了this article on cloudonaut.io by Michael Wittig有帮助。

关于amazon-web-services - 创建API网关失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56467283/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com