iTranslated by AI
The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🔐
Error when managing AWS CLI access keys with 1Password CLI
Conclusion
If ~/.aws/config does not exist, create it with the following content:
[default]
That's all it takes.
It seems the file must exist.
Background
I was doing some New Year's cleaning of my dotfiles that I had been neglecting, and I got stuck in an unexpected place.
After installing the 1Password CLI, I configured it referencing this:
$ op signin
$ op plugin init aws
I added the following to ~/.zshrc:
echo "source ~/.config/op/plugins.sh" >> ~/.bashrc && source ~/.bashrc
Then, after restarting zsh:
$ zsh
Running the following resulted in an error:
$ aws s3 ls
[ERROR] 2024/01/01 18:00:00 could not run plugin AWS CLI: failed to provision credentials, encountered error(s):
source profile "default" does not exist in your AWS config file
Viewing details:
$ op plugin run --debug -- aws ls s3
6:17PM | DEBUG | Session delegation enabled
6:17PM | DEBUG | NM request: NmRequestAccounts
6:17PM | DEBUG | NM response: Success
6:17PM | DEBUG | NM request: NmRequestAccounts
6:17PM | DEBUG | NM response: Success
6:17PM | DEBUG | InitDefaultCache: successfully initialized cache
6:17PM | DEBUG | EncryptedKeysets: Cache hit on keyset
6:17PM | DEBUG | Vault: cache hit on vault xxxxx
6:17PM | DEBUG | VaultItems: cache hit on vault items of vault xxxxx
6:17PM | DEBUG | Item: VaultItems cache hit for vault xxxxx - validating staleness using item version
6:17PM | DEBUG | Item: cache hit on item yyyyy of vault xxxxx
[ERROR] 2024/01/01 18:01:00 could not run plugin AWS CLI: failed to provision credentials, encountered error(s):
source profile "default" does not exist in your AWS config file
touch ~/.aws/config
did not change anything.
It results in an error if the string [default] is not inside the file.
It seems it must be explicitly stated.
Discussion