Configuring VPC Service Controls

This page describes how to enable VPC Service Controls on a Cloud SQL project. Before you begin, review Overview of VPC Service Controls. Also review the Cloud SQL limitations when using VPC Service Controls.

Before you begin

  1. Google Cloud アカウントにログインします。Google Cloud を初めて使用する場合は、アカウントを作成して、実際のシナリオでの Google プロダクトのパフォーマンスを評価してください。新規のお客様には、ワークロードの実行、テスト、デプロイができる無料クレジット $300 分を差し上げます。
  2. Google Cloud Console の [プロジェクト セレクタ] ページで、Google Cloud プロジェクトを選択または作成します。

    プロジェクト セレクタに移動

  3. Cloud プロジェクトに対して課金が有効になっていることを確認します。プロジェクトに対して課金が有効になっていることを確認する方法を学習する

  4. Compute Engine API を有効にします。

    API を有効にする

  5. Service Networking API を有効にします。

    API を有効にする

  6. Add the Identity and Access Management (IAM) roles to the user or service account you are using to set up and administer VPC Service Controls. See IAM Roles for Administering VPC Service Controls.
  7. Review limitations when using VPC Service Controls with Cloud SQL.
  8. Optionally, add an organization policy that restricts public IP on instances in projects that use that policy. See Connection organization policies and Configuring the organization policy.

Configuring the Virtual Private Cloud (VPC) network

Perform the steps in Setting up private connectivity to Google APIs and services.

Disallowing or disabling public IP for Cloud SQL instances

To constrain data within the VPC for your Cloud SQL project, do not allow connections to Cloud SQL instances from public IPs. IP-based connections bypass VPC Service Controls. You must also disable public IP for new and existing Cloud SQL instances within the VPC.

To either disallow or disable public IP on Cloud SQL instances:

  • Organization administrators can apply organization policies that disallow creating new instances with public IP. See Configuring the organization policy.
  • Users who create Cloud SQL instances can configure the instances to use private IP instead of public IP. See Disabling public IP.

Creating a service perimeter

During this procedure, you select the Cloud SQL projects that you want the VPC service perimeter to protect.

To create a service perimeter, follow the instructions in Creating a service perimeter.

Adding more instances to the service perimeter

To add existing Cloud SQL projects to the perimeter, follow the instructions in Updating a service perimeter.

Adding the Cloud SQL and Cloud Storage APIs to the service perimeter

To mitigate the risk of your data being exfiltrated from Cloud SQL, for example, using Cloud SQL import or export APIs, you must restrict both the Google Cloud SQL Admin API and the Google Cloud Storage API.

To add Cloud SQL and Cloud Storage APIs as restricted services:


  1. In the Google Cloud Console navigation menu, click Security, and then click VPC Service Controls.

    Go to the VPC Service Controls page

  2. On the VPC Service Controls page, in the table, click the name of the service perimeter that you want to modify.

  3. Click EDIT.

  4. On the Edit VPC Service Perimeter page, click ADD SERVICES.

  5. Add Cloud SQL Admin API and Cloud Storage API.

  6. Click Save.


$gcloud access-context-manager perimeters update [PERIMETER_NAME]


  • [PERIMETER_ID] is the ID of the perimeter or the fully qualified identifier for the perimeter.
  • [POLICY_ID] is the ID of the access policy.

For reference information, see access-context-manager perimeters update.

Creating an access level

Optionally, to permit external access to protected resources inside a perimeter, you can use access levels. Access levels apply only to requests for protected resources coming from outside the service perimeter. You can't use access levels to give protected resources or VMs permission to access data and services outside the perimeter.

See Allowing access to protected resources from outside a perimeter.