amazon-cloudformation - CloudFormation 部署 ApiGateway 方法从 rootresource 继承 AWS_IAM
问题描述
我一直在使用 ApiGateway、Lambda 等资源构建更大的 CloudFormation 堆栈。
对于最新的 ApiGateway,我将 AWS::ApiGateway::Methods 直接放在 / (rootresourceid) 上,当从 CloudFormation 部署时,AWS::ApiGateway::Stage 上的授权者将变为 AWS_IAM,尽管我设置了自定义在方法上授权并使用 DependsOn 让资源等待。
Post:
DependsOn:
- AuthorizerApi
Type: AWS::ApiGateway::Method
Properties:
AuthorizationType: CUSTOM
AuthorizerId: !Ref AuthorizerApi
RestApiId: !Ref Api
ResourceId: !GetAtt Api.RootResourceId
HttpMethod: POST
Integration:
Type: AWS_PROXY
IntegrationHttpMethod: POST
Uri: !Join ['', ["arn:aws:apigateway:", !Ref "AWS::Region", ":lambda:path/2015-03-31/functions/", !GetAtt PostLambda.Outputs.FunctionGetAtt, ":${stageVariables.environment}/invocations"]]
MethodResponses:
- ResponseModels:
application/json: Empty
StatusCode: 200
有趣的是,这不是rootresource下资源的问题,所以看起来是继承问题。
其他任何经历过这种情况的人,如果要求不是根目录下的路径,解决方案是什么?
解决方案
推荐阅读
- css - 如何修复“没有这样的文件或目录,lstat 'scss/'”?
- activerecord - Yii ActiveRecord 的 children() 和 parent() 方法是什么?
- javascript - 要创建一个页面,然后获取数据并将其存储在 java 脚本对象中,然后使用 HTTPPOST 将数据发送到 .Net
- python-3.x - '.join()' 如何在下面的 Python 代码中工作
- java - 以表格格式在jsp中显示来自servlet的arraylist值
- veins - 我怎样才能让我的邻居处于静脉中并计算其与邻居相比的方向?
- javascript - 如何修复:react-redux 中的“e 不是函数”错误
- php - Symfony - Twig - 修改或删除资源并返回页面的超文本链接
- python - 批量加载庞大的数据集以训练 pytorch
- c - 为什么我的首字母缩写词查找实用程序出奇地慢?