如何在 cdk 部署命令中使用 aws 角色 arn

Dhi*_*raj 6 amazon-web-services aws-cdk

我正在尝试使用 aws cdk 部署我的云形成堆栈。\n我想使用不同的 IAM 角色来部署我的堆栈,因为该角色在 aws 账户中拥有更多权限。\n这就是我正在尝试的

\n\n
cdk deploy -r arn:aws:iam::1234567890:role/AWSCloudFormationStackSetExecutionRole\n
Run Code Online (Sandbox Code Playgroud)\n\n

但我遇到了以下错误

\n\n
No stack found matching \'\xe2\x80\x93r\'. Use "list" to print manifest\n
Run Code Online (Sandbox Code Playgroud)\n\n

有人可以帮助我我在这里做错了什么吗?

\n

mon*_*mon -2

cdk deploy一样,没有 -r 这样的选项。CDK认为这是一个CDK堆栈名称。

我相信您需要使用具有不同 IAM 权限的不同 IAM 角色。这与CDK本身无关。您需要先担任角色并获得 STS 令牌。请研究担任 STS 的 AWS CLI 角色。

cdk deploy [STACKS..]

Deploys the stack(s) named STACKS into your AWS account

Options:

  --build-exclude, -E    Do not rebuild asset with the given ID. Can be

                         specified multiple times.         [array] [default: []]



  --exclusively, -e      Only deploy requested stacks, don't include

                         dependencies                                  [boolean]



  --require-approval     What security-sensitive changes need manual approval

                         [string] [choices: "never", "any-change", "broadening"]



  --ci                   Force CI detection (deprecated)

                                                      [boolean] [default: false]



  --notification-arns    ARNs of SNS topics that CloudFormation will notify with

                         stack related events                            [array]



  --tags, -t             Tags to add to the stack (KEY=VALUE)            [array]



  --execute              Whether to execute ChangeSet (--no-execute will NOT

                         execute the ChangeSet)        [boolean] [default: true]



  --force, -f            Always deploy stack even if templates are identical

                                                      [boolean] [default: false]



  --parameters           Additional parameters passed to CloudFormation at

                         deploy time (STACK:KEY=VALUE)     [array] [default: {}]



  --outputs-file, -O     Path to file where stack outputs will be written as

                         JSON                                           [string]



  --previous-parameters  Use previous values for existing parameters (you must

                         specify all parameters on every deployment if this is

                         disabled)                     [boolean] [default: true]
Run Code Online (Sandbox Code Playgroud)