I am getting an error from aws cli on my Ubuntu desktop when running the command aws s3 ls --profile=55667788-its-user
. When I run this command as my Ubuntu user it says it cannot find the config for the user, and if I swap to root I get access denied on s3 buckets.
Now, I ran aws configure and I set my profile in credentials and I also ran aws configure --profile as well, and I checked the config file. There's also an interesting problem that AWS_PROFILE is never found.
I am really banging my head as to why this is not working.
Anyone know how to fix this?
CodePudding user response:
Make sure you have an .aws directory in your home directory (i.e. in ~/.aws).
Then, you will need a config
file in which you will have your profile like:
[profile 55667788-its-user]
region = <YOUR PREFERRED SESSION> (e.g: eu-central-1)
output = json
You also need a credentials
file with the following:
[55667788-its-user]
aws_access_key_id=<ACCES KEY GOES HERE>
aws_secret_access_key=<SECRET KEY GOES HERE>
aws_session_token=<THIS IS OPTIONAL, ONLY USE IT IF YOU USE SSO AND TEMPORARY SESSIONS>
The following should then work in your terminal:
aws s3 ls --profile 55667788-its-user
CodePudding user response:
Check credentials
file. I assume you have several profiles in it. When I created my second profile, aws configure
didn't add new line. So, it looked like this:
[default]
...
region=us-west-2[55667788-its-user]
aws_access_key_id=...
which caused all kind of problems. Also, check the permissions - it has to be 600 (no read for group or other)