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

aws cdk bootstrapでEnvironment aws://xxxxxxxx/ap-northeast-1 failed bootstrapping: _AuthenticationError: Need to perform AWS calls for account xxxxxxxx, but the current credentials are for 000000000000

Last updated at Posted at 2025-03-23

AWS CDK Bootstrap で AuthenticationError が発生する場合の対処法

問題

aws CLI用のIAMユーザーを作成しており、そのユーザーのアクセスキーを正しく設定したはずなのにcdk bootstrap を実行した際に、以下のエラーが発生することがある。

❌  Environment aws://xxxxxxxx/ap-northeast-1 failed bootstrapping: _AuthenticationError: Need to perform AWS calls for account xxxxxxxx, but the current credentials are for 000000000000

このエラーは、設定されている AWS 認証情報が正しいアカウントのものではない場合に発生する。

解決策

1. AWS アクセスキーの再作成

誤った認証情報が使用されている可能性があるため、新しいアクセスキーを作成する。

2. AWS CLI の認証情報を更新

新しいアクセスキーを使用して aws configure を実行し、AWS CLI の認証情報を更新する。

aws configure

以下の情報を入力する。

AWS Access Key ID [None]: 新しいアクセスキーID
AWS Secret Access Key [None]: 新しいシークレットアクセスキー
Default region name [None]: ap-northeast-1
Default output format [None]: json

3. 設定の確認

正しく認証情報が設定されているか確認するために、次のコマンドを実行する。

aws sts get-caller-identity

正しい Account ID が表示されていることを確認する。

{
    "UserId": "XXXXXXXXXXXXXXX",
    "Account": "xxxxxxxxxxxx",
    "Arn": "arn:aws:iam::xxxxxxxxxxxx:user/your-user"
}

4. CDK Bootstrap の再実行

認証情報が正しく設定されたら、改めて cdk bootstrap を実行する。

cdk bootstrap

問題が解決し、正常にブートストラップが完了するはず。

まとめ

  1. AWS アクセスキーを再作成
  2. aws configure を使って新しい認証情報を設定
  3. aws sts get-caller-identity で認証情報を確認
  4. cdk bootstrap を再実行

ローカル用に動かしていたLocalStackが原因?もしくはcdklocalが悪さをしていたかもしれない。

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