Boto3 загрузить ServerSideEncryption - PullRequest
0 голосов
/ 01 июня 2018

Я получаю сообщение об ошибке «Отказано в доступе» из-за SSE. Как изменить текущий код для включения SSE в форме ServerSideEncryption = 'AES256'

 def download(self):
    s3 = boto3.client('s3')
    try:
        with open(self.flow_cells +'.zip', 'wb') as data:
            s3.download_fileobj(self.source_s3_bucket, self.source_key, data)
        return True
    except botocore.exceptions.ClientError as error:
        print(error.response['Error']['Code'])

def upload(self):
    s3 = boto3.client('s3')
    try:
        with open(self.flow_cells +'.zip', 'rb') as data:
            s3.upload_fileobj(data, self.output_s3_bucket, self.flow_cells +'.zip')
        return True
    except botocore.exceptions.ClientError as error:
        print(error.response['Error']['Code'])

1 Ответ

0 голосов
/ 01 июня 2018

исправление для будущего было

def upload(self):
    s3 = boto3.client('s3')
    try:
        with open(self.flow_cells +'.zip', 'rb') as data:
            s3.upload_fileobj(data, self.output_s3_bucket, self.flow_cells +'.zip',ExtraArgs={'ServerSideEncryption': 'AES256'})
        return True
    except botocore.exceptions.ClientError as error:
        print(error.response['Error']['Code'])
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...