laxman
laxman

Reputation: 2110

What does prefix mean in S3

the docs says,

For example, your application can achieve at least 3,500 PUT/COPY/POST/DELETE and 5,500 GET/HEAD requests per second per prefix in a bucket. There are no limits to the number of prefixes in a bucket. You can increase your read or write performance by parallelizing reads. For example, if you create 10 prefixes in an Amazon S3 bucket to parallelize reads, you could scale your read performance to 55,000 read requests per second.

But, it doesn't clearly mentions the concept of prefixes.

For eg,

Lets say I have 3 files and their corresponding keys are:

a/a1.txt
b/b1.txt
2.txt

As per my understanding, there is no concept of folders in S3. So, S3 will create something like this on my bucket.

|- a/
|- a1.txt
|- 2.txt
|- b/
|- b1.txt

I did came across this blog but it made things more confusing for me.

My questions:-

Does every Object created in S3 that ends with '/' is a prefix? In other words, Does every folder that we see in the S3 web console is a prefix?

Upvotes: 2

Views: 3110

Answers (1)

IMSoP
IMSoP

Reputation: 97718

Although S3 is theoretically a flat store, many of its operations have special handling for prefixes with a set delimiter, usually /. For instance this help page discusses how the "folders" on the S3 console web interface are built by looking at the prefixes you've used.

An important point to remember here is that these folders are not objects themselves, so in your example, there is no key of a or b stored in the bucket.

If you create a bucket and immediately add an object with a key of a/b/c/d/e.txt then:

  • the bucket will contain exactly one object, with key a/b/c/d/e.txt
  • some APIs and UIs will infer a prefix for that key of a/b/c/d, as a way of grouping related keys

Upvotes: 2

Related Questions