简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM