You run your application locally with the native development tools that you usually use.For example, the
Deploying your application
Deploy your app to App Engine using the
gcloud app deploy
command, which will correctly assemble your app's
dependencies in the same way that the
go tool does. This command
automatically builds a container image by using the
Container Builder service and then deploys
that image to the App Engine flexible environment. The container
will include any local modifications that you've made to the runtime image.
To programmatically deploy your apps, use the Admin API.
Before you begin
Before you can deploy your app:
Ensure that your user account includes the required privileges.
Ensuring successful deployment
If you enable updated health checks, deployments are rolled back if your application does not reach healthy status.
When you deploy your first application to the flexible environment, there might be a delay as your virtual machine (VM) and other infrastructure are set up. After the initial setup, health checks begin to confirm that your instance is healthy and ready to receive traffic. If your application does not reach ready status in a specified amount of time, then your deployment fails and is rolled back.
Your application might need more time to become ready. For example, you might
initialize your application by downloading large files or preloading caches. If
you are using
updated health checks, then you can increase the amount of time by modifying the
app_start_timeout configuration setting
Deploying a service
You deploy your app to App Engine by deploying versions of your app's services and each of their configuration files.
To deploy a version of your app's service, run the following command from the
directory where the
app.yaml file of your service is located:
gcloud app deploy
Specifying no files with the command deploys only the
app.yaml file of a given
service. By default, the command automatically generates a unique ID for
the version that you deploy, deploys your version to the GCP project
which was used to initialize the
gcloud tool, and also routes all traffic to
You can change the default behavior of the command by targeting specific files or including additional command parameters:
To deploy the other configuration files of your service, you must target and deploy each file separately. Examples:
gcloud app deploy cron.yaml gcloud app deploy dispatch.yaml gcloud app deploy index.yaml
To specify a custom version ID, include the
To deploy your app without automatically routing all traffic to that version, include the
To deploy your app to a specific GCP project, include the
gcloud app deploy --version [YOUR_VERSION_ID] --no-promote --project [YOUR_PROJECT_ID]
For more information about this command, see the
gcloud app deploy reference.
Deploying multiple services
You use the same deployment commands for deploying or updating the multiple services that make up your application.
To deploy multiple services, you must separately deploy each service's
gcloud app deploy app.yaml gcloud app deploy service2/app.yaml gcloud app deploy app.yaml service2/app.yaml
Requirements for deploying multiple services
You must initially deploy a version of your app to the
defaultservice before you can create and deploy subsequent services.
The ID of each of your services must be specified in their corresponding
app.yamlconfiguration files. To specify the service ID, you include the
service: [YOUR_SERVICE_ID]element definition in each configuration file. By default, excluding this element definition from your configuration file deploys the version to the
Manually building a container for deployment
To build your container images outside of Google Cloud Platform, you must
first upload your images to a container image repository before you can deploy
your images to App Engine with the
gcloud app deploy command.
For example, if you build your container images locally with Docker, you can
push those images to Google Container
Registry and then
specify the URL of your image in the
--image-url flag of the command:
gcloud app deploy --image-url gcr.io/[MY_PROJECT_ID]/[MY_CONTAINER_IMAGE]
For more information about building your own container image, see the Extending the runtime section.
Using automated continuous deployment pipelines
You can use Container Builder to automate deployments in continuous deployment pipelines. For more information, see Deploying artifacts, and Automating Builds using Build Triggers in the Container Builder documentation.
Viewing your application
After you deploy your app to App Engine, you can run the following
command to launch your browser and view the app at
gcloud app browse
The following is a common error message that you might encounter when deploying apps:
PERMISSION_DENIED: Operation not allowed
The "appengine.applications.create" permission is required.
- If the GCP project does not include the required
gcloud app deploycommand can fail when it tries to run the
gcloud app createcommand. Only accounts with Owner role have the necessary permissions to create App Engine applications.