Aamir Sheraz
Aamir Sheraz

Reputation: 55

What is definition of Amazon S3 prefix

What exactly is the definition of S3 prefix.

Lets say I have the following S3 structure:

photos/2006/January/sample.jpg

photos/2006/February/sample2.jpg

photos/2006/February/sample3.jpg

photos/2006/February/sample4.jpg

what will be the prefix for sample.jpg?

Either photos will be the prefix or the whole path till sample.jpg will be the prefix (i.e photos/2006/January/)

Because there is read write limit for each prefix.

Upvotes: 3

Views: 5959

Answers (2)

alex067
alex067

Reputation: 3281

You can think of a prefix as a path to a folder. Although they are not really folders, AWS has created prefix's to make it easier for us to visualize our data.

The prefix path is relative to the object. So for sample.jpg, the prefix is: photos/2006/January/ but if i have a sample2.jpg inside photos/2006/ then the prefix is the latter.

Upvotes: 2

nicholas.hauschild
nicholas.hauschild

Reputation: 42849

S3 is just an object store, mapping a 'key' to an 'object'. In your case, I see four objects (likely images) with their own keys that are trying to imitate a filesystem's folder structure.

Prefix is referring to any string that would be a prefix to an object's key.

photos/2006/January/sample.jpg is just a key, so any of the following (and more) can be a prefix that would match this key:

  • pho
  • photos
  • photos/2
  • photos/2006/January/sample.jp
  • photos/2006/January/sample.jpg

Note that the first three prefixes listed above will be a match for the other keys you mention in your question.

Upvotes: 4

Related Questions