My AWS CLI didn't work with sudo
问题 I have shell script that uses aws cli , my script will be executed with sudo (Ex: sudo ./test.sh ) But I got the message: Unable to locate credentials. You can configure credentials by running "aws configure". Actually, I did config for both sudo aws configure and aws configure What did I do wrong? Please help. Thanks! 回答1: You might have to run sudo with -E to preserve the environment variables set by aws cli. sudo -E ./test.sh 回答2: AWS CLI configured your credentials in $HOME/.aws