Deploying the Endpoints Configuration

After you have configured Endpoints in an OpenAPI document, you deploy it so that Cloud Endpoints has the information that it needs to manage your API. This page describes how to deploy an OpenAPI document to Cloud Endpoints using the gcloud endpoints services deploy command.

Prerequisites

As a starting point, this page assumes that you have:

If you are using a custom domain name (for example, my.company.com), you must verify the domain name before you can deploy the OpenAPI document.

Preparing gcloud for deployment

You use the gcloud command line tool from the Cloud SDK to deploy the configuration.

To prepare for the deployment:

  1. Install and initialize the Cloud SDK.

  2. Update the Cloud SDK and install the Endpoints components:

      gcloud components update
    
  3. Make sure that Cloud SDK is authorized to access your data and services on GCP:

      gcloud auth login
    
  4. Use Application Default Credentials:

      gcloud auth application-default login
    
  5. Set the default project to your GCP project ID.

      gcloud config set project [YOUR-PROJECT-ID]
    

Deploying the OpenAPI document

When you deploy your API, the gcloud command-line tool uses the Google Service Management API to upload your API configuration to create a managed service. After a successful deployment, you can view the API in the Endpoints dashboard.

To deploy your OpenAPI document:

For simplicity, this page refers to the OpenAPI document as openapi.yaml.

  1. Change directory to the location containing your API's openapi.yaml file.

  2. Invoke the following command:

    gcloud endpoints services deploy openapi.yaml
    

The first time that you deploy openapi.yaml, Service Management creates a new Cloud Endpoints service with a name that matches the text that you specified in the host field in the openapi.yaml file, and then configures the service according to your OpenAPI document.

As it is creating and configuring the service, Service Management outputs a great deal of information to the terminal. On successful completion, you see a line like the following that displays the service configuration ID and the service name:

Service Configuration [2017-02-13-r0] uploaded for service [echo-api.endpoints.example-project.cloud.goog]

In the above example, 2017-02-13-r0 is the service configuration ID and echo-api.endpoints.example-project.cloud.goog is the service name.

Redeploying

Whenever you change something in your OpenAPI document, be sure to deploy it again so that Cloud Endpoints has the most recent version of your API's configuration.

What's next

Send feedback about...

Cloud Endpoints with OpenAPI