Om panchal
Om panchal

Reputation: 45

AWS configure issue on windows cmd

I'm trying to access my 's3' bucket using boto3, getting the following error:

ClientError: An error occurred (403) when calling the HeadObject operation: Forbidden

Although, I have provided all the access tokens.

session = boto3.Session(
    aws_access_key_id=aws_access_key_id1,
    aws_secret_access_key=aws_secret_access_key1,
    aws_session_token=aws_session_token1
)

Looked up for how to set up the config files using awscli so that boto3 directly takes it from there, but after installing awscli (tried both windows installer and pip install awscli) when I run aws configure cmd doesn't ask for access tokens. Neither is the command working.

I have added *\site-packages\bin* and *\Amazon\AWSCLIV2* in path folder, still doesn't work. Any help would be appreciated. Thanks.

Command Promt

Upvotes: 0

Views: 1243

Answers (2)

Shaqil Ismail
Shaqil Ismail

Reputation: 1951

Look at the %PATH% environment variable, and remove/amend the variable to use the new AWS CLI tools, and also check for any other environment variable relating to AWS CLI and amend these also, and then test.

Upvotes: 0

Om panchal
Om panchal

Reputation: 45

Apparently, pip install awscli installs V1 and the issue was caused because of two different versions V1 & V2. Problem was solved by simply removing the old version. pip uninstall awscli

Thanks to John Rotenstein.

Upvotes: 0

Related Questions