Google Cloud Search supports VPC Service Controls to enhance data security. VPC Service Controls lets you define a service perimeter around Google Cloud resources to constrain data and mitigate exfiltration risks.
Prerequisites
Before you begin, install the gcloud CLI .
Enable VPC Service Controls
To enable VPC Service Controls:
-
Obtain the project IDs and numbers for the Google Cloud project you want to use. See Identifying projects .
-
Use
gcloudto create an access policy for your Google Cloud organization: -
Create a service perimeter with Cloud Search as a restricted service:
gcloud access-context-manager perimeters create NAME \ --title = TITLE \ --resources = PROJECTS \ --restricted-services = RESTRICTED-SERVICES \ --policy = POLICY_NAMEWhere:
-
NAMEis the perimeter name. -
TITLEis the perimeter title. -
PROJECTSis a comma-separated list of project numbers, each preceded byprojects/. For example,--resources=projects/12345,projects/67890. This flag only supports project numbers. -
RESTRICTED-SERVICESis a comma-separated list. Usecloudsearch.googleapis.com. -
POLICY_NAMEis the numeric name of your organization's access policy.
For more information, see Creating a service perimeter .
-
-
(Optional) To apply IP or region-based restrictions, create access levels and add them to the perimeter:
- To create an access level, see Creating a basic access level . For an example, see Limit access on a corporate network .
- Add the access level to the perimeter. See Adding an access level to an existing perimeter . Propagation can take up to 30 minutes.
-
Use the Cloud Search Customer Service REST API to update customer settings with your protected project:
- Obtain an OAuth 2.0 access token. See Using OAuth 2.0 to Access Google APIs
.
Use one of these scopes:
-
https://www.googleapis.com/auth/cloud_search.settings.indexing -
https://www.googleapis.com/auth/cloud_search.settings -
https://www.googleapis.com/auth/cloud_search
-
-
Run this curl command:
curl --request PATCH \ 'https://cloudsearch.googleapis.com/v1/settings/customer' \ --header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "vpc_settings": { "project": "projects/PROJECT_ID" } }' \ --compressedReplace
YOUR_ACCESS_TOKENandPROJECT_ID.
- Obtain an OAuth 2.0 access token. See Using OAuth 2.0 to Access Google APIs
.
Use one of these scopes:
A successful update returns a 200 OK
response. VPC Service Controls
restrictions now apply to all Cloud Search APIs, searches at cloudsearch.google.com
, and Admin console configurations or reports.
Requests that violate access levels receive a PERMISSION_DENIED
error.

