Amazon S3-一个对象的多个键 [英] Amazon S3 - Multiple keys to one object

查看:95
本文介绍了Amazon S3-一个对象的多个键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个S3存储桶,其中有超过1亿个对象,每个对象都像往常一样具有唯一的密钥.我想知道是否有一种方法可以为其中的一些对象分配另一个键.像这样:

I have an S3 bucket with more than 100 million objects in it an each object has a unique key as usual. I was wondering if there is a way to assign another key to some of these objects. Something like this:

Key1 ---> Object1

Key1 ---> Object1

Key2 ---> Object2

Key2 ---> Object2

Key3 ---> Object2(我想添加它)

Key3 ---> Object2 (I'd like to add this)

我在AWS文档中进行了查询,但找不到任何相关内容.

I looked this up in AWS documentation but couldn't find anything relevant.

另一种方法可能是使用Key3创建一个伪对象,该伪对象重定向到实际对象.会更容易吗?

Another approach could be to create a dummy object with Key3 that redirects to actual object. Would that be easier?

推荐答案

键是对象的唯一标识符:

A key is a unique identifier for an object:

来自对象键和元数据

每个Amazon S3对象都有数据,密钥和元数据.对象键(或 键名称)唯一地标识存储桶中的对象.

Each Amazon S3 object has data, a key, and metadata. Object key (or key name) uniquely identifies the object in a bucket.

另一种方法可能是使用Key3创建一个虚拟对象,该对象 重定向到实际对象.会更容易吗?

Another approach could be to create a dummy object with Key3 that redirects to actual object. Would that be easier?

是的,您可以这样做:您可以使用用户定义的对象元数据以创建Key3,并在元数据中定义一个键/值对,如下所示:

Yes you could do this: you could use User Defined Object Metadata to create Key3, and in the Metadata define a key/value pair like this:

x-amz-meta-KeyAlias=Key2

该元数据表示此密钥是另一个密钥的别名.

That Metadata expresses that this key is an alias for another key.

您的应用程序随后可以读取该元数据,然后将请求从Key3重定向到Key2.

Your app could then read that metadata, and then redirect the request from Key3 to Key2.

如果存储桶公开为公共网站,则您也可以实施某种形式的重定向. 更新:当使用网站端点时,此方法适用于任何对象类型/扩展名

If the bucket is exposed as a public website, you could also implement some form of redirection. UPDATE: This works for any object type/extension, when using the Website Endpoint

这篇关于Amazon S3-一个对象的多个键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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