1
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.

UnrecognizedClientException: The security token included in the request is invalid. の解決備忘録

Posted at

新年あけましておめでとうございます。
本年も何卒よろしくお願いいたします。

さて、現在インフラの勉強をしている中で遭遇したエラーの解決備忘録になります
今宵もお付き合いいただけますと幸いです

概要

ecspressoを使ってみようと思い、導入する際に...

$ ecspresso init --config config.yml --region ap-northeast-1 --cluster prod-my-app --service prod-my-app

下記のエラーが発生しました

2024/01/02 00:11:05 [ERROR] FAILED. failed to describe service: operation error ECS: DescribeServices, https response error StatusCode: 400, RequestID: request_id_hoge, api error UnrecognizedClientException: The security token included in the request is invalid.

使用環境

  • aws cliを利用中
  • ecs cli未使用
  • terraformは使用できたので、アクセスキーは有効であると考えていた

結論

単純です、エラーメッセージの通りアクセスキーの更新が必要でした

The security token included in the request is invalid.

解決の手順① 新しいアクセスキーの生成

本日はマネジメントコンソール上で新しいアクセスキーを生成しました
こちらをaws cliで対応する手順は本日割愛します

=> 参考情報はこちら
https://docs.aws.amazon.com/ja_jp/cli/latest/userguide/cli-services-iam-create-creds.html

解決の手順② aws configureに上記のアクセスキーを設定する

取得したアクセスキーをaws configureに設定していきます

$ aws configure
AWS Access Key ID [****************ABCD]: 取得したアクセスキー
AWS Secret Access Key [****************Fgih]: 取得したシークレットキー
Default region name [ap-northeast-1]: 
Default output format [json]: 

こちらでaws configureへの設定は完了です

解決の手順③ aws cliの環境変数の設定

特にprofileを指定したaws cliは使用していない前提になりますので
デフォルトの環境変数を更新していきます。

$ export AWS_ACCESS_KEY_ID=取得したアクセスキー
$ export AWS_SECRET_ACCESS_KEY=取得したシークレットキー

こちらで完了です
簡単に解決できて安心しました!

参考情報

aws cliのコマンドを忘れるので、以下のチートシートを毎度拝見しております
大変助かっております、ありがとうございますm(_ _)m

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