REGION_ID is an abbreviated code that Google assigns
based on the region you select when you create your app. The code does not
correspond to a country or province, even though some region IDs may appear
similar to commonly used country and province codes. Including
REGION_ID.r in App Engine URLs is optional for
existing apps and will soon be required for all new apps.
To ensure a smooth transition, we are slowly updating App Engine to use region IDs. If we haven't updated your Google Cloud project yet, you won't see a region ID for your app. Since the ID is optional for existing apps, you don't need to update URLs or make other changes once the region ID is available for your existing apps.
Learn more about region IDs.
This section of the guide shows how to use the
gcloud tool to deploy your
Node.js web service on App Engine. To learn more about
the Node.js runtime environment, see
Node.js Runtime Environment.
Before you begin
- Create a Cloud project with an App Engine app.
- Write a Node.js web server ready to deploy on App Engine.
- Install Cloud SDK, which provides the
gcloudcommand-line tool. Ensure
gcloudis configured to use the Google Cloud project you want to deploy to.
gcloud app deployand
gcloud app browseto deploy and view your service.
Deploying your serviceIn your
my-nodejs-servicefolder, where the
app.yamlfile is located, run the following command in your terminal:
gcloud app deploy
Your source files are then uploaded to Google Cloud Storage. Cloud Build builds your app and deploys it to App Engine.
For information about other ways to build and deploy your app, see Testing and deploying your app.Node.js modules are installed in the cloud as listed in your
package-lock.jsonfiles and your service is started by using
Deploying multiple services
You can add multiple services
in your project by creating an
app.yaml file for each service. Include the
service attribute in each
app.yaml file to specify the name of the service.
To learn more about structuring your app using multiple services, see
Structuring Web Services in App Engine.
To deploy multiple services, follow these instructions. Each deployed service will have its own assigned URL.
Viewing your service
To quickly launch your browser and access your web service at
https://PROJECT_ID.REGION_ID.r.appspot.com, use the following
gcloud app browse
Services and versions
You've just created and deployed a service on App Engine.
You can specify the name of your service in the
app.yaml file. If the
name is omitted, it is treated as
default. The first service you deploy
must be the default service.
You can update your service at any time by running the
gcloud app deploy
command again. Each time you deploy, a new version is created and traffic
is automatically routed to the latest version.
To confirm that your service has been created and a version has been deployed:
View your App Engine services in the Cloud Console:
You should see one service listed, named
default. The default service is publicly accessible at the following URL:
View your versions:
You should see one timestamped version listed, corresponding to your deployment.
To learn how to send requests to specific services and versions, see How Requests are Routed.
Now that you have a Node.js server running on App Engine,
learn how to make updates to your web service.