'Why is django-storages s3boto3 backend file url failing with AWS Signature Version 4 error?

The django-storages s3boto3 backend claims to provide presigned url generation for files uploaded to s3 using the .url property on the file field. The generated url looks about right, but when opened, returns the S3 error "Requests specifying Server Side Encryption with AWS KMS managed keys require AWS Signature Version 4."

How can I fix this?



Solution 1:[1]

Solution: add AWS_S3_SIGNATURE_VERSION = 's3v4' to the django settings.

The django-storages docs list this as an optional setting and claim that Signature Version 4 is the boto3 default. However, on boto3 version 1.18.47, this appears not to be the case. Adding the django-storages setting worked to specify the signature version as v4.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Grace Whitney