gcloud alpha batch jobs submit Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud alpha batch jobs submit - submit a Batch job
- SYNOPSIS
gcloud alpha batch jobs submit[[JOB]--location=LOCATION](--config=PATH_TO_FILE--container-commands-file=CONTAINER_COMMANDS_FILE--container-entrypoint=CONTAINER_ENTRYPOINT--container-image-uri=CONTAINER_IMAGE_URI|--script-file-path=SCRIPT_FILE_PATH|--script-text=SCRIPT_TEXT)[--job-prefix=JOB_PREFIX][--machine-type=MACHINE_TYPE][--priority=PRIORITY][--provisioning-model=PROVISIONING_MODEL][--network=NETWORK--subnetwork=SUBNETWORK:--no-external-ip-address][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
(ALPHA)This command creates and submits a Batch job. After youcreate and submit the job, Batch automatically queues, schedules, and executesit.- EXAMPLES
- To submit a job with a sample JSON configuration file (config.json) and name
projects/foo/locations/us-central1/jobs/bar, run:gcloudalphabatchjobssubmitprojects/foo/locations/us-central1/jobs/bar--config=config.jsonTo submit a job with a sample YAML configuration file (config.yaml) and nameprojects/foo/locations/us-central1/jobs/bar, run:
gcloudalphabatchjobssubmitprojects/foo/locations/us-central1/jobs/bar--config=config.yamlTo submit a job through stdin with a sample job configuration and name
projects/foo/locations/us-central1/jobs/bar, run:gcloudalphabatchjobssubmitprojects/foo/locations/us-central1/jobs/bar--config=-theninputjsonjobconfigviastdin{jobconfig}
To submit a job through HereDoc with a sample job configuration and name
projects/foo/locations/us-central1/jobs/bar, run:gcloudalphabatchjobssubmitprojects/foo/locations/us-central1/jobs/bar--config=- <<EOF{jobconfig}EOF
For details about how to define a job's configuration using JSON, see theprojects.locations.jobs resource in the Batch API Reference. If you want todefine a job's configuration using YAML, convert the JSON syntax to YAML.
- POSITIONAL ARGUMENTS
- Job resource - The Batch job resource. If --location not specified,the currentbatch/location is used. The arguments in this group can be used to specify theattributes of this resource. (NOTE) Some attributes are not given arguments inthis group but can be set in other ways.
To set the
projectattribute:- provide the argument
JOBon the command line with a fully specifiedname; - job ID is optional and will be generated if not specified with a fully specifiedname;
- provide the argument
--projecton the command line; - set the property
core/project.
- [
JOB] - ID of the job or fully qualified identifier for the job.
To set the
jobattribute:- provide the argument
JOBon the command line; - job ID is optional and will be generated if not specified.
- provide the argument
--location=LOCATION- Google Cloud location for the job.
To set the
locationattribute:- provide the argument
JOBon the command line with a fully specifiedname; - job ID is optional and will be generated if not specified with a fully specifiedname;
- provide the argument
--locationon the command line; - set the property
batch/location.
- provide the argument
- provide the argument
- Job resource - The Batch job resource. If --location not specified,the currentbatch/location is used. The arguments in this group can be used to specify theattributes of this resource. (NOTE) Some attributes are not given arguments inthis group but can be set in other ways.
- REQUIRED FLAGS
- At least one of these must be specified:
--config=PATH_TO_FILE- The file path of the job config file in either JSON or YAML format. It alsosupports direct input from stdin with '-' or HereDoc (in shells with HereDocsupport like Bash) with '- <<DELIMITER'.
Use a full or relative path to a local file containing the value of config.
- Either specify the config file for the job or the first runnable in the taskspec. Specify either a script file or container arguments for the first runnablein the task spec.
At most one of these can be specified:
- Options to specify the container arguments for the first runnable in the taskspec.
--container-commands-file=CONTAINER_COMMANDS_FILE- Overrides the
CMDspecified in the container. If there is anENTRYPOINT (either in the container image or with the entrypoint field below)then commands are appended as arguments to the ENTRYPOINT. --container-entrypoint=CONTAINER_ENTRYPOINT- Overrides the
ENTRYPOINTspecified in the container. --container-image-uri=CONTAINER_IMAGE_URI- The URI to pull the container image from.
- Either specify a path to a script file to run or provide inline text to executedirectly.
At most one of these can be specified:
--script-file-path=SCRIPT_FILE_PATH- Path to script file to run as first runnable in task spec. File path should be avalid path on the instance volume.
--script-text=SCRIPT_TEXT- Text to run as first runnable in task spec.
- Options to specify the container arguments for the first runnable in the taskspec.
- At least one of these must be specified:
- OPTIONAL FLAGS
--job-prefix=JOB_PREFIX- Specify the job prefix. A job ID in the format of job prefix + %Y%m%d-%H%M%Swill be generated. Note that job prefix cannot be specified while JOB IDpositional argument is specified.
--machine-type=MACHINE_TYPE- Specify the Compute Engine machine type, for example, e2-standard-4. Currentlyonly one machine type is supported.
--priority=PRIORITY- Job priority [0-99] 0 is the lowest priority.
--provisioning-model=PROVISIONING_MODEL- Specify the allowed provisioning model for the compute instances.
PROVISIONING_MODELmust be one of:SPOT- The SPOT VM provisioning model. Ideal for fault-tolerant workloads that canwithstand preemption.
STANDARD- The STANDARD VM provisioning model
--network=NETWORK- The URL for the network resource. Must specify subnetwork as well if network isspecified
--subnetwork=SUBNETWORK- The URL for the subnetwork resource. Must specify network as well if subnetworkis specified
--no-external-ip-address- Required if no external public IP address is attached to the VM. If no externalpublic IP address, additional configuration is required to allow the VM toaccess Google Services.
- 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 command is currently in alpha and might change without notice. If thiscommand fails with API permission errors despite specifying the correct project,you might be trying to access an API with an invitation-only early accessallowlist. These variants are also available:
gcloudbatchjobssubmitgcloudbetabatchjobssubmit
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-22 UTC.