LoginSignup
1
3

More than 3 years have passed since last update.

「Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment」の解決

Posted at

cdk deployを実行して「Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment」のエラーが発生した場合の解決策の一つとして記載します。

前提条件

  • Ubuntu 18.04.4 LTS(WSLの利用)

cdk deploy --profile xxx を実行すると Unable to resolve~エラー

$ cdk deploy --profile xxx
Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment
  • ~/.aws/configを確認する
~/.aws/config
$ cat ~/.aws/config 
[profile xxx]
region = ap-northeast-1
[default]
region = ap-northeast-1
[xxx]
region = ap-northeast-1
  • [profile xxx]を削除する
~/.aws/config
$ cat ~/.aws/config 
[default]
region = ap-northeast-1
[xxx]
region = ap-northeast-1
  • cdk deployの再実行
$ cdk deploy --profile xxx
CdkXXXXXXXStack: deploying...
CdkXXXXXXXStack: creating CloudFormation changeset...
[██████████████████████████████████████████████████████████] (3/3)

 ✅  CdkDynamodbStack

Stack ARN:
arn:aws:cloudformation:ap-northeast-1:XXXXXXXXXXXX:stack/CdkXXXXXXXStack/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

解決

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3