Locations

AutoML Natural Language offers you some control over where the resources for your project (your datasets and models) are stored and processed. In particular, you can configure AutoML Natural Language to store your data at rest and perform machine learning processing only in the European Union.

By default AutoML Natural Language stores and processes resources in a Global location, which means that AutoML Natural Language doesn't guarantee that your resources will remain within a particular location or region. If you choose the European Union location, Google will store your data and perform machine learning with it only in the European Union. You and your users can access the data from any location.

Setting the location in the AutoML Natural Language UI

When creating a new dataset, you specify the location for that dataset using the drop-down list just below the text box where you enter the dataset name. Models trained using that dataset are created in the same location.

The listing pages for datasets and models each have a Location drop-down list you can use to show the resources in the selected location.

Setting the location using the API

AutoML Natural Language supports both a global API endpoint (automl.googleapis.com) and a European Union endpoint (eu-automl.googleapis.com). To store and process your data in the European Union only, use the URI eu-automl.googleapis.com in place of automl.googleapis.com for your REST API calls.

When using the AutoML API, you identify resources using their full resource name, which includes their location as well as their unique ID. For example, the resource name for a dataset has the format projects/{project-id}/locations/{location}/datasets/{dataset-id}. For resources stored in the global location, replace the {location} variable with the value us-central1. For resources stored in the European Union location, replace the {location} variable with the value eu.

Setting the location using client libraries

The AutoML client libraries accesses the global API endpoint (automl.googleapis.com) by default. To store and process your data in the European Union only, you need to explicitly set the endpoint. The code samples below show how to configure this setting.

Python

To learn how to install and use the client library for AutoML Natural Language, see AutoML Natural Language client libraries. For more information, see the AutoML Natural Language Python API reference documentation.

To authenticate to AutoML Natural Language, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.

from google.cloud import automl_v1beta1 as automl

# You must first create a dataset, using the `eu` endpoint, before you can
# call other operations such as: list, get, import, delete, etc.
client_options = {"api_endpoint": "eu-automl.googleapis.com:443"}

# Instantiates a client
client = automl.AutoMlClient(client_options=client_options)

# A resource that represents Google Cloud Platform location.
# project_id = 'YOUR_PROJECT_ID'
project_location = f"projects/{project_id}/locations/eu"

Java

To learn how to install and use the client library for AutoML Natural Language, see AutoML Natural Language client libraries. For more information, see the AutoML Natural Language Java API reference documentation.

To authenticate to AutoML Natural Language, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.

AutoMlSettings settings =
    AutoMlSettings.newBuilder().setEndpoint("eu-automl.googleapis.com:443").build();

// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests. After completing all of your requests, call
// the "close" method on the client to safely clean up any remaining background resources.
AutoMlClient client = AutoMlClient.create(settings);

// A resource that represents Google Cloud Platform location.
LocationName projectLocation = LocationName.of(projectId, "eu");

Node.js

To learn how to install and use the client library for AutoML Natural Language, see AutoML Natural Language client libraries. For more information, see the AutoML Natural Language Node.js API reference documentation.

To authenticate to AutoML Natural Language, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.

const automl = require('@google-cloud/automl').v1beta1;

// You must first create a dataset, using the `eu` endpoint, before you can
// call other operations such as: list, get, import, delete, etc.
const clientOptions = {apiEndpoint: 'eu-automl.googleapis.com'};

// Instantiates a client
const client = new automl.AutoMlClient(clientOptions);

// A resource that represents Google Cloud Platform location.
const projectLocation = client.locationPath(projectId, 'eu');