Boto3, how to disable ACL when using generate_presigned_url?

I keep getting this error:

An error occurred (AccessControlListNotSupported) when calling the PutObject operation: The bucket does not allow ACLs

I'm switching to chunked uploads, previously i could do below and this uploaded fine.

original = models.FileField(storage=S3Boto3Storage(bucket_name='video-sftp',default_acl=None),upload_to='', blank=False, null=False)

Now i'm using generate_presigned_url and the ACL parameter is being ignored.

 url = client.generate_presigned_url(
            ClientMethod="put_object",
            Params={
                "Bucket": "video-sftp",
                "Key": f"{json.loads(request.body)['fileName']}",
                "ACL": "None"
            },
            ExpiresIn=300,
        )

How do i solve?

I have omitted the parameter ACL entirely and it works:

s3_client.generate_presigned_url(
    'put_object',
    Params = {'Bucket': bucket_name, 'Key': key}
)

If you want to use the ACL parameter, maybe you shouldn't set it to the string "None" and use the value None instead.

Back to Top