3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Unable to resolve AWS account to use. ~ がでた時の対処法

Posted at

Unable to resolve AWS account to use. ~ がでた時の対処法

環境

SiroUz simple-app % cdk doctor
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!                                                                                  !!
!!  This software has not been tested with node v17.3.0.                            !!
!!  You may to encounter runtime issues, and should switch to a supported release.  !!
!!                                                                                  !!
!!  As of the current release, supported versions of node are:                      !!
!!  - ^12.7.0                                                                       !!
!!  - ^14.5.0                                                                       !!
!!  - ^16.3.0                                                                       !!
!!                                                                                  !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ℹ️ CDK Version: 2.3.0 (build beaa5b2)
ℹ️ AWS environment variables:
  - AWS_ACCESS_KEY_ID = ASIA<redacted>
  - AWS_SECRET_ACCESS_KEY = <redacted>
  - AWS_SESSION_TOKEN = <redacted>
  - AWS_STS_REGIONAL_ENDPOINTS = regional
  - AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
  - AWS_SDK_LOAD_CONFIG = 1
ℹ️ No CDK environment variables

事象

以下の記事を参考にして、AWS_ACCESS_KEY, AWS_SECRET_KEY, AWS_SESSION_TOKENを設定した上で、cdk bootstrapを実行した結果、タイトル通りのエラーが出た。
https://qiita.com/ShiroUz/items/1827e026c12d2ce3334b

Unable to resolve AWS account to use. It must be either configured when you define your CDK Stack, or through the environment

対処法

上記、参考記事とは別に、AWS_DEFAULT_REGIONを環境変数に設定し、cdk bootstrap実行時に、どこにデプロイすれば良いのかを指定することで回避できた。
具体的には以下。

ShiroUz simple-app % export AWS_DEFAULT_REGION=us-east-1
ShiroUz simple-app % cdk bootstrap aws://ACCOUNT_ID/REGION

ACCOUNT_ID: 自分で所有しているAWSのACCOUNT IDを入力する。マネージメントコンソールで確認できる。
REGION: AWS_DEFAULT_REGIONで設定したリージョンを入力する。

原因分析

おそらくbootstrap実行時に、regionの選択が必要なのと、そのリージョンのデフォルト設定であるAWS_DEFAULT_REGIONの設定がされていなかったから通らなかったのだと思っています。

3
0
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
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?