Can't install / configure aws cli
after installation when I run aws configure I get
Traceback (most recent call last):
File "/usr/local/bin/aws", line 27, in <module>
sys.exit(main())
File "/usr/local/bin/aws", line 23, in main
return awscli.clidriver.main()
File "/usr/local/lib/python2.7/site-packages/awscli/clidriver.py", line 49, in main
driver = create_clidriver()
File "/usr/local/lib/python2.7/site-packages/awscli/clidriver.py", line 57, in create_clidriver
load_plugins(session.full_config.get('plugins', {}),
File "/usr/local/lib/python2.7/site-packages/botocore/session.py", line 361, in full_config
self._config = botocore.config.load_config(config_file)
File "/usr/local/lib/python2.7/site-packages/botocore/config.py", line 106, in load_config
parsed = raw_config_parse(config_filename)
File "/usr/
What steps can I take to fix it?
The traceback looks incomplete. Could you include the entire stack trace? That would help troubleshoot what's going on.
Without more information, my initial guess would be a syntax error in the AWS config file. Can you confirm:
- Does the
~/.aws/credentialsfile exist? If so, does it have contents? - Does the
~/.aws/configfile exist? If so, does it have contents? - If you don't have either of those files, is the env var
AWS_CONFIG_FILEset? If that's pointing to an existing file, does it have contents
none of those files exist. since installation didn't succeed I didn't try to make them manually.
If I'm correct I was supposed to be able to run aws configure to set all those up.
the full stack trace when I run aws is
➜ ~ aws
Traceback (most recent call last):
File "/usr/local/bin/aws", line 27, in <module>
sys.exit(main())
File "/usr/local/bin/aws", line 23, in main
return awscli.clidriver.main()
File "/usr/local/lib/python2.7/site-packages/awscli/clidriver.py", line 49, in main
driver = create_clidriver()
File "/usr/local/lib/python2.7/site-packages/awscli/clidriver.py", line 57, in create_clidriver
load_plugins(session.full_config.get('plugins', {}),
File "/usr/local/lib/python2.7/site-packages/botocore/session.py", line 361, in full_config
self._config = botocore.config.load_config(config_file)
File "/usr/local/lib/python2.7/site-packages/botocore/config.py", line 106, in load_config
parsed = raw_config_parse(config_filename)
File "/usr/local/lib/python2.7/site-packages/botocore/config.py", line 132, in raw_config_parse
raise botocore.exceptions.ConfigParseError(path=path)
botocore.exceptions.ConfigParseError: Unable to parse config file: /Users/andrei/.aws/config
➜ ~
I've tried installing and resinstall with force, and update.. no changes.
Interesting. It looks like it's failing to parse ~/.aws/config. Can you try putting in fake values? Here's the exact steps I tried, which works for me:
$ cat > ~/.aws/config
[default]
region=us-west-2
aws_access_key_id=foo
aws_secret_access_key=bar
$ aws configure
AWS Access Key ID [****************foo]:
AWS Secret Access Key [****************bar]:
Default region name [us-west-2]:
Default output format [None]:
$
Do those steps work for you? If so, you should now be able to add your real credential values by rerunning aws configure. I'm not sure how you got into this state. I confirmed that creating an empty ~/.aws/config file works as expected:
[ec2-user@ip-10-0-0-87 ~]$ rm ~/.aws/config
[ec2-user@ip-10-0-0-87 ~]$ touch ~/.aws/config
[ec2-user@ip-10-0-0-87 ~]$ aws configure
AWS Access Key ID [None]: foo
AWS Secret Access Key [None]: bar
Default region name [None]: us-west-2
Default output format [None]:
Yes, these steps have helped me. It works now.
Thank you @jamesls
Glad to hear it's working. Closing out issue.
I had the same problem and then found out that having a line with only one space causes this error to occur.
I am currently having this issue - I wan't able to follow the steps as I do not have an aws config file. Do you know how this could work?
For me, I was missing an equals sign = between aws_access_key_id and its value in the credentials file. I ended up just renaming credentials file and running aws configure.
@jamesls awesome dude.Your solution is working like a dream!
I had this issue as well and the only way to get them working was to manually deleting the files config and credentials from C:\Users\yourusername\.aws and run the command aws configure to regenerate them.
The problem is that the configure file cannot be parsed. Re-create the configure file and make sure that is formatted correctly.
I came across this problem recently after writing a script that modified .aws/credentials (to automate some of my 2FA steps).
It looks like if the encoding is "UTF-8-BOM", botocore raises a ConfigParseException. If I change the same config file to "UTF-8", for example using Notepad++, then ini file is parsed correctly.
Traceback (most recent call last):
File "/usr/local/bin/aws", line 27, in
This is the error i am getting.Unable to fix
Issue in my case was that i was adding manual entries, and i had empty lines between entries. Removing those extra lines fixed my issue.
Or just use aws configure --profile name_of_profile command and it should work.
I had this issue as well and the only way to get them working was to manually deleting the files config and credentials from
C:\Users\yourusername\.awsand run the commandaws configureto regenerate them.
Even I had the same issue and got resolved on following the above steps..
I encountered this issue inside a Windows container (Windows Server, Docker Enterprise Edition, i.e. not the Hyper-V based "Docker Desktop", but real containers using process isolation). I presume the issue is similar outside containers as well.
I was piping the config and credential files from snail strings (@"string"@) to out-file in Powershell as part of an entrypoint script and encountering the same unable to parse file .aws/config error from aws-cli. I checked the format of these files on my linux workstation, and rather than being utf-8, they are actually ascii. Once I set out-file to use -encoding ascii everything worked fine, without having to invoke aws configure, allowing me to continue to do everything programmatically inside the container. Hopefully this helps someone else who lands here as a result of the googles.