Welcome to the new Amazon S3 User Guide! The Amazon S3 User Guide combines information and instructions from the three retired guides: Amazon S3 Developer Guide, Amazon S3 Console User Guide, and Amazon S3 Getting Started Guide.
Organizing objects in the Amazon S3 console using folders
In Amazon S3, buckets and objects are the primary resources, and objects are stored in buckets. Amazon S3 has a flat structure instead of a hierarchy like you would see in a file system. However, for the sake of organizational simplicity, the Amazon S3 console supports the folder concept as a means of grouping objects. It does this by using a shared name prefix for objects (that is, objects have names that begin with a common string). Object names are also referred to as key names.
For example, you can create a folder on the console named photos
and store an
object named 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
, andlogs/date3.txt
—the console will show a folder namedlogs
. If you open the folder in the console, you will see three objects:date1.txt
,date2.txt
, anddate3.txt
. -
If you have an object named
photos/2017/example.jpg
, the console will show you a folder namedphotos
containing the folder2017
. The folder2017
will contain the objectexample.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 copied from one folder to another.
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 can't upload an object that has a key name with a trailing "/" character using
the Amazon S3
console. However, you can upload objects that are named with a trailing "/" with the
Amazon S3 API
by using the AWS CLI, AWS SDKs, or REST API.
An object that is named with a trailing "/" appears as a folder in the Amazon S3 console. The Amazon S3 console does not display the content and metadata for such an object. When you use the console to copy an object named with a trailing "/", a new folder is created in the destination location, but the object's data and metadata are not copied.
Creating a folder
This section describes how to use the Amazon S3 console to create a folder.
If your bucket policy prevents uploading objects to this bucket without encryption, tags, metadata, or access control list (ACL) grantees, you will not be able to create a folder using this configuration. Instead, upload an empty folder and specify these settings in the upload configuration.
To create a folder
-
Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/
. -
In the Buckets list, choose the name of the bucket that you want to create a folder in.
-
Choose Create folder.
-
Enter a name for the folder (for example,
favorite-pics
). Then choose Create folder.
Making folders public
We recommend blocking all public access to your Amazon S3 folders and buckets unless you specifically require a public folder or bucket. When you make a folder public, anyone on the internet can view all the objects that are grouped in that folder.
In the Amazon S3 console, you can make a folder public. You can also make a folder public by creating a bucket policy that limits access by prefix. For more information, see Identity and access management in Amazon S3.
After you make a folder public in the Amazon S3 console, you can't make it private again. Instead, you must set permissions on each individual object in the public folder so that the objects have no public access. For more information, see Configuring ACLs.
Deleting folders
This section explains how to use the Amazon S3 console to delete folders from an S3 bucket.
For information about Amazon S3 features and pricing, see Amazon S3
To delete folders from an S3 bucket
-
Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/
. -
In the Buckets list, choose the name of the bucket that you want to delete folders from.
-
In the Objects list, select the check box next to the folders and objects that you want to delete.
-
Choose Delete.
-
On the Delete objects page, verify that the names of the folders you selected for deletion are listed.
-
In the Delete objects box, enter
delete
, and choose Delete objects.
This action deletes all specified objects. When deleting folders, wait for the delete action to finish before adding new objects to the folder. Otherwise, new objects might be deleted as well.