I'm following the example guide to send email using python and am getting an error that says "The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method." Problem is I'm not self-signing anything. Boto should be handling all that on the back end.
Looking through comments on a similar issue raised regarding S3 buckets, lots of people were having trouble with special characters in their keys. One person said the problem was a + in the key. I tried creating new credentials because mine did have a +. The new credentials have a / in them and instead I got the error "The security token included in the request is invalid." Some people were also saying they get the error in the title when they are using forward slashes, not the token invalid error.
I've also managed to get AWS to generate an alpha-numeric secret key and still get the title error. It seems like running with any key with a / generates the invalid token error, whereas any other key will generate the title error. Is there some configuration in boto3 that needs to be addressed to fix this?
Extra Info. The full output when I try to send an email is this:
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. This is being created under the hood by boto3. Is there any way to see what boto3 is sending for myself?
The Canonical String for this request should have been
'POST
/
content-type:application/x-www-form-urlencoded; charset=utf-8
host:email.us-east-1.amazonaws.com
x-amz-date:20210602T203507Z
content-type;host;x-amz-date
f7db71769583b2ac6313966e2c40eef110add591a5008c5b3ba727d66fb1fffe'
The String-to-Sign should have been
'AWS4-HMAC-SHA256
20210602T203507Z
20210602/us-east-1/ses/aws4_request
c7d4af550cec63d9b23b3fcca2d4cad3a9587fc565f211626ae908b7bcb6b737'