[英]How to use aws role arn in cdk deploy command
我正在嘗試使用 aws cdk 部署我的雲形成堆棧。 我想使用不同的 IAM 角色來部署我的堆棧,因為該角色在 aws 賬戶中擁有更多權限。 這是我正在嘗試的
cdk deploy -r arn:aws:iam::1234567890:role/AWSCloudFormationStackSetExecutionRole
但我得到以下錯誤
No stack found matching '–r'. Use "list" to print manifest
有人可以幫我在這里做錯什么嗎?
該錯誤表明您的 cdk cli 版本將-r
視為堆棧,因此我認為這取決於您的 cdk 版本
我的cdk版本:
cdk --version
1.94.1 (build 60d8f91)
它適用於選項-r
cdk deploy -r arn:aws:iam::123456789012:role/gitlab-runner
test-sqs: deploying...
test-sqs: creating CloudFormation changeset...
在這里,您需要將-r (或--role-name )選項應用於 cdk 本身(而不是部署選項):
cdk --role-arn arn:aws:iam::1234567890:role/MY_ROLE_NAME deploy
cdk將生成一個 Cloud Formation 模板並使用您指定的角色進行部署。
與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]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.