Unable to Parse Config File Error in AWS CLI [Solved]

avatar
Borislav Hadzhiev

Last updated: Feb 26, 2024
2 min

banner

# Unable to Parse Config File Error in AWS CLI [Solved]

The reason the "Unable to parse config file" error occurs is that there is an error in the AWS configuration file on that machine.

unable parse credentials file

In order to solve the error, we have to locate the credentials file and make it conform to the format the AWS CLI expects.

On Linux and macOS, the credentials file is located at ~/.aws/credentials.

On Windows, the file is located at C:\Users\USERNAME\.aws\credentials.

The correct syntax for the credentials file is as follows:

credentials
[default] aws_access_key_id=YOUR_ACCESS_KEY_ID aws_secret_access_key=YOUR_SECRET_KEY [admin] aws_access_key_id=YOUR_ACCESS_KEY_ID aws_secret_access_key=YOUR_SECRET_KEY

The example above sets the access key and secret access key IDs for the default profile and for a profile named admin.

A very common cause of the "Unable to parse config file" error is specifying the aws_access_key_id or aws_secret_access_key multiple times for the same profile.

To view all of the supported settings for the credentials file, check out the docs at Supported config file settings.

The region and output format of the AWS CLI are configured in a file named config located in the same directory.

On Linux and MacOS, the config file is located at ~/.aws/config.

On Windows, the config file is located at C:\Users\USERNAME\.aws\config.

The correct syntax for the config file looks as follows:

config
[default] region=us-east-1 output=json [profile admin] region=us-east-1 output=json
If you set region or output twice for the same profile in your config file, you will still get the error.

unable parse config file

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.