Menu
Amazon Simple Storage Service
Console User Guide (API Version 2006-03-01)

Working with Folders

In Amazon S3, buckets and objects are the primary resources, where objects are stored in buckets. Amazon S3 has a flat structure with no hierarchy like you would see in a typical file system. However, for the sake of organizational simplicity, the Amazon S3 console supports the folder concept as a means of grouping objects. Amazon S3 does this by using key name prefixes for objects.

For example, you can create a folder in the console called photos, and store an object called myphoto.jpg in it. The object is then stored with the key name photos/myphoto.jpg, where photos/ is the prefix.

Here are two more examples:

  • If you have three objects in your bucket—logs/date1.txt, logs/date2.txt, and logs/date3.txt—the console will show a folder named logs. If you open the folder in the console, you will see three objects: date1.txt, date2.txt, and date3.txt.

  • If you have an object named photos/2013/example.jpg, the console will show you a folder named photos containing the folder 2013 and the object example.jpg.

You can have folders within folders, but not buckets within buckets. You can upload and copy objects directly into a folder. Folders can be created, deleted, and made public, but they cannot be renamed. Objects can be moved from one folder to another. For more information about moving objects, see Support for Moving Data.

Important

The Amazon S3 console treats all objects that have a forward slash "/" character as the last (trailing) character in the key name as a folder, for example examplekeyname/. You cannot upload an object with a key name with a trailing "/" character by using the Amazon S3 console. However, objects named with a trailing "/" can be uploaded with the Amazon S3 API by using the AWS CLI, the AWS SDKs, or REST API.

An object named with a trailing "/" displays as a folder in the Amazon S3 console. The Amazon S3 console does not display the content and metadata for such an object. When copying an object named with a trailing "/" by using the Amazon S3 console, a new folder is created in the destination location but the object's data and metadata are not copied.

Public Folders

You can make folders public, which means that all of the objects that appear within a public folder in the console are available for viewing or downloading to anyone on the Internet. However, as mentioned previously, the folder concept is only supported in the console. If you use a web browser to view a folder that you made public, you will get an access denied error because the folder is just a naming prefix, for an object or group of objects.

Note

It is easy to make a folder public, but you cannot make a folder private after you make it public. To make the objects in a public folder private, you have to go through each object in the public folder that you want to make private and set the permissions individually. For more information about how to set an object's permissions, see Editing Object Permissions.