How to fix “AuthorizationHeaderMalformed when calling the GetObject operation” error in AWS s3 boto3

Question:

When I try to run very simple Python script to get object from s3 bucket:

I got an error:

I’m not sure what can be causing it, worth adding that:

  • I don’t know what is the bucket region (don’t ask why) but I tried manually to connect to all of them (by changing default region name in command to every region) and without success.
  • I don’t have access to bucket configuration. And anything that is in aws console. I just have the Key ID, Secret, bucket name and object name.

Answer:

An AWS-Access-Key-ID always begins with AKIA for IAM users or ASIA for temporary credentials from Security Token Service, as noted in IAM Identifiers in the AWS Identity and Access Management User Guide.

The value you’re using does not appear to be one of these, since it starts with QUtJ… so this it isn’t the value you should be using here. You appear to be using something that isn’t an AWS-Access-Key-ID.

Leave a Reply