复制S3存储桶(包括版本) [英] Copy S3 Bucket including versions

查看:140
本文介绍了复制S3存储桶(包括版本)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法复制包含对象版本的S3存储桶?

Is there a way to copy an S3 bucket including the versions of objects?

我读到一种复制存储桶的方法是使用命令行工具

I read that a way to copy a bucket is by using the command line tool with

aws s3 sync s3://<source> s3://<dest>

但是,在源存储区中,我有:

However, on in the source bucket I had:

在同步存储桶中,我有:

while in the synced bucket I have:

如您所见,版本ID为空".有没有办法制作100%相同的副本,包括版本ID?这对于我们的备份/开发服务器非常重要,因为我们的应用程序依赖版本ID. 编辑:如果我在同步之前打开版本控制,则会得到不同于null的版本ID.但是版本ID与原始存储桶中的版本不同,目标是保留版本ID.我还尝试了cp命令,它会产生相同的结果. 此处:

As you can see the Version ID is "null". Is there a way to make a 100% identical copy, including the version ID? This would be important for our backups / development server, as our app is relying on the version ID. If I turn on versioning before the sync I get version Id's different from null. But the version Ids differ from the ones in the original bucket and the goal would be to preserve the version Ids. I also tried the cp command, it yields the same results. The result described above is also documented here:

如果在目标存储桶上启用版本控制,则Amazon S3会为要复制的对象生成唯一的版本ID.此版本ID与源对象的版本ID不同. Amazon S3在响应的x-amz-version-id响应标头中返回复制对象的版本ID.

If you enable versioning on the target bucket, Amazon S3 generates a unique version ID for the object being copied. This version ID is different from the version ID of the source object. Amazon S3 returns the version ID of the copied object in the x-amz-version-id response header in the response.

如果您未启用版本控制或在目标存储桶上将其挂起,则Amazon S3生成的版本ID始终为空.

If you do not enable versioning or suspend it on the target bucket, the version ID Amazon S3 generates is always null.

所以aws似乎没有提供保留版本ID的方法吗?如果是这样,是否有解决方法或第三方软件?

So it looks like aws doesn't provide a way to preserve version Ids? If so, is there a workaround or third party software for this?

推荐答案

没有直接的方法.但是您可以通过AWS Copy-Object API ref https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html

There is no direct way to do so . But you can do it via AWS Copy-Object API ref https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html

遍历每个版本对象,捕获对象ID并复制到目标存储桶.

Iterate on every version object, capture the object-id and copy to destination bucket.

希望这会有所帮助

这篇关于复制S3存储桶(包括版本)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆