Simulating a folder in an S3 bucket

There are no such thing as folders in AWS S3 – but you may include a string in the S3 object key name that appears to be a folder to simulate a folder.

The following Amazon Simple Storage Service (Amazon S3) URL illustrates:

https://mybucket.abc.com.s3.amazonaws.com/myfolder/myfile.doc

The object key "myfolder/myfile.doc" is stored in the bucket “mybucket.abc.com.” The object key name is NOT “myfile.doc” as an S3 novice might incorrectly assume.

Using a bucket policy, among the several ways you can restrict access is by object key name prefix (e.g. “/myfolder/*”) further allowing folder simulation and permissions controls.

S3 object key name length limit

The name for a key is a sequence of Unicode characters whose UTF-8 encoding is at most 1024 bytes long. So depending on your character set, 1 or 2 byte encoding’s allow 1024 or 512 byte key names respectively.

More from LonzoDB on AWS

Leave a Reply

Your email address will not be published. Required fields are marked *