Ensure GCP Vertex AI instances are private

Error: GCP Vertex AI instances are not private
Bridgecrew Policy ID: BC_GCP_GENERAL_23
Checkov Check ID: CKV_GCP_89
Severity: HIGH

GCP Vertex AI instances are not private

Description

Vertex AI Workbench is a data science service offered by GCP that leverages JupyterLab to explore and access data. Workbenches have public IPs assigned by default which can increase your attack surface and expose sensitive data.

We recommend you only assign private IPs to Vertex AI Workbenches.

Fix - Runtime

GCP Console

It's not currently possible to edit a Vertex AI workbench network setting to remove or add a public IP.

To create a Vertex AI Workbench with a private IP:

  1. Log in to the GCP Console at https://console.cloud.google.com.
  2. Navigate to Vertex AI Workbench.
  3. Scroll down to the Networking section and expand.
  4. Locate the External IP dropdown and select None.

CLI Command

It's not currently possible to edit a Vertex AI workbench network settings to remove or add a public IP.
To create a private Vertex AI Workbench you'll need to specify the --no-public-ip command. For example:

# To create an instance from a VmImage name
gcloud beta notebooks instances create example-instance  \
  --vm-image-project=deeplearning-platform-release  \
  --vm-image-name=tf2-2-1-cu101-notebooks-20200110  \
  --machine-type=n1-standard-4  \
  --location=us-central1-b  \
  --no-public-ip

Fix - Buildtime

Terraform

  • Resource: google_notebooks_instance
  • Field: no_public_ip
resource "google_notebooks_instance" "public_instance" {
  name = "my-notebook"
  location = "us-west1-a"
  machine_type = "e2-medium"
  vm_image {
    project      = "deeplearning-platform-release"
    image_family = "tf-latest-cpu"

- no_public_ip = false
+ no_public_ip = true
  }
}