Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[],[],null,["# Quickstart: Create a workflow by using the Google Cloud console\n\nCreate a workflow by using the Google Cloud console\n===================================================\n\nThis quickstart shows you how to create, deploy, and execute your first workflow\nusing the Google Cloud console. The sample workflow sends a request to a\npublic API and then returns the API's response.\n\n*** ** * ** ***\n\nTo follow step-by-step guidance for this task directly in the\nGoogle Cloud console, click **Guide me**:\n\n[Guide me](https://console.cloud.google.com/freetrial?redirectPath=/?walkthrough_id=workflows--workflows_quickstart)\n\n*** ** * ** ***\n\nBefore you begin\n----------------\n\nSecurity constraints defined by your organization might prevent you from completing the\nfollowing steps. For troubleshooting information, see\n[Develop applications in a constrained Google Cloud environment](/resource-manager/docs/organization-policy/develop-apps-constrained-environment).\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n1. Enable the Workflows API.\n\n [Enable the Workflows API](https://console.cloud.google.com/marketplace/product/google/workflows.googleapis.com)\n2. In the Google Cloud console, go to the **Service Accounts**\n page.\n\n [Go to Service Accounts](https://console.cloud.google.com/iam-admin/serviceaccounts)\n3. Select a project and then click **Create service account**.\n4. In the **Service account name** field, enter a name, such as `sa-name`.\n5. Click **Create and continue**.\n6. To send logs to Cloud Logging, click the **Select a role**\n field and select **Logging \\\u003e Logs Writer**.\n\n To learn more about service account roles and permissions, see\n [Grant a workflow permission to access\n Google Cloud resources](/workflows/docs/authentication).\n7. Click **Done**.\n\n\u003cbr /\u003e\n\nCreate and deploy a workflow\n----------------------------\n\n1. In the Google Cloud console, go to the **Workflows** page:\n\n\n [Go to Workflows](https://console.cloud.google.com/workflows)\n\n \u003cbr /\u003e\n\n2. On the **Workflows** page, click add**Create**.\n\n3. Enter a name for the new workflow, such as `myFirstWorkflow`.\n\n4. Choose **us-central1** for the region.\n\n5. For **service account**, select the service account you created earlier.\n\n6. Select **Next**.\n\n7. In the workflow editor, copy and paste the following workflow:\n\n ### YAML\n\n main:\n params: [input]\n steps:\n - checkSearchTermInInput:\n switch:\n - condition: '${\"searchTerm\" in input}'\n assign:\n - searchTerm: '${input.searchTerm}'\n next: readWikipedia\n - getLocation:\n call: sys.get_env\n args:\n name: GOOGLE_CLOUD_LOCATION\n result: location\n - setFromCallResult:\n assign:\n - searchTerm: '${text.split(location, \"-\")[0]}'\n - readWikipedia:\n call: http.get\n args:\n url: 'https://en.wikipedia.org/w/api.php'\n query:\n action: opensearch\n search: '${searchTerm}'\n result: wikiResult\n - returnOutput:\n return: '${wikiResult.body[1]}'\n\n ### JSON\n\n {\n \"main\": {\n \"params\": [\n \"input\"\n ],\n \"steps\": [\n {\n \"checkSearchTermInInput\": {\n \"switch\": [\n {\n \"condition\": \"${\\\"searchTerm\\\" in input}\",\n \"assign\": [\n {\n \"searchTerm\": \"${input.searchTerm}\"\n }\n ],\n \"next\": \"readWikipedia\"\n }\n ]\n }\n },\n {\n \"getLocation\": {\n \"call\": \"sys.get_env\",\n \"args\": {\n \"name\": \"GOOGLE_CLOUD_LOCATION\"\n },\n \"result\": \"location\"\n }\n },\n {\n \"setFromCallResult\": {\n \"assign\": [\n {\n \"searchTerm\": \"${text.split(location, \\\"-\\\")[0]}\"\n }\n ]\n }\n },\n {\n \"readWikipedia\": {\n \"call\": \"http.get\",\n \"args\": {\n \"url\": \"https://en.wikipedia.org/w/api.php\",\n \"query\": {\n \"action\": \"opensearch\",\n \"search\": \"${searchTerm}\"\n }\n },\n \"result\": \"wikiResult\"\n }\n },\n {\n \"returnOutput\": {\n \"return\": \"${wikiResult.body[1]}\"\n }\n }\n ]\n }\n }\n\n Unless you input your own search term, this workflow uses your\n Google Cloud location to construct a search term, which it passes to\n the [Wikipedia API](https://wikipedia.org/w/api.php). A list of\n related Wikipedia articles is returned.\n8. Select **Deploy**.\n\nExecute the workflow\n--------------------\n\nOnce your workflow has been successfully deployed, you can execute it for the\nfirst time. After deploying the workflow, you'll be taken to its\n**Workflow details** page.\n\n1. On the **Workflow details** page, click play_arrow**Execute**.\n\n2. On the **Execute workflow** page, click **Execute**.\n\n3. In the **Output** pane, your workflow's results are displayed.\n\nYou've deployed and executed your first workflow!\n\nClean up\n--------\n\n\nTo avoid incurring charges to your Google Cloud account for\nthe resources used on this page, follow these steps.\n\n1. In the Google Cloud console, go to the **Workflows** page:\n\n\n [Go to Workflows](https://console.cloud.google.com/workflows)\n\n \u003cbr /\u003e\n\n2. From the list of workflows, click a workflow to go to its\n **Workflow details** page.\n\n3. Click delete**Delete**.\n\n4. Type the name of the workflow and then click **Confirm**.\n\nWhat's next\n-----------\n\n- [Update an existing workflow](/workflows/docs/creating-updating-workflow#updating_a_workflow)\n\n- [Control the order of execution in a workflow](/workflows/docs/controlling-execution-order)\n\n- [Sample workflows](/workflows/docs/samples)\n\n- [Workflows syntax reference](/workflows/docs/reference/syntax)"]]