aioboto3 icon indicating copy to clipboard operation
aioboto3 copied to clipboard

SSE-C encryption doesn't work with a multipart upload

Open mcproger opened this issue 2 years ago • 2 comments

  • Async AWS SDK for Python version: 9.3.1
  • Python version: 3.10.5
  • Operating System: Docker image (Debian GNU/Linux 11 (bullseye))

Description

Hello!

SSE-C encryption (Server Side Encryption with Customer provided key) doesn't work well with a multipart upload. It fails with an error botocore.exceptions.ClientError: An error occurred (InvalidRequest) when calling the UploadPart operation: The multipart upload initiate requested encryption. Subsequent part requests must include the appropriate encryption parameters.

The same code snippet works well in the sync version boto3.

What I Did

async with session.client(
    's3',
    aws_access_key_id=access_key_id,
    aws_secret_access_key=secret_access_key,
    region_name=region,
) as session:
    await destination_s3.upload_fileobj(
        raw_stream,
        Bucket=bucket,
        Key=key,
        ExtraArgs={
            'ACL': 'bucket-owner-full-control',
            'SSECustomerAlgorithm': 'AES256',
            'SSECustomerKey': KEY
        },
    )

mcproger avatar Aug 05 '22 10:08 mcproger

Ah yeah, I have an idea why that might not work. Will look into it on the weekend if I get a chance.

terricain avatar Aug 10 '22 19:08 terricain

Can you try version 10.0.1a0 and see if that fixes it for you?

terricain avatar Aug 11 '22 17:08 terricain

This should be fixed as part of v13.0.0, if not, please re-open

terricain avatar May 27 '24 16:05 terricain