AWS Command Line Interface Unable to Locate Credentials - Special Permissions

A couple of points on this as I had similar problems whilst trying to perform an S3 sync.

My findings were as follows.

  1. Remove the spaces between hte = and the key value pair (see example below).

  2. The OP has specified a [default] section in their example, but I got the same error when I had removed this section as I did not think it was needed so it's worth nothing this is needed.

I then reformed my file as follows and it worked...

[default]
aws_access_key_id=****
aws_secret_access_key=****
region=eu-west-2

[deployment-profile]
aws_access_key_id=****
aws_secret_access_key=****
region=eu-west-2
  1. I had to include a blank line at the bottom of my credentials file.

Just posting this really as I struggled for a few hours with vague messages from AWS and these were the solutions that worked for me. Hope that it helps someone.


There is a another way to configure aws credentials while using command line tool. You can pass credentials using windows command instead of passing through file. Execute below command from windows command prompt

aws configure 

It prompt you to enter below things

AWS Access key ID:
AWS secrete key ID:
Default region Name:
Default output Format:

See this video tutorial: https://youtu.be/hhXj8lM_jBs


If like me you have a custom IAM user in your credentials file rather than 'default', try setting the AWS_DEFAULT_PROFILE env variable to the name of your IAM user, and then running commands.

[user1]
ACCESS_KEY=
SECRET_KEY=
set AWS_DEFAULT_PROFILE=user1
aws <command>

Alternatively you can specify the --profile variable each time you use the cli:

aws <command> --profile user1

Okay, so the config file cannot be a text file (.txt). You should create the file in CMD, and it should be a generic file w/o any extension.