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:

The object key "myfolder/myfile.doc" is stored in the bucket “” 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 *