Create and manage batch operation jobs
Stay organized with collections
Save and categorize content based on your preferences.
This page describes how to create, view, list, cancel, and delete
storage batch operations jobs. It also describes how to use Cloud Audit Logs
with storage batch operations jobs.
Before you begin
To create and manage storage batch operations jobs, complete the steps in the following sections.
Configure Storage Intelligence
To create and manage storage batch operations jobs, configure
Storage Intelligence on the bucket where you want to run the job.
If you want to use a manifest for object selection, create a manifest file.
Using a manifest is one of the ways you can select objects to process in a
storage batch operations job.
Create a storage batch operations job
This section describes how to create a storage batch operations job.
To get the permissions that
you need to create a storage batch operations job,
ask your administrator to grant you the
Storage Admin (roles/storage.admin) IAM role on the project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
If Object Versioning is enabled, choose one of the following deletion options:
Select Delete all versions of the objects to remove both
live and noncurrent versions.
Select Permanently delete live versions to remove only the
live version.
If Object Versioning is not enabled, any objects selected for deletion are permanently deleted.
Click Next.
In the Name operation & specify objects pane, do the following:
In the Name field, enter a name.
Optional: In the Description field, enter a description.
In the Specify objects section, define a criterion to process
objects from the bucket. Choose one of the following options:
Select all objects: Includes all objects in the bucket.
Select objects by using prefix filters: To define the list of
objects by using prefix filters, do the following:
In the Enter Prefixes of the objects to be included field,
enter a prefix.
Optional: Click + Add prefix to specify additional
prefixes.
Upload lists of objects using manifest CSV files: To use a
manifest file for selecting objects, do the following:
Upload your manifest CSV file to a bucket. This
file must contain headers for Bucket name, Object key,
and Generation number.
In the Select manifest file mode list, choose one of the following options:
If you select Select a manifest file from Cloud Storage,
click Browse in the Select a manifest file from Cloud
Storage field. In the Select object dialog that
appears, navigate to your manifest CSV file, then click Select.
If you select Select multiple manifest files using wildcard,
enter the file path in the Enter manifest file location using
wildcard field. For example, bucket-name/folder/manifest_*.
Click Create.
Command line
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a
Cloud Shell
session starts and displays a command-line prompt. Cloud Shell is a shell environment
with the Google Cloud CLI
already installed and with values already set for
your current project. It can take a few seconds for the session to initialize.
To set the default project, run the gcloud config set project command:
gcloud config set project PROJECT_ID
Where PROJECT_ID is the ID of your project.
Optional: Run a dry run job. Before executing any job, we recommend that you run the job in dry run mode to verify the object selection criteria and check for any errors. The dry run does not modify any objects.
gcloud storage batch-operations jobs create JOB_NAME\
--bucket=BUCKET_NAMEOBJECT_SELECTION_FLAGJOB_TYPE_FLAG
Where the parameters are as follows:
DRY_RUN_JOB_NAME is the name of the storage batch operations dry run job.
JOB_NAME is the name of the storage batch operations job.
BUCKET_NAME is the name of the bucket that contains one or more objects you want to process.
OBJECT_SELECTION_FLAG is one of the following flags that you need to specify:
--included-object-prefixes: Specify one or more object prefixes. For example:
To match a single prefix, use: --included-object-prefixes='prefix1'.
To match multiple prefixes, use a comma-separated prefix list: --included-object-prefixes='prefix1,prefix2'.
To include all objects, use an empty prefix: --included-object-prefixes=''.
--manifest-location: Specify the manifest location. For example, gs://bucket_name/path/object_name.csv.
JOB_TYPE_FLAG is one of the following flags that you need to specify, depending on the job type.
--delete-object: Delete one or more objects.
If Object Versioning is enabled for the bucket, current objects transition to a noncurrent state, and noncurrent objects are skipped.
If Object Versioning is disabled for the bucket, the delete operation permanently deletes objects and skips noncurrent objects.
--enable-permanent-object-deletion: Permanently delete objects. Use this flag along with the --delete-object flag to permanently delete both live and noncurrent objects in a bucket, regardless of the bucket's object versioning configuration.
--put-metadata: Update object metadata. Specify the key-value pair for the object metadata you want to modify. You can specify one or more key-value pairs as a list. You can also set object retention configurations using the --put-metadata flag. To do so, specify the retention parameters using the Retain-Until and Retention-Mode fields. For example,
RETAIN_UNTIL_TIME is the date and time, in RFC 3339
format, until which the object is retained. For example,
2025-10-09T10:30:00Z. To set the retention configuration on an object, you'll
need to enable retention on the bucket which contains the object.
RETENTION_MODE is the retention mode, either Unlocked or
Locked.
When you send a request to update the RETENTION_MODE and RETAIN_UNTIL_TIME fields,
consider the following:
To update the object retention configuration, you must provide non-empty values for both
RETENTION_MODE and RETAIN_UNTIL_TIME fields; setting only one results in
an INVALID_ARGUMENT error.
You can extend the RETAIN_UNTIL_TIME value for objects in both Unlocked
or Locked modes.
The object retention must be in Unlocked mode if you want to do the
following:
Reduce the RETAIN_UNTIL_TIME value.
Remove the retention configuration. To remove the configuration, you'll need to
provide empty values for both RETENTION_MODE and RETAIN_UNTIL_TIME
fields.
If you omit both RETENTION_MODE and RETAIN_UNTIL_TIME fields, the
retention configuration remains unchanged.
--clear-all-object-custom-contexts: Delete all existing object contexts.
The following example shows how to create a job to clear all object contexts for objects listed in manifest.csv:
--clear-object-custom-contexts: Remove contexts with specific keys. You can also update specific contexts along with removing keys by using both the --clear-object-custom-contexts flag and one of the following flags:
--update-object-custom-contexts: Provide a map of key-value pairs.
The following example shows how to create a job to remove the context with key temp-id and update or insert context with key project-id and cost-center for all objects listed in manifest.csv:
METADATA_KEY/VALUE is the
object's metadata key-value pair. You can specify
one or more pairs.
RETAIN_UNTIL_TIME is the date and time, in RFC 3339
format, until which the object is retained. For example,
2025-10-09T10:30:00Z. To set the retention configuration on an object, you'll
need to enable retention on the bucket which contains the object.
RETENTION_MODE is the retention mode, either Unlocked or
Locked.
When you send a request to update the RETENTION_MODE and RETAIN_UNTIL_TIME fields,
consider the following:
To update the object retention configuration, you must provide non-empty values for both
RETENTION_MODE and RETAIN_UNTIL_TIME fields; setting only one results in
an INVALID_ARGUMENT error.
You can extend the RETAIN_UNTIL_TIME value for objects in both Unlocked
or Locked modes.
The object retention must be in Unlocked mode if you want to do the
following:
Reduce the RETAIN_UNTIL_TIME value.
Remove the retention configuration. To remove the configuration, you'll need to
provide empty values for both RETENTION_MODE and RETAIN_UNTIL_TIME
fields.
If you omit both RETENTION_MODE and RETAIN_UNTIL_TIME fields, the
retention configuration remains unchanged.
PROJECT_ID is the ID or number of the project. For example, my-project.
JOB_NAME is the name of the storage batch operations job.
Get storage batch operations job details
This section describes how to get the storage batch operations job details.
To get the permissions that
you need to view a storage batch operations job,
ask your administrator to grant you the
Storage Admin (roles/storage.admin) IAM role on the project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
At the bottom of the Google Cloud console, a
Cloud Shell
session starts and displays a command-line prompt. Cloud Shell is a shell environment
with the Google Cloud CLI
already installed and with values already set for
your current project. It can take a few seconds for the session to initialize.
This section describes how to list the storage batch operations jobs within a project.
To get the permissions that
you need to list storage batch operations jobs,
ask your administrator to grant you the
Storage Admin (roles/storage.admin) IAM role on the project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
At the bottom of the Google Cloud console, a
Cloud Shell
session starts and displays a command-line prompt. Cloud Shell is a shell environment
with the Google Cloud CLI
already installed and with values already set for
your current project. It can take a few seconds for the session to initialize.
PROJECT_ID is the ID or number of
the project. For example, my-project.
Cancel a storage batch operations job
This section describes how to cancel a storage batch operations job within a project.
To get the permissions that
you need to cancel a storage batch operations job,
ask your administrator to grant you the
Storage Admin (roles/storage.admin) IAM role on the project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
At the bottom of the Google Cloud console, a
Cloud Shell
session starts and displays a command-line prompt. Cloud Shell is a shell environment
with the Google Cloud CLI
already installed and with values already set for
your current project. It can take a few seconds for the session to initialize.
PROJECT_ID is the ID or number of
the project. For example, my-project.
JOB_ID is the name of the storage batch operations job.
Delete a storage batch operations job
This section describes how to delete a storage batch operations job.
To get the permissions that
you need to delete a storage batch operations job,
ask your administrator to grant you the
Storage Admin (roles/storage.admin) IAM role on the project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
In the bucket list, click the name of the bucket associated with the
storage batch operation that you want to delete.
Click the Operations tab. This tab displays a list of batch operation
jobs. You can delete only jobs that aren't running, such as
jobs that succeeded, failed, or were canceled.
In the list of operations, select one or multiple jobs that you want to
delete, and then click Delete.
Command line
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a
Cloud Shell
session starts and displays a command-line prompt. Cloud Shell is a shell environment
with the Google Cloud CLI
already installed and with values already set for
your current project. It can take a few seconds for the session to initialize.
PROJECT_ID is the ID or number of
the project. For example, my-project.
JOB_ID is the name of the storage batch operations job.
Create a storage batch operations job using Storage Insights datasets
To create a storage batch operations job using Storage Insights
datasets, complete the steps in the following sections.
To get the permissions that
you need to create a storage batch operations job,
ask your administrator to grant you the
Storage Admin (roles/storage.admin) IAM role on the project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
You can create the manifest for your storage batch operations job by
extracting data from BigQuery. To do so, you'll need to query the
linked dataset, export the resulting data as a CSV file, and save it to a
Cloud Storage bucket. The storage batch operations job can
then use this CSV file as its manifest.
Running the following SQL query in BigQuery on a Storage Insights
dataset view retrieves objects larger than 1 KiB that are named Temp_Training:
EXPORT DATA OPTIONS(
uri=`URI`,
format=`CSV`,
overwrite=OVERWRITE_VALUE,
field_delimiter=',') AS
SELECT bucket, name, generation
FROM DATASET_VIEW_NAME
WHERE bucket = BUCKET_NAME
AND name LIKE (`Temp_Training%`)
AND size > 1024 * 1024
AND snapshotTime = SNAPSHOT_TIME
Where:
URI is the URI to the bucket that contains the manifest. For example, gs://bucket_name/path_to_csv_file/*.csv. When you use the *.csv wildcard, BigQuery exports the result to multiple CSV files.
OVERWRITE_VALUE is a boolean value. If set to true, the export operation overwrites existing files at the specified location.
DATASET_VIEW_NAME is the fully qualified name of the Storage Insights dataset view in PROJECT_ID.DATASET_ID.VIEW_NAME format. To find the name of your dataset, view the linked dataset.
Where:
PROJECT_ID is the ID or number of the project. For example, my-project.
DATASET_ID is the name of the dataset. For example, objects-deletion-dataset.
VIEW_NAME is the name of the dataset view. For example, bucket_attributes_view.
BUCKET_NAME is the name of the bucket. For example, my-bucket.
SNAPSHOT_TIME is the snapshot time of the Storage Insights dataset view. For example, 2024-09-10T00:00:00Z.
Create a storage batch operations job using a manifest file
To create a storage batch operations job to process objects contained in the manifest, complete the following steps:
Console
In the Google Cloud console, go to the Cloud Storage Buckets page.
If Object Versioning is enabled, choose one of the following deletion options:
Select Delete all versions of the objects to remove both
live and noncurrent versions.
Select Permanently delete live versions to remove only the
live version.
If Object Versioning is not enabled, any objects selected for deletion are permanently deleted.
Click Next.
In the Name operation & specify objects pane, do the following:
In the Name field, enter a name.
Optional: In the Description field, enter a description.
In the Specify objects section, select Upload lists of
objects using manifest CSV files, and then do the following:
Upload your manifest CSV file to a bucket. This
file must contain headers for Bucket name, Object key,
and Generation number.
In the Select manifest file mode list, choose one of the following options:
If you select Select a manifest file from Cloud Storage,
click Browse in the Select a manifest file from Cloud
Storage field. In the Select object dialog that
appears, navigate to your manifest CSV file, then click Select.
If you select Select multiple manifest files using wildcard,
enter the file path in the Enter manifest file location using
wildcard field. For example, bucket-name/folder/manifest_*.
Click Create.
Command line
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a
Cloud Shell
session starts and displays a command-line prompt. Cloud Shell is a shell environment
with the Google Cloud CLI
already installed and with values already set for
your current project. It can take a few seconds for the session to initialize.
JOB_ID is the name of the storage batch operations job.
SOURCE_BUCKET_NAME is the bucket that contains one or more objects you want to process. For example, my-bucket.
URI is the URI to the bucket that contains the manifest. For example, gs://bucket_name/path_to_csv_file/*.csv. When you use the *.csv wildcard, BigQuery exports the result to multiple CSV files.
JOB_TYPE_FLAG is one of the following flags, depending on the job type.
--delete-object: Delete one or more objects.
--put-metadata: Update object metadata. Object metadata is stored as key-value pairs. Specify the key-value pair for the metadata you want to modify. You can specify one or more key-value pairs as a list. You can also provide object retention configurations using the --put-metadata flag.
--clear-object-custom-contexts: Remove contexts with specific keys. You can also update specific contexts along with removing keys by using both the --clear-object-custom-contexts flag and one of the following flags:
--update-object-custom-contexts: Provide a map of key-value pairs.
The following example shows how to create a job to remove the context with key temp-id and update or insert context with key project-id and cost-center for all objects listed in manifest.csv:
You can provide an additional layer of security for
storage batch operations resources by using VPC Service Controls. When
you use VPC Service Controls, you add projects to service perimeters that protect
resources and services from requests that originate from outside of the
perimeter. To learn more about VPC Service Controls service perimeter details for
storage batch operations, see
Supported products and limitations.
Use Cloud Audit Logs for storage batch operations jobs
Storage batch operations jobs record transformations on Cloud Storage
objects in Cloud Storage Cloud Audit Logs. You can use Cloud Audit Logs
with Cloud Storage to track the object transformations that
storage batch operations jobs perform. For information about enabling audit
logs, see Enabling audit logs. In the audit log entry, the callUserAgent
metadata field with the value StorageBatchOperations indicates a
storage batch operations transformation.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-07-22 UTC."],[],[]]