首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Boto3 Copy_Object在大小超过5 5GB时失败

Boto3 Copy_Object在大小超过5 5GB时失败
EN

Stack Overflow用户
提问于 2018-10-19 01:18:46
回答 2查看 4.1K关注 0票数 5

我有以下函数

代码语言:javascript
复制
async def _s3_copy_object(self, s3_source, s3_destination):
    source_bucket, source_key = get_s3_bucket_and_key(s3_source)
    destination_bucket, destination_key = get_s3_bucket_and_key(s3_destination)

    print("copying object: {} to {}".format(s3_source, s3_destination))
    source = {'Bucket': source_bucket, 'Key': source_key}
    await self._async_s3.copy_object(CopySource=source,
                                     Bucket=destination_bucket, Key=destination_key,
                                     ServerSideEncryption='AES256',
                                     MetadataDirective='COPY',
                                     TaggingDirective='COPY')

如果文件小于5 5gb,则此方法效果很好,但如果对象超过5 5gb,则此方法将失败。

我得到以下错误:

代码语言:javascript
复制
An error occurred (InvalidRequest) when calling the CopyObject operation: The specified copy source is larger than the maximum allowable size for a copy source: 5368709120: 1313

有没有解决这个问题的办法?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-10-19 06:23:37

您需要使用boto3 copy方法,而不是copy_object。复制大于5 5GB的对象时,需要进行分块上传。它还将为您处理线程。

票数 12
EN

Stack Overflow用户

发布于 2018-10-19 04:57:52

您应该考虑使用多部分uploads.In作为单个操作,允许的最大大小为5 5GB

Multi-part upload

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52879356

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档