Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon S3 - Multiple keys to one object

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

Key2 ---> Object2

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

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

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

like image 667
Seckin Tozlu Avatar asked Jan 27 '16 16:01

Seckin Tozlu


People also ask

How many tags can an S3 object have?

You can associate up to 10 tags with an object. Tags associated with an object must have unique tag keys.

What is an s3key?

The object key (or key name) uniquely identifies the object in an Amazon S3 bucket. Object metadata is a set of name-value pairs. For more information about object metadata, see Working with object metadata. When you create an object, you specify the key name, which uniquely identifies the object in the bucket.

What's the difference between SSE S3 and SSE kms?

Server-Side Encryption with AWS KMS keys (SSE-KMS) is similar to SSE-S3, but with some additional benefits and charges for using this service. There are separate permissions for the use of a KMS key that provides added protection against unauthorized access of your objects in Amazon S3.

Does S3 allow duplicates?

Replication enables automatic, asynchronous copying of objects across Amazon S3 buckets. Buckets that are configured for object replication can be owned by the same AWS account or by different accounts. You can replicate objects to a single destination bucket or to multiple destination buckets.


1 Answers

A key is a unique identifier for an object:

From Object Key and Metadata

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

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

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.

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

like image 183
Rodrigo Murillo Avatar answered Oct 15 '22 15:10

Rodrigo Murillo