This guide describes how to create, list, and delete managed folders .
Before you begin
To create and manage managed folders, you must first enable uniform bucket-level access and get the required IAM roles.
Enable uniform bucket-level access
If you haven't already, enable uniform bucket-level access .
Get required roles
To get the permissions that
you need to create and manage managed folders,
ask your administrator to grant you the Storage Folder Admin
( roles/storage.folderAdmin
)
IAM role on the bucket.
This predefined role contains the permissions required to create and manage managed folders. To see the exact permissions that are required, expand the Required permissionssection:
Required permissions
The following permissions are required to create and manage managed folders:
- To create managed folders:
storage.managedFolders.create
- To validate newly created managed folders by listing them:
storage.objects.list
- To list managed folders:
storage.managedFolders.list
- To get managed folders:
storage.managedFolders.get
- To move managed folders:
-
storage.managedFolders.delete
(on the source bucket) -
storage.managedFolders.create
(on the destination bucket)
-
- To delete managed folders:
storage.managedFolders.delete
For information about granting roles on buckets, see Use IAM with buckets .
Create a managed folder
Console
When using the Google Cloud console, you create managed folders by enabling management on folders or simulated folders. The following steps describe how to create a folder or a simulated folder and then enable folder management:
- In the Google Cloud console, go to the Cloud Storage Buckets
page.
-
In the list of buckets, click the name of the bucket you want to create managed folders in.
-
In the Bucket detailspage, click Create folderto create a new folder. If the folder you want to convert to a managed folder already exists, skip to the step describing how to access the More options menu.
-
In the Namefield, enter a name for your folder. For naming considerations, see Managed folder names .
-
Click Create.
Your newly created folder appears in the Folder browserpane.
-
In the Folder browserpane, click the More options menu next to the folder you want to convert to a managed folder and click Edit access.
The Enable folder management?dialog appears.
-
Click Enable.
Your folder converts to a managed folder. A Permissions for
MANAGED_FOLDER_NAME
pane appears that displays the IAM policies on the folder by principal and role. To create new IAM policies, see Set an IAM policy on a managed folder .
Command line
To create a managed folder, run the gcloud storage managed-folders create
command
:
gcloud storage managed-folders create gs:// BUCKET_NAME / MANAGED_FOLDER_NAME
Where:
-
BUCKET_NAME
is the name of the bucket in which you want to create a managed folder. For example,my-bucket
. -
MANAGED_FOLDER_NAME
is the name of the managed folder you want to create. For example,my-managed-folder/
.
To confirm that the managed folder was created, run the gcloud storage managed-folders describe
command:
gcloud storage managed-folders describe gs:// BUCKET_NAME / MANAGED_FOLDER_NAME
Where:
-
BUCKET_NAME
is the name of the bucket in which you created a managed folder. -
MANAGED_FOLDER_NAME
is the name of the managed folder you created.
Client libraries
C++
For more information, see the Cloud Storage C++ API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
C#
For more information, see the Cloud Storage C# API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
Go
For more information, see the Cloud Storage Go API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
Java
For more information, see the Cloud Storage Java API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
Node.js
For more information, see the Cloud Storage Node.js API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
PHP
For more information, see the Cloud Storage PHP API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
Python
For more information, see the Cloud Storage Python API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
Ruby
For more information, see the Cloud Storage Ruby API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .