- NAME
-
- gcloud storage batch-operations jobs create - create a new batch operation job
- SYNOPSIS
-
-
gcloud storage batch-operations jobs createBATCH_JOB--bucket=BUCKET(--included-object-prefixes=[PREFIXES,…] |--manifest-location=MANIFEST_LOCATION) (--put-metadata=KEY=VALUE,[KEY=VALUE,…] |--rewrite-object=KEY=VALUE,[KEY=VALUE,…] | [--delete-object:--enable-permanent-object-deletion] |--[no-]put-object-event-based-hold--[no-]put-object-temporary-hold) [--description=DESCRIPTION] [--log-actions=[LOG_ACTIONS,…]--log-action-states=[LOG_ACTION_STATES,…]] [GCLOUD_WIDE_FLAG …]
-
- DESCRIPTION
- Create a batch operation job, allowing you to perform operations such as deletion, updating metadata, and more on objects in a serverless manner.
- EXAMPLES
-
To create a batch job with the name
my-jobto perform object deletion on bucketmy-bucketand the manifest filegs://my-bucket/manifest.csvspecifies the objects to be transformed:gcloud storage batch-operations jobs create my-job --bucket=my-bucket --manifest-location=gs://my-bucket/manifest.csv --delete-objectTo create a batch job with the name
my-jobto update object metadataContent-DispositiontoinlineandContent-Languagetoenon bucketmy-bucketwhere you want to match objects with the prefixprefix1orprefix2:gcloud storage batch-operations jobs create my-job --bucket=my-bucket --included-object-prefixes=prefix1,prefix2 --put-metadata=Content-Disposition=inline,Content-Language=enTo create a batch job with the name
my-jobto put object event based hold on objects in bucketmy-bucketwith logging config enabled for corresponding transform action and succeeded and failed action states:gcloud storage batch-operations jobs create my-job --bucket=my-bucket --put-object-event-based-hold --put-metadata=Content-Disposition=inline,Content-Language=en --log-actions=transform --log-action-states=succeeded,failed - POSITIONAL ARGUMENTS
-
-
Batch job resource - The batch job to create. This represents a Cloud resource.
(NOTE) Some attributes are not given arguments in this group but can be set in
other ways.
To set the
projectattribute:-
provide the argument
batch_jobon the command line with a fully specified name; -
provide the argument
--projecton the command line; -
set the property
core/project.
To set the
locationattribute:-
provide the argument
batch_jobon the command line with a fully specified name; -
The default is
global.
This must be specified.
BATCH_JOB-
ID of the batch-job or fully qualified identifier for the batch-job.
To set the
batch-jobattribute:-
provide the argument
batch_jobon the command line.
-
provide the argument
-
provide the argument
-
Batch job resource - The batch job to create. This represents a Cloud resource.
(NOTE) Some attributes are not given arguments in this group but can be set in
other ways.
- REQUIRED FLAGS
-
--bucket=BUCKET- Bucket containing the objects that the batch job will operate on.
-
Source specifying objects to perform batch operations on. Must be one of
--manifest-location=``MANIFEST_LOCATIONor--included-object-prefixes=``COMMA_SEPARATED_PREFIXESExactly one of these must be specified:
--included-object-prefixes=[PREFIXES,…]- A comma-separated list of object prefixes to describe the objects being transformed. An empty string means all objects in the bucket.
--manifest-location=MANIFEST_LOCATION-
An absolute path to the manifest source file in a Google Cloud Storage bucket.
The file must be a CSV file where each row specifies the object details i.e.
ProjectId, BucketId, and Name. Generation may optionally be specified. When
generation is not specified, the live object is acted upon. Format:
--manifest-location=gs://bucket_name/path/manifest_name.csv
-
Transformation to be performed on the objects.
Exactly one of these must be specified:
--put-metadata=KEY=VALUE,[KEY=VALUE,…]-
Sets object metadata. To set how content should be displayed, specify the the
key-value pair
Content-Disposition={VALUE}.To set how content is encoded (e.g. "gzip"), specify the key-value pairContent-Encoding={VALUE}. To set content's language (e.g. "en" signifies "English"), specify the key-value pairContent-Language={VALUE}. To set the type of data contained in the object (e.g. "text/html"), specify the key-value pairContent-Type={VALUE}. To set how caches should handle requests and responses, specify the key-value pairCache-Control={VALUE}. To set custom time for Cloud Storage objects in RFC 3339 format, specify the key-value pairCustom-Time={VALUE}. To set custom metadata on objects, specify key-value pairs{CUSTOM-KEY}:{VALUE}. Note that all predefined keys (e.g. Content-Disposition) are case-insensitive. Any other key that is not specified above will be treated as a custom key. Multiple key-value pairs can be specified by separating them with commas. For example,--put-metadata=Content-Disposition=inline,Content-Encoding=gzip --rewrite-object=KEY=VALUE,[KEY=VALUE,…]-
Rewrites object and the specified metadata. Currently only supports rewriting
kms-key. A metadata field MUST be specified. For example,
--rewrite-object=kms-key=projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/CRYPTO_KEYwill rewrite the Cloud KMS key that will be used to encrypt the object. -
Describes options to delete objects.
--delete-object-
If this flag is set, objects specified in source will be deleted. When
versioning is enabled on the buckets, live objects in versioned buckets will
become noncurrent and objects that were already noncurrent will be skipped.
This flag argument must be specified if any of the other arguments in this group are specified.
--enable-permanent-object-deletion- If this flag is set and versioning is enabled on the buckets, both live and noncurrent objects will be permanently deleted.
-
Describes options to update object hold.
--[no-]put-object-event-based-hold-
Sets or unsets object event based holds state. When object event based hold is
set, object cannot be deleted or replaced. Use
--put-object-event-based-holdto enable and--no-put-object-event-based-holdto disable. --[no-]put-object-temporary-hold-
Sets or unsets object temporary holds state. When object temporary hold is set,
object cannot be deleted or replaced. Use
--put-object-temporary-holdto enable and--no-put-object-temporary-holdto disable.
- FLAGS
-
--description=DESCRIPTION- Description for the batch job.
- LOGGING_CONFIG FLAGS
-
-
LOGGING CONFIG
Configure which transfer actions and action states are reported when logs are generated for this job. Logs can be viewed by running the following command: gcloud logging read "resource.type=storagebatchoperations.googleapis.com/Job"
--log-actions=[LOG_ACTIONS,…]-
Define the batch job actions to report in logs. (e.g., --log-actions=transform).
LOG_ACTIONSmust be (only one value is supported):transform. --log-action-states=[LOG_ACTION_STATES,…]-
The states in which the actions specified in --log-actions are logged. Separate
multiple states with a comma, omitting the space after the comma (e.g.,
--log-action-states=succeeded,failed).
LOG_ACTION_STATESmust be one of:failed,succeeded.
-
LOGGING CONFIG
- GCLOUD WIDE FLAGS
-
These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$ gcloud helpfor details. - NOTES
-
This variant is also available:
gcloud alpha storage batch-operations jobs create
gcloud storage batch-operations jobs create
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-24 UTC.