CDK Bootstrap
使用AWS CDK设置虚拟环境后,我尝试使用该命令。这是上面的命令从中提取凭据的应用程序代码。
#!/usr/bin/env python3
from aws_cdk import core
from hello.hello_stack import MyStack
app = core.App()
MyStack(app, "hello-cdk-1", env={'account':'IDHERE','region': 'us-east-2'})
MyStack(app, "hello-cdk-2", env={'account':'IDHERE','region': 'us-west-2'})
app.synth()
显然我已经取出accountID。当使用命令CDK Bootstrap时,这是我的错误输出
❌ Environment aws://ACCOUNTIDHERE/us-west-2 failed bootstrapping: Error: Need to perform AWS calls for account ACCOUNTIDHERE, but no credentials found. Tried: default credentials.
at CredentialsCache.getCredentials (/usr/local/lib/node_modules/aws-cdk/lib/api/util/sdk.ts:261:11)
at CredentialsCache.get (/usr/local/lib/node_modules/aws-cdk/lib/api/util/sdk.ts:223:25)
at SDK.cloudFormation (/usr/local/lib/node_modules/aws-cdk/lib/api/util/sdk.ts:117:20)
at Object.deployStack (/usr/local/lib/node_modules/aws-cdk/lib/api/deploy-stack.ts:56:15)
at Object.bootstrapEnvironment (/usr/local/lib/node_modules/aws-cdk/lib/api/bootstrap-environment.ts:93:10)
at /usr/local/lib/node_modules/aws-cdk/bin/cdk.ts:270:24
at async Promise.all (index 1)
Need to perform AWS calls for account ACCOUNTIDHERE, but no credentials found. Tried: default credentials.
只需尝试使用环境变量即可使用: AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
这个对我有用。
我正在使用cdk版本 1.57.0
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句