Solve - Unable to Parse Config File Error in AWS CLI

avatar

Borislav Hadzhiev

Wed Sep 15 20212 min read

Solving Unable to Parse Config File Credentials Error #

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

unable parse credentials file

In order to solve the "Unable to parse config file" 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 snippet 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 like:

config
[default] region=us-east-1 output=json [profile admin] region=us-east-1 output=json
If you make an error and set region or output twice for the same profile in your config file, you would still get the "Unable to parse config file" error.

unable parse config file

Further Reading #

Add me on LinkedIn

I'm a Web Developer with TypeScript, React.js, Node.js and AWS experience.

Let's connect on LinkedIn

Join my newsletter

I'll send you 1 email a week with links to all of the articles I've written that week

Buy Me A Coffee