amazon-web-services - 资源 arn:aws:cloudformation:us-east-1:aws:transform 的权限问题
问题描述
我正在尝试使用 swagger 扩展将 swagger 与 api 网关和 lambda 集成。Swagger 文件上传到 S3 存储桶中,我使用带有变换的 Body 并包括如下
在 AWS::ApiGateway::RestApi 属性中使用 BodyS3Location 会返回错误 Unable to parse API definition because of a malformed integration for the same integration 我提到了 Swagger 文件,其中 AWS Extensions 存储在 S3 Bucket 中,用于使用 Cloudformation 创建 API。
并为 AWS::ApiGateway::RestApi 属性修改了如下模板
Body:
Fn::Transform:
Name: AWS::Include
Parameters:
Location:
Fn::Sub: "s3://${BucketName}/apiSwaggerSpec.yaml"
对于上面的堆栈,我拥有 cloudformation 操作的所有权限
下面的代码我已经添加为招摇扩展。
x-amazon-apigateway-auth:
type: "aws_iam"
x-amazon-apigateway-integration:
type: "aws_proxy"
httpMethod: "POST"
passthroughBehavior: "when_no_match"
uri:
Fn::Sub: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:${accountId}:function:testLambdaFunction/invocations"
credentials:
Fn::Sub: "arn:aws:iam::${accountId}:role/${myRole}"
responses:
default:
statusCode: 200
由于 myrole 无权在资源上执行 cloudformation:CreateChangeSet:arn:aws:cloudformation:us-east-1:aws:transform/include,我收到了权限被拒绝错误消息
我是否需要为转换/包含添加特殊权限。aws 文档说它不需要特殊权限?
解决方案
我遇到了同样的问题,这个问题是我在搜索时能找到的唯一有意义的结果。尽管 AWS 声称相反,但似乎确实需要许可,但错误消息所抱怨的似乎是唯一的一个;之后,包含转换似乎起作用了。这是我添加的整个策略:
PolicyDocument:
Version: "2012-10-17"
Statement:
- # The AWS::Include transform requires this weird permission.
Sid: UseInclude
Effect: "Allow"
Action: "cloudformation:CreateChangeSet"
Resource: !Sub "arn:aws:cloudformation:${AWS::Region}:aws:transform/Include"
推荐阅读
- android - React Native 设置了一个可以触发一些代码的警报
- angular - Okta 用户 api 抛出请求正文格式不正确
- c++ - 我想在主类中输入数据(10 个玩家和分数),如何调用 void “ScoresList::add(const GameEntry& e)”?
- c++ - 指向数组的指针和对数组的引用之间的区别
- python - python Counter 是否预期行为如下?
- javascript - javascript fetch 响应 403 错误
- r - 如何以时间为 x 轴使用 geom_col
- python - RPLIDAR A1 没有像 python 预期的那样快速采样
- facebook - 通过 instagram api 发布的问题
- xml - Odoo14:安装自定义模块后更新基本模块时出错