'Download data from S3 Server-side encryption enabled bucket
I created an S3 Bucket with server-side encryption enabled using S3-managed keys. Now I need to download the data using python script, but also need to decrypt as it gets downloaded.
Following is my code:
#Creating Session With Boto3.
session = boto3.Session(
aws_access_key_id='ID',
aws_secret_access_key='KEY'
)
#Creating S3 Resource From the Session.
s3 = session.resource('s3')
my_bucket = s3.Bucket(BUCKET_NAME)
for my_bucket_object in my_bucket.objects.filter(Prefix='DIRECTORY_NAME/'):
...
But it is downloading encrypted data.
Solution 1:[1]
It is not downloading encrypted data. The encryption and decryption process for Server-Side Encryption with S3-managed keys is totally transparent to users. It is only encrypted at rest. You will never see the encrypted version of the object.
If you are seeing encrypted data, then that is what the object contained when it was uploaded to S3.
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 | John Rotenstein |
