Stay organized with collections
Save and categorize content based on your preferences.
This page explains how to deploy applications to App Engine using
Cloud Build. If you're new to Cloud Build, read the
quickstarts and the
build configuration overview first.
App Engine is a fully managed, serverless platform for developing and hosting
web applications at scale. For more information on App Engine, read the
App Engine documentation.
To run the gcloud commands on this page, install the
Google Cloud CLI.
Have your application source code that you want to build and deploy to App Engine
handy. Your source code needs to be stored in a repository, such as
Cloud Source Repositories, GitHub, or Bitbucket.
Required IAM permissions
In the Google Cloud console, select your project.
Grant the Cloud Build Service Account
role to the App Engine default service account. If service account does not
appear in the list, locate service account in Service Accounts page.
Set the status of the App Engine Admin role and the Service Account User
role to Enabled.
Configuring the deployment
Cloud Build lets you use any publicly available container image
to execute your tasks. You can do this by specifying the image in a build step
in the Cloud Build config file.
App Engine provides the gcloud app deploy command, which builds an image with
your source code and deploys that image on App Engine. You can use the cloud-sdk
image
as a build step in your config file to invoke gcloud commands within the image.
Arguments passed to this build step are passed to the gcloud CLI directly,
allowing you to run any gcloud command in this image.
To deploy an application to App Engine, use the following steps:
Add a name field to specify the cloud-sdk build step.
Add an entrypoint field to use the bash tool when cloud-sdk is invoked.
In the args field, invoke the gcloud app deploy command and set a timeout
for App Engine to use when it invokes Cloud Build. This is required because Cloud Build
build steps and builds have a default timeout of 10 minutes and App Engine
deployments could take longer than that to complete. Specifying a longer timeout
will make sure that the build doesn't timeout if gcloud app deploy takes
longer than 10 minutes to complete.
Timeout errors when using the App Engine standard environment:
You can configure timeouts as described here only when using the App Engine
flexible environment. The App Engine standard environment does not allow
the build timeout to be configured. If you're using Cloud Build
for deploying on the App Engine standard environment, and your build
is failing with a timeout error, consider using the App Engine flexible
environment or Cloud Run
instead of the App Engine standard environment.
{"steps":[{"name":"gcr.io/google.com/cloudsdktool/cloud-sdk","entrypoint":"bash","args":["-c","gcloud config set app/cloud_build_timeout 1600 && gcloud app deploy"]}],"timeout":"1600s"}
Start the build, where SOURCE_DIRECTORY is the path or URL to the source
code and REGION is one of the supported build regions
to start the build:
gcloudbuildssubmit--region=REGIONSOURCE_DIRECTORY
Continuous deployment
You can automate the deployment of your software to App Engine by creating
Cloud Build triggers. You can configure your triggers to build and
deploy images whenever you update your source code.
To automate your deployment to App Engine:
In your repository, add a config file with steps
to invoke the gcloud app deploy command:
[[["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 2025-08-25 UTC."],[[["\u003cp\u003eThis guide outlines how to deploy applications to App Engine using Cloud Build, a fully managed, serverless platform.\u003c/p\u003e\n"],["\u003cp\u003eTo deploy an application, you'll need to create a Cloud Build configuration file, which specifies the \u003ccode\u003ecloud-sdk\u003c/code\u003e image and uses the \u003ccode\u003egcloud app deploy\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eThe configuration requires enabling the App Engine API, installing the Google Cloud CLI, having application source code in a repository, and setting the necessary IAM permissions for Cloud Build.\u003c/p\u003e\n"],["\u003cp\u003eContinuous deployment to App Engine can be automated by creating Cloud Build triggers that are activated by code updates in your repository.\u003c/p\u003e\n"],["\u003cp\u003eWhen deploying to the App Engine flexible environment, ensure to set a build timeout in the config file, but note that this isn't configurable in the App Engine standard environment; consider using the flexible environment or Cloud Run if timeout errors occur.\u003c/p\u003e\n"]]],[],null,["# Deploying to App Engine\n\nThis page explains how to deploy applications to App Engine using\nCloud Build. If you're new to Cloud Build, read the\n[quickstarts](/build/docs/quickstarts) and the\n[build configuration overview](/build/docs/build-config) first.\n\nApp Engine is a fully managed, serverless platform for developing and hosting\nweb applications at scale. For more information on App Engine, read the\n[App Engine documentation](/appengine/docs).\n\nBefore you begin\n----------------\n\n- Enable the App Engine API:\n\n [Enable the App Engine API](https://console.cloud.google.com/apis/library/appengine.googleapis.com)\n- To run the `gcloud` commands on this page, install the\n [Google Cloud CLI](/sdk).\n\n- Have your application source code that you want to build and deploy to App Engine\n handy. Your source code needs to be stored in a repository, such as\n Cloud Source Repositories, GitHub, or Bitbucket.\n\n| **Caution:** Effective June 17, 2024, Cloud Source Repositories isn't available\n| to new customers. If your organization hasn't\n| previously used Cloud Source Repositories, you can't enable the API or use\n| Cloud Source Repositories. New projects not connected to an organization can't enable the\n| Cloud Source Repositories API. Organizations that have used Cloud Source Repositories prior to\n| June 17, 2024 are not affected by this change.\n\n### Required IAM permissions\n\n1. In the Google Cloud console, select your project.\n\n2. [Grant](/iam/docs/grant-role-console) the **Cloud Build Service Account**\n role to the App Engine default service account. If service account does not\n appear in the list, locate service account in **Service Accounts** page.\n\n [Go to Service\n Accounts](https://console.cloud.google.com/iam-admin/serviceaccounts)\n3. Grant the **App Engine Admin** role and **Service Account User** to the build\n service account:\n\n 1. In the Google Cloud console, go to the\n *settings* Cloud Build **Permissions** page:\n\n [Go to **Permissions**](https://console.cloud.google.com/cloud-build/settings)\n\n \u003cbr /\u003e\n\n 2. Set the status of the **App Engine Admin** role and the **Service Account User**\n role to **Enabled**.\n\nConfiguring the deployment\n--------------------------\n\nCloud Build lets you use any publicly available container image\nto execute your tasks. You can do this by specifying the image in a build `step`\nin the Cloud Build config file.\n\nApp Engine provides the `gcloud app deploy` command, which builds an image with\nyour source code and deploys that image on App Engine. You can use the [`cloud-sdk`\nimage](https://github.com/GoogleCloudPlatform/cloud-sdk-docker)\nas a build step in your config file to invoke `gcloud` commands within the image.\nArguments passed to this build step are passed to the gcloud CLI directly,\nallowing you to run any `gcloud` command in this image.\n\nTo deploy an application to App Engine, use the following steps:\n\n1. Create a [Cloud Build configuration file](/build/docs/build-config)\n named `cloudbuild.yaml` or `cloudbuild.json`.\n\n | **Note:** Do not store the config file in the same directory as the source code because the gcloud CLI may interpret that you want to deploy the app using Docker via Cloud Build. Instead, store your source in a separate directory and create the config file in the parent directory.\n2. In the config file:\n\n - Add a `name` field to specify the `cloud-sdk` build step.\n - Add an `entrypoint` field to use the `bash` tool when `cloud-sdk` is invoked.\n - In the `args` field, invoke the `gcloud app deploy` command and set a `timeout`\n for [App Engine to use when it invokes Cloud Build](/appengine/docs/standard/nodejs/testing-and-deploying-your-app#deploying_your_application). This is required because Cloud Build\n build steps and builds have a default timeout of 10 minutes and App Engine\n deployments could take longer than that to complete. Specifying a longer timeout\n will make sure that the build doesn't timeout if `gcloud app deploy` takes\n longer than 10 minutes to complete.\n\n **Timeout errors when using the App Engine standard environment** :\n You can configure timeouts as described here only when using the App Engine\n flexible environment. The App Engine standard environment does not allow\n the build timeout to be configured. If you're using Cloud Build\n for deploying on the App Engine standard environment, and your build\n is failing with a timeout error, consider using the App Engine flexible\n environment or [Cloud Run](/build/docs/deploying-builds/deploy-cloud-run)\n instead of the App Engine standard environment.\n - Add a [build `timeout`](/build/docs/build-config#build_steps) value of\n more than 10 minutes.\n\n ### YAML\n\n steps:\n - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'\n entrypoint: 'bash'\n args: ['-c', 'gcloud config set app/cloud_build_timeout 1600 && gcloud app deploy']\n timeout: '1600s'\n\n ### JSON\n\n {\n \"steps\": [\n {\n \"name\": \"gcr.io/google.com/cloudsdktool/cloud-sdk\",\n \"entrypoint\": \"bash\",\n \"args\": [\n \"-c\",\n \"gcloud config set app/cloud_build_timeout 1600 && gcloud app deploy\"\n ]\n }\n ],\n \"timeout\": \"1600s\"\n }\n\n3. Start the build, where \u003cvar translate=\"no\"\u003eSOURCE_DIRECTORY\u003c/var\u003e is the path or URL to the source\n code and \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e is one of the [supported build regions](/build/docs/locations)\n to start the build:\n\n gcloud builds submit --region=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eREGION\u003c/span\u003e\u003c/var\u003e \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eSOURCE_DIRECTORY\u003c/span\u003e\u003c/var\u003e\n\nContinuous deployment\n---------------------\n\nYou can automate the deployment of your software to App Engine by creating\nCloud Build triggers. You can configure your triggers to build and\ndeploy images whenever you update your source code.\n\nTo automate your deployment to App Engine:\n\n1. In your repository, add a config file with steps\n to invoke the `gcloud app deploy` command:\n\n ### YAML\n\n steps:\n - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'\n entrypoint: 'bash'\n args: ['-c', 'gcloud config set app/cloud_build_timeout 1600 && gcloud app deploy']\n timeout: '1600s'\n\n ### JSON\n\n {\n \"steps\": [\n {\n \"name\": \"gcr.io/google.com/cloudsdktool/cloud-sdk\",\n \"entrypoint\": \"bash\",\n \"args\": [\n \"-c\",\n \"gcloud config set app/cloud_build_timeout 1600 && gcloud app deploy\"\n ]\n }\n ],\n \"timeout\": \"1600s\"\n }\n\n2. Create a build trigger with the config file created in the previous step:\n\n 1. Open the **Triggers** page in the Google Cloud console:\n\n [Open Triggers page](https://console.cloud.google.com/cloud-build/triggers)\n 2. Select your project from the project selector drop-down menu at the top of\n the page.\n\n 3. Click **Open**.\n\n 4. Click **Create trigger**.\n\n On the **Create trigger** page, enter the following settings:\n 1. Enter a name for your trigger.\n\n 2. Select the repository event to start your trigger.\n\n 3. Select the repository that contains your source code and build\n config file.\n\n 4. Specify the regex for the branch or tag name that will start your\n trigger.\n\n 5. **Configuration**: Choose the build config file you created\n previously.\n\n 5. Click **Create** to save your build trigger.\n\nAnytime you push new code to your repository, you will automatically start a\nbuild and deploy on App Engine.\n\nFor more information on creating Cloud Build triggers, see\n[Creating and managing build triggers](/build/docs/automating-builds/create-manage-triggers).\n\nWhat's next\n-----------\n\n- Learn how to [deploy on Cloud Run](/build/docs/deploying-builds/deploy-cloud-run)\n- Learn how to [perform blue/green deployments on Compute Engine](/build/docs/deploying-builds/deploy-compute-engine)\n- Learn how to [deploy on GKE](/build/docs/deploying-builds/deploy-gke)\n- Learn how to [deploy on Cloud Run functions](/build/docs/deploying-builds/deploy-functions)\n- Learn how to [deploy on Firebase](/build/docs/deploying-builds/deploy-firebase)\n- Learn how to [troubleshoot build errors](/build/docs/troubleshooting)."]]