我们正在开发一个多账户CDK应用程序,并在CodeBuild上进行持续部署。我们意识到CDK 身份验证问题,因此我们使用$ aws sts assume-role并设置环境变量来在$ cdk deploy. 这种方式适用于$ cdk deploy,但$ cdk bootstrap不适用于。 $ cdk bootstrap尝试引导每个帐户并需要多个帐户凭据。有没有简单的方法可以提供多个帐户凭据$ cdk bootstrap?(实现自定义插件并不“简单”...)否则,有什么方法可以引导单个帐户吗?
# with 111111111111 account credential\n$ cdk bootstrap --execute=false\n \xe2\x8f\xb3 Bootstrapping environment aws://111111111111/us-east-1...\n \xe2\x8f\xb3 Bootstrapping environment aws://222222222222/us-east-1...\n \xe2\x9d\x8c Environment aws://222222222222/us-east-1 failed bootstrapping: Error: Need to perform AWS calls for account 222222222222, but no credentials found. Tried: default credentials.\nRun Code Online (Sandbox Code Playgroud)\n\n# with 111111111111 account credential\n$ cdk bootstrap --execute=false\n \xe2\x8f\xb3 Bootstrapping environment aws://111111111111/us-east-1...\n \xe2\x8f\xb3 Bootstrapping environment aws://222222222222/us-east-1...\n \xe2\x9d\x8c Environment aws://222222222222/us-east-1 failed bootstrapping: Error: Need to perform AWS calls for account 222222222222, but no credentials found. Tried: default credentials.\nRun Code Online (Sandbox Code Playgroud)\n
Vik*_*yol 10
您可以将环境作为参数传递给cdk bootstrap命令。
cdk 引导程序 [环境..]
cdk bootstrap aws://111111111111/us-east-1
Run Code Online (Sandbox Code Playgroud)
因此,就您的情况而言,您必须在运行每个引导命令之前切换帐户,就像部署一样。
aws sts assume-role ...
ACCOUNT=$(aws sts get-caller-identity --query Account --output text)
REGION=$(aws configure get region)
cdk bootstrap aws://$ACCOUNT/$REGION
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5894 次 |
| 最近记录: |