Use regional endpoints

Cloud Scheduler regional endpoints let you keep API traffic within a single Google Cloud region to help meet data residency and data sovereignty requirements. When you send a request to a regional endpoint, TLS terminates, and Cloud Scheduler processes the request entirely within the specified region.

Cloud Scheduler regional endpoints have the format https://cloudscheduler.REGION.rep.googleapis.com where REGION is a supported region—for example, https://cloudscheduler.us-central1.rep.googleapis.com.

For information about using Private Service Connect to access Cloud Scheduler regional endpoints privately from inside a Virtual Private Cloud (VPC) network, see About accessing regional and multi-regional Google APIs through endpoints.

Limitations and restrictions

The following limitations and restrictions apply when you use Cloud Scheduler regional endpoints.

  • A regional endpoint serves only the resources in its own region. The location in the resource name must match the region of the endpoint. For example, you can send requests for resources in projects/PROJECT_ID/locations/us-central1 to cloudscheduler.us-central1.rep.googleapis.com. Requests for resources in other regions fail.
  • Regional endpoints apply to requests sent to the Cloud Scheduler API. They don't change how Cloud Scheduler sends requests to your job targets. If your jobs run in a VPC Service Controls perimeter, see the requirements for job targets in Secure cron jobs with VPC Service Controls.

Send requests to a regional endpoint

You can send requests to a regional endpoint using the Google Cloud CLI, the REST API, or the Cloud Scheduler client libraries.

gcloud

Set the api_endpoint_overrides/cloudscheduler property to the regional endpoint, and then run gcloud scheduler commands for resources in that region:

gcloud config set api_endpoint_overrides/cloudscheduler \
    https://cloudscheduler.REGION.rep.googleapis.com/
gcloud scheduler jobs list --location=REGION

Replace REGION with a region that offers regional endpoints—for example, us-central1.

To use the default global endpoint again, unset the property:

gcloud config unset api_endpoint_overrides/cloudscheduler

REST

Use the regional endpoint as the host of the request URL. For example, the following command lists the jobs in a region:

curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    "https://cloudscheduler.REGION.rep.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/jobs"

Replace the following:

  • REGION: a region that offers regional endpoints—for example, us-central1.
  • PROJECT_ID: your Google Cloud project ID.

Client libraries

Set the API endpoint when you create the client. The following examples create a client for us-central1:

Go

import (
scheduler "cloud.google.com/go/scheduler/apiv1"
"google.golang.org/api/option"
)

client, err := scheduler.NewCloudSchedulerClient(ctx,
option.WithEndpoint("cloudscheduler.us-central1.rep.googleapis.com:443"))

Java

import com.google.cloud.scheduler.v1.CloudSchedulerClient;
import com.google.cloud.scheduler.v1.CloudSchedulerSettings;

CloudSchedulerSettings settings =
  CloudSchedulerSettings.newBuilder()
      .setEndpoint("cloudscheduler.us-central1.rep.googleapis.com:443")
      .build();
try (CloudSchedulerClient client = CloudSchedulerClient.create(settings)) {
// Send requests for resources in us-central1.
}

Python

from google.api_core.client_options import ClientOptions
from google.cloud import scheduler_v1

client = scheduler_v1.CloudSchedulerClient(
  client_options=ClientOptions(
      api_endpoint="cloudscheduler.us-central1.rep.googleapis.com"
  )
)

What's next