【发布时间】:2020-10-06 00:07:50
【问题描述】:
我正在使用 boto3 API 来更新对象的 S3 元数据。
我正在使用How to update metadata of an existing object in AWS S3 using python boto3?
我的代码如下所示:
s3_object = s3.Object(bucket,key)
new_metadata = {'foo':'bar'}
s3_object.metadata.update(new_metadata)
s3_object.copy_from(CopySource={'Bucket':bucket,'Key':key}, Metadata=s3_object.metadata, MetadataDirective='REPLACE')
当对象大于 5GB 时,此代码将失败。我收到此错误:
botocore.exceptions.ClientError: 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
如何更新大于 5GB 的对象的元数据?
【问题讨论】: