The request signature we calculated does not match the signature you provided: Check your AWS Secret Access Key and signing method
kavya922 opened this issue · comments
Describe the bug
The secret key has this part = "7+pj\h"
A backslash and I did verify the secret key and access key, I have given the correct ones
But still I am getting this error
File "D:\amazon\aws_new\env\lib\site-packages\botocore\client.py", line 534, in _api_call
return self._make_api_call(operation_name, kwargs)
File "D:\amazon\aws_new\env\lib\site-packages\botocore\client.py", line 976, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidSignatureException) when calling the ListRegions operation: {"message":"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
The Canonical String for this request should have been
'POST
/listRegions
content-type:application/json
host:account.us-east-1.amazonaws.com
x-amz-date:20240517T104746Z
content-type;host;x-amz-date
e1f672fcde086d131f233fd3583c766b272afc23cbb9d14d9ad9bb1408a817d3'
The String-to-Sign should have been
'AWS4-HMAC-SHA256
20240517T104746Z
20240517/us-east-1/account/aws4_request
3cf148ba8c472d380ab6747decddde9297262adbc24abc816990a4bf8e8b9343'
"}
Expected Behavior
Should be able to fetch the regions list from AWS
Current Behavior
Getting an error
botocore.exceptions.ClientError: An error occurred (InvalidSignatureException) when calling the ListRegions operation: {"message":"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
The Canonical String for this request should have been
'POST
/listRegions
content-type:application/json
host:account.us-east-1.amazonaws.com
x-amz-date:20240517T104746Z
content-type;host;x-amz-date
e1f672fcde086d131f233fd3583c766b272afc23cbb9d14d9ad9bb1408a817d3'
The String-to-Sign should have been
'AWS4-HMAC-SHA256
20240517T104746Z
20240517/us-east-1/account/aws4_request
3cf148ba8c472d380ab6747decddde9297262adbc24abc816990a4bf8e8b9343'
"}
Reproduction Steps
Python version 3.7.9
import boto3
session = boto3.Session(aws_access_key_id="****", aws_secret_access_key="****")
client = session.client('account')
paginator = client.get_paginator('list_regions')
regions_list = []
for page in paginator.paginate():
regions_list.extend(page['Regions'])
regions_json = json.dumps(regions_list)
Possible Solution
No response
Additional Information/Context
No response
SDK version used
boto3 and botocore version 1.33.13
Environment details (OS name and version, etc.)
Windows
There was problem when I pasted the secret key. I have checked it and it is working fine now, hence closing the issue
This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.