Create and manage workflows
Stay organized with collections
Save and categorize content based on your preferences.
You can create and manage workflows in the Google Cloud console, or by using the
Google Cloud CLI in either your terminal or Cloud Shell. You can also
manage workflows through the Workflows API.
A service account represents the identity of a workflow and determines what
permissions the workflow has and which Google Cloud resources it can
access. Create a service account if you don't already have one; then grant it
the roles necessary for
managing workflows and
creating logs.
We strongly recommend using a service account with the least privileges
necessary to access the required resources.
Note that to create a resource and attach a service account, you need
permissions to create that resource and to impersonate the service account that
you will attach to the resource. For more information, see
Service account permissions.
A workflow definition is made up of a series of steps described using the
Workflows syntax, which can be written in
either YAML or JSON format. After defining a workflow, you deploy it to make it
available for execution. The deploy step also validates that the source file can
be executed. It fails if the source file doesn't contain a valid workflow
definition.
Enter a name for the workflow, such as myFirstWorkflow. The name can
contain letters, numbers, underscores, and hyphens. It must start with a
letter and end with a number or letter.
Optionally, add a description of the workflow.
In the Region list, select an appropriate
location to deploy your workflow in; for
example, us-central1.
In the Service account list, select a service account that your
workflow will use to access other Google Cloud services. For more
information, in this document, see
Create a service account.
Optionally, do any of the following:
Specify the level of
call logging that you want
to apply to the workflow definition. In the Call log level list,
select one of:
Not specified: no logging level is specified. This is the default.
An execution log level takes precedence over any workflow log level, unless
the execution log level is not specified (the default); in that case, the
workflow log level applies.
Errors only: log all caught exceptions; or when a call is stopped
due to an exception.
All calls: log all calls to subworkflows or library functions and
their results.
No logs: no call logging.
Specify the level of
execution history that you want to apply
to the workflow definition. In the Execution history list, select
one of:
Basic: enable basic execution history. This is the default.
Detailed: enable detailed execution history
including any in-scope variable values and the expected number of iterations.
Specify a Cloud Key Management Service key that the workflow should use for
data encryption: select Customer-managed encryption key (CMEK). For
more information, see
Use customer-managed encryption keys.
Specify an environment variable that is accessible by your workflow
at runtime. For more information, see
Use environment variables.
Add a label: labels are key-value pairs that help you organize your
Google Cloud instances. For more information, see
What are labels?
Workflow labels are inherited by executions of the workflow. To view
execution labels, use the workflows.executions.list method to
list and filter workflow executions.
WORKFLOW_NAME: the name of your workflow—for
example, myFirstWorkflow. The name can contain letters, numbers,
underscores, and hyphens. It must start with a letter and end with a
number or letter.
LOCATION: the
region to deploy your workflow in; for
example, us-central1.
CALL_LOGGING_LEVEL: optional. Level of
call logging to apply during
execution. Can be one of:
none: no logging level is specified. This is the default. An
execution log level takes precedence over any workflow log level,
unless the execution log level is not specified (the default); in that
case, the workflow log level applies.
log-errors-only: log all caught exceptions; or when a call is
stopped due to an exception.
log-all-calls: log all calls to subworkflows or library
functions and their results.
log-none: no call logging.
DESCRIPTION: optional. A description of the
workflow.
EXECUTION_HISTORY_LEVEL: optional. Level of
execution history to apply during
execution. Can be one of:
none: no execution history level is specified. This is the
default. If an execution history level is not specified for an execution, it
is determined by the level applied to the workflow. If the levels are
different, the setting applied at the execution level overrides the setting
applied at the workflow level for this execution.
execution-history-basic: enable basic execution history.
execution-history-detailed: enable detailed execution history
including any in-scope variable values and the expected number of iterations.
LABEL_KEY=LABEL_VALUE: optional.
List of label key-value pairs that helps you organize your
Google Cloud instances; for example, name=wrench. For more
information, see
What are labels?
Workflow labels are inherited by executions of the workflow. To view
execution labels, use the workflows.executions.list method to
list and filter workflow executions.
ENV_KEY=ENV_VALUE: optional. List of
environment variable key-value pairs; for example, MONTH=January. For
more information, see
Use environment variables.
ENCRYPT_KEY: optional. A Cloud KMS
key that the workflow should use for data encryption in the format
projects/PROJECT_NAME/locations/LOCATION/keyRings/RING_NAME/cryptoKeys/KEY_NAME.
For more information, see
Use customer-managed encryption keys.
SERVICE_ACCOUNT@PROJECT_ID.iam.gserviceaccount.com:
optional. The service account your workflow will use to access other
Google Cloud services. For more information, in this document,
see Create a service account.
YAML_OR_JSON_SOURCE_FILE: the source file for
the workflow definition. For example: myFirstWorkflow.yaml.
REST
To create a new workflow with a specified name, use the
projects.locations.workflows.create
method, and use the workflowId query parameter to specify an ID for the
workflow.
Before using any of the request data,
make the following replacements:
WORKFLOW_NAME: the name of your
workflow—for example, myFirstWorkflow. The name can contain letters, numbers,
underscores, and hyphens. It must start with a letter and end with a number or letter.
DESCRIPTION: optional. A description
of your workflow. Must be no longer than 1000 Unicode characters.
LABEL_KEY and
LABEL_VALUE: optional. A map of label
key and value pairs that help you organize your Google Cloud instances. For example:
{"name": "wrench", "mass": "1kg", "count": "3"} For more information, see
What are labels? Workflow
labels are inherited by executions of the workflow. To view execution labels, use the
workflows.executions.list method to
list and filter workflow executions.
ENCRYPT_KEY: optional. A
Cloud KMS key that the workflow should use for data encryption in the format
projects/PROJECT_NAME/locations/LOCATION/keyRings/RING_NAME/cryptoKeys/KEY_NAME.
For more information, see Use customer-managed encryption keys.
CALL_LOGGING_LEVEL: optional.
The call logging level to apply during execution. The default is that no logging level is
specified and the workflow log level applies instead. For more information, see
Send Logs to Logging. One of the
following:
CALL_LOG_LEVEL_UNSPECIFIED: no logging level is specified and the
workflow log level applies instead. This is the default. Otherwise, the execution log level
applies and takes precedence over the workflow log level.
LOG_ERRORS_ONLY: log all caught exceptions; or when a call is
stopped due to an exception.
LOG_ALL_CALLS: log all calls to subworkflows or library functions
and their results.
LOG_NONE: no call logging.
EXECUTION_HISTORY_LEVEL:
optional. The execution history level to apply during execution. For more information, see
View history of execution steps. One of the
following:
EXECUTION_HISTORY_LEVEL_UNSPECIFIED: no execution history level is
specified. This is the default. If an execution history level is not specified for an
execution, it is determined by the level applied to the workflow. If the levels are
different, the setting applied at the execution level overrides the setting applied at the
workflow level for this execution.
EXECUTION_HISTORY_BASIC: enable basic execution history.
EXECUTION_HISTORY_ADVANCED: enable detailed execution history
including any in-scope variable values and the expected number of iterations.
ENV_KEY and
ENV_VALUE: optional. A map of
environment variable key and value pairs; for example,
{ "month": "January", "day": "Monday"}. For more information, see
Use environment variables.
SOURCE_CODE: the workflow
definition. You must escape new lines in YAML. For example:
main:\n params:\n - input\n steps:\n - returnOutput:\n return: Hello
You must escape quotation marks in JSON. For example:
{\"main\":{\"params\":[\"input\"],\"steps\":[{\"returnOutput\":{\"return\":\"Hello\"}}]}}
LOCATION: the
region in which the workflow is to be deployed—for
example, us-central1.
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Save the request body in a file named request.json.
Run the following command in the terminal to create or overwrite
this file in the current directory:
Save the request body in a file named request.json.
Run the following command in the terminal to create or overwrite
this file in the current directory:
Copy the request body and open the
method reference page.
The APIs Explorer panel opens on the right side of the page.
You can interact with this tool to send requests.
Paste the request body in this tool, complete any other required fields, and click Execute.
If successful, the response body contains a newly created instance of
Operation:
You can update an existing workflow. You must specify the name of the workflow
you want to update and its source. Note that you can't change a workflow's name
or location.
Updating a workflow does not affect in-progress executions. Only future
executions of the workflow will use the updated configuration.
Each time you update a workflow, its versionID is updated. The versionID
consists of two parts, separated by a hyphen:
A number, starting at one, that increments each time you update a workflow.
A random, three-character, alphanumeric string.
For example, 000001-27f indicates the initial version of a workflow and
000002-d52 indicates a workflow that has been updated once.
Console
In the Google Cloud console, go to the Workflows
page.
Click the name of the workflow you want to update. Note that you can't
change the workflow's name.
The Workflow details page appears.
You can edit the workflow in the following ways:
To edit the source:
Click the Source tab.
Click Edit.
To save your changes, click Save. The updated workflow is
deployed.
To update the description, the service account the workflow uses for
authentication, the call log level, environment variables, labels, or
the encryption key:
Click the Details tab.
Click the appropriate
edit
icon.
If you are updating the call log level, select one of:
Not specified: no logging level is specified. This is the default.
An execution log level takes precedence over any workflow log level, unless
the execution log level is not specified (the default); in that case, the
workflow log level applies.
Errors only: log all caught exceptions; or when a call is stopped
due to an exception.
All calls: log all calls to subworkflows or library functions and
their results.
No logs: no call logging.
If you are updating the execution history level, select one of:
Basic: enable basic execution history. This is the default.
Detailed: enable detailed execution history
including any in-scope variable values and the expected number of iterations.
If you update an existing label, or add a new one, it can take up
to 10 minutes for the new label to take effect. Workflow labels are
inherited by executions of the workflow. To view execution labels,
use the workflows.executions.list method to
list and filter workflow executions.
To save your changes, click Save. The updated workflow is
deployed.
To edit the previous fields at the same time, or add or update a
trigger:
Click
editEdit.
To edit the source, click Next.
To save your changes and deploy the updated workflow, click
Deploy.
If you want to update the roles for your service account, click the
Permissions tab.
Principals are users, groups, domains, or service accounts. To update
an existing principal:
Find a row containing the principal.
Click
editEdit principal in that
row.
Click addAdd another
role or click deleteDelete
role.
If you are adding a role, in the Select a role list, select an
appropriate role.
To add another role, click Add another role.
Click Save.
gcloud
Open a terminal.
Find the name of the workflow you want to update. If you don't know the
workflow's name, you can enter the following command to list all your
workflows:
gcloudworkflowslist
Locate the YAML or JSON file where your workflow source is saved,
such as WORKFLOW_NAME.YAML or
WORKFLOW_NAME.JSON.
You can update an existing workflow to change its source, description,
labels, environment variables, the call log level, encryption key, or its
associated service account using the
gcloud workflows deploy
command.
You must specify the name of the workflow you want to update and its
source; however, the rest of the flags are optional. To remove a
customer-managed encryption key,
use the --clear-kms-key flag.
WORKFLOW_NAME: required. The name of your
workflow.
CALL_LOGGING_LEVEL: optional. Level of
call logging to apply during
execution. Can be one of:
none: no logging level is specified. This is the default. An
execution log level takes precedence over any workflow log level,
unless the execution log level is not specified (the default); in that
case, the workflow log level applies.
log-errors-only: log all caught exceptions; or when a call is
stopped due to an exception.
log-all-calls: log all calls to subworkflows or library
functions and their results.
log-none: no call logging.
DESCRIPTION: optional. A description of the
workflow.
EXECUTION_HISTORY_LEVEL: optional. Level of
execution history to apply during
execution. Can be one of:
none: no execution history level is specified. This is the
default. If an execution history level is not specified for an execution, it
is determined by the level applied to the workflow. If the levels are
different, the setting applied at the execution level overrides the setting
applied at the workflow level for this execution.
execution-history-basic: enable basic execution history.
execution-history-detailed: enable detailed execution history
including any in-scope variable values and the expected number of iterations.
LABEL_KEY=LABEL_VALUE: optional.
List of label key-value pairs that helps you organize your
Google Cloud instances; for example, name=wrench. For more
information, see
What are labels?
Workflow labels are inherited by executions of the workflow. To view
execution labels, use the workflows.executions.list method to
list and filter workflow executions.
ENV_KEY=ENV_VALUE: optional. List of
environment variable key-value pairs; for example, MONTH=January. For
more information, see
Use environment variables.
ENCRYPT_KEY: optional. A Cloud KMS
key that the workflow should use for data encryption in the format
projects/PROJECT_NAME/locations/LOCATION/keyRings/RING_NAME/cryptoKeys/KEY_NAME.
For more information, see
Use customer-managed encryption keys.
YAML_OR_JSON_SOURCE_FILE: required. The source
file for the workflow in either YAML or JSON format. For example:
myFirstWorkflow.yaml.
REST
To update an existing workflow, use the
projects.locations.workflows.patch
method and optionally use the updateMask query parameter to specify a list
of fields to be updated.
Before using any of the request data,
make the following replacements:
WORKFLOW_NAME: the name of your
workflow—for example, myFirstWorkflow.
DESCRIPTION: optional. A description
of your workflow. Must be no longer than 1000 Unicode characters.
LABEL_KEY and
LABEL_VALUE: optional. A map of label
key and value pairs that help you organize your Google Cloud instances. For example:
{"name": "wrench", "mass": "1kg", "count": "3"} For more information, see
What are labels? Workflow
labels are inherited by executions of the workflow. To view execution labels, use the
workflows.executions.list method to
list and filter workflow executions.
ENCRYPT_KEY: optional. A
Cloud KMS key that the workflow should use for data encryption in the format
projects/PROJECT_NAME/locations/LOCATION/keyRings/RING_NAME/cryptoKeys/KEY_NAME.
For more information, see Use customer-managed encryption keys.
CALL_LOGGING_LEVEL: optional.
The call logging level to apply during execution. The default is that no logging level is
specified and the workflow log level applies instead. For more information, see
Send Logs to Logging. One of the
following:
CALL_LOG_LEVEL_UNSPECIFIED: no logging level is specified and the
workflow log level applies instead. This is the default. Otherwise, the execution log level
applies and takes precedence over the workflow log level.
LOG_ERRORS_ONLY: log all caught exceptions; or when a call is
stopped due to an exception.
LOG_ALL_CALLS: log all calls to subworkflows or library functions
and their results.
LOG_NONE: no call logging.
EXECUTION_HISTORY_LEVEL:
optional. The execution history level to apply during execution. For more information, see
View history of execution steps. One of the
following:
EXECUTION_HISTORY_LEVEL_UNSPECIFIED: no execution history level is
specified. This is the default. If an execution history level is not specified for an
execution, it is determined by the level applied to the workflow. If the levels are
different, the setting applied at the execution level overrides the setting applied at the
workflow level for this execution.
EXECUTION_HISTORY_BASIC: enable basic execution history.
EXECUTION_HISTORY_ADVANCED: enable detailed execution history
including any in-scope variable values and the expected number of iterations.
ENV_KEY and
ENV_VALUE: optional. A map of
environment variable key and value pairs; for example,
{ "month": "January", "day": "Monday"}. For more information, see
Use environment variables.
SOURCE_CODE: the minified workflow
definition. For example:
{\"main\":{\"params\":[\"input\"],\"steps\":[{\"returnOutput\":{\"return\":\"Hello\"}}]}}
LOCATION: the
region in which the workflow is deployed—for example,
us-central1.
UPDATE_FIELDS: optional. A
comma-separated list of fields to be updated. If not provided, the entire workflow is updated.
For example description,callLogLevel.
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Save the request body in a file named request.json.
Run the following command in the terminal to create or overwrite
this file in the current directory:
Save the request body in a file named request.json.
Run the following command in the terminal to create or overwrite
this file in the current directory:
Copy the request body and open the
method reference page.
The APIs Explorer panel opens on the right side of the page.
You can interact with this tool to send requests.
Paste the request body in this tool, complete any other required fields, and click Execute.
If successful, the response body contains a newly created instance of
Operation:
[[["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-06-09 UTC."],[],[]]