aws sts get-caller-identity コマンドを実行した際に下記エラーが発生しました。
An error occurred (ExpiredToken) when calling the GetCallerIdentity operation: The security token included in the request is expired
こちらはその際の対応方法についてのメモ書きです。
解決方法
--profileオプションを使用して/Users/[ユーザ名]/.aws/configに設定しているprofileのhogeを設定すると上手く動作しました。
$ aws sts get-caller-identity --profile hoge
"UserId": "xxxxxxxxxxxxxxxxxx",
"Account": "11111111111111",
"Arn": "arn:aws:sts::1111111111:xxxxxxxxx/XXXXX/XXXXX-11111111"
--profileに設定した値はコマンド実行時のみ環境変数AWS_PROFILEに設定されます。
いちいち--profileを指定するのが面倒な場合は下記のように環境変数を設定することができます。 マニュアル
$ export AWS_PROFILE=hoge