Configuring DNS

This page describes how to configure DNS for Google Cloud Endpoints services using the domain name format .endpoints.[PROJECT_ID] The configuration steps on this page are applicable for APIs running on a Google Compute Engine or Google Container Engine instance.

The domain is managed by Google and shared by Google Cloud customers. Because Cloud Platform Console project IDs are guaranteed to have a globally unique name, a domain name in the format .endpoints.[PROJECT_ID] will be unique and can be used as the domain name in the URL for your API.

Configuring the .endpoints.[PROJECT_ID] domain name is optional.

Configuring DNS for an API on Compute Engine or Container Engine

After your API is up and running on Compute Engine or Container Engine, you will want your users to access the API through a domain name rather than an IP address. You can either:

To configure DNS for Compute Engine or Container Engine

  1. Open your OpenAPI specification file, openapi.yaml, and add the x-google-endpoints field to the file as shown in the following snippet:
        swagger: "2.0"
        host: "[API_NAME].endpoints.[PROJECT_ID]"
        - name: "[API_NAME].endpoints.[PROJECT_ID]"
          target: "[IP_ADDRESS]"

    Typically, you will configure the host field and the field to be the same. When you deploy your OpenAPI specification, the text specified in the host field is used as the name of your Endpoints service.

  2. Replace [API_NAME] with the name of your API (for example, bookstore or my-cool-api).
  3. Replace [PROJECT_ID] with your Cloud project ID.
  4. Replace [IP_ADDRESS] with an IPv4 address.

    For example, if you deploy your Endpoints API service to a Compute Engine virtual machine instance, you can use the external IP of that virtual machine. Alternatively, if you run your code on a group of virtual machine instances (or Container Engine pods) behind a load balancer, you can use the IP address of the load balancer.

  5. Deploy your new OpenAPI specification to Service Management using the following command:
        gcloud service-management deploy openapi.yaml

For example, if the following is specified in an openapi.yaml file:

    swagger: "2.0"
    host: ""
    - name: ""
      target: ""

When you deploy the openapi.yaml using the above gcloud command, Service Management creates a DNS A-record,, which resolves to the target IP address, Please note that it could take a few minutes for the new DNS configuration to propagate.

See also

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud Endpoints with OpenAPI