##悩まされたエラー文
An error occurred (InvalidAccessKeyId) when calling the ListBuckets operation: The AWS Access Key Id you provided does not exist in our records.
##経緯
- AWS CLIをインストールし
aws configure
で初期設定をしました。
AWS Access Key ID [None]: ******
AWS Secret Access Key [None]: ******
Default region name [None]: ap-notheast-1
Default output format [None]: json
-
aws s3 ls
でアクセスできるか確認したところ、アクセスできなかったため修正方法を確認(リージョン名の綴りを間違えてましたap-notheast-1ではなくap-northeast-1)このリージョン間違いが悪夢の始まり
-
上記サイトを参考に
rm -r .aws
を実行 -
再度IAMでアクセスキーを作成しコピペ、リージョン名もコピペ
-
全部あってるはずなのにアクセスキーが無いというエラーが出る(2、3時間公式のドキュメント見たりバージョン違いかと思ってインストールし直したり…
rm -r .aws
とアクセスキー作成10回ほどやりました…笑) -
aws configure list
で登録されてる内容確認
% aws configure list
Name Value Type Location
---- ----- ---- --------
profile <not set> None None
access_key ****************3JQ7 env
secret_key ****************vnOS env
region ap-northeast-1 config-file ~/.aws/config
access_keyとsecret_keyが直前に設定したものと違うことに気づく
Locationも公式のドキュメントで見たものと違うようでどこに保存されてるかわからない…
どなたかわかる方いらっしゃいましたらコメントお願いします。
##今回のエラー解決?
- 初期設定の
aws configure
をaws configure --profile ユーザー名
で作成
% aws configure --profile ユーザー名
AWS Access Key ID [None]: ******
AWS Secret Access Key [None]: ******
Default region name [None]: ap-northeast-1
Default output format [None]: json
-
aws --profile ユーザー名 s3 ls
でアクセスできた!
% aws --profile ユーザー名 s3 ls
2021-03-21 13:26:25 ******
2021-03-21 13:24:15 ******
2021-03-21 13:31:26 ******
2021-03-20 14:31:04 ******
##解決に至った参考資料
##補足
% aws configure list
Name Value Type Location
---- ----- ---- --------
profile <not set> None None
access_key ****************3JQ7 env
secret_key ****************vnOS env
region <not set> None None
% aws configure list --profile ユーザー名
Name Value Type Location
---- ----- ---- --------
profile ユーザー名 manual --profile
access_key ****************FAFS shared-credentials-file
secret_key ****************Zf7u shared-credentials-file
region ap-northeast-1 config-file ~/.aws/config
解決後確認してみたらこのようになってました。後々解決できればと思ってます。