Skip to main content

More Info:

Ensure that Vertex AI notebook instances are encrypted using Customer-Managed Encryption Keys

Risk Level

Medium

Address

Security

Compliance Standards

  • CIS GCP

Triage and Remediation

Remediation

Using Console

Below are the GCP Console steps to ensure Vertex AI notebook instances are encrypted with Customer-Managed Encryption Keys (CMEK). Note that CMEK can only be set at creation time; you cannot convert an existing notebook instance from Google-managed keys to CMEK. For existing notebooks, you must create a new one with CMEK and migrate your work.

1. Create (or identify) a CMEK key in Cloud KMS

  1. In the GCP Console, go to:
    Security → Key Management (or search “KMS” in the search bar).
  2. At the top, make sure you are in the same project and region where you will create the Vertex AI notebook.
  3. Click + Create key ring (if you don’t already have one):
    • Name: e.g., vertex-ai-notebooks-kr
    • Location type: Regional
    • Location: select the same region you’ll use for the notebook.
    • Click Create.
  4. In the key ring, click + Create key:
    • Key name: e.g., vertex-ai-notebooks-key
    • Key purpose: Symmetric encrypt/decrypt
    • Protection level: Software
    • Leave default rotation if you don’t have a specific policy.
    • Click Create.

2. Grant the notebook’s service account access to the key

Vertex AI Notebooks use a service account to access resources. That service account needs Cloud KMS Encrypter/Decrypter on your key.
  1. In the Console, go again to Security → Key Management.
  2. Click your key ring, then your key.
  3. Go to the Permissions tab.
  4. Click Grant access.
  5. In New principals, add:
    • The notebook runtime service account you plan to use (often the Compute Engine default service account):
      PROJECT_NUMBER-compute@developer.gserviceaccount.com
      or a custom service account you attach to the notebook.
  6. In Roles, add:
    • Cloud KMS CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)
  7. Click Save.
If you’re unsure which service account your notebook will use, decide it now (e.g., the project’s default Compute Engine SA) and use that consistently.

3. Create a new Vertex AI notebook with CMEK enabled

Steps differ slightly depending on the notebook type, but the CMEK selection is similar.

A. For User-Managed Notebooks (legacy instances)

  1. In the Console, go to:
    Vertex AI → Workbench → User-managed notebooks.
  2. Click New notebook.
  3. Select the environment/image you want (e.g., TensorFlow, PyTorch, etc.).
  4. In the notebook configuration page:
    • Choose Region (must match your KMS key’s region).
    • Under Security, look for Encryption.
    • Select Customer-managed key.
    • Click Browse next to the key field, then choose your KMS key created above.
    • Ensure the Service account field matches the service account you granted KMS permissions to.
  5. Configure other options (machine type, disk, etc.) as needed.
  6. Click Create.

B. For Managed Notebooks (Vertex AI Workbench Managed)

  1. In the Console, go to:
    Vertex AI → Workbench → Managed notebooks.
  2. Click New notebook.
  3. Choose a Region (must match your KMS key’s region).
  4. Configure environment and machine options.
  5. Under Security (or Advanced options → Security depending on UI version):
    • Find Encryption.
    • Select Customer-managed key.
    • Click Browse and choose your KMS key.
    • Confirm the Runtime service account is the one that has KMS permissions.
  6. Click Create.

4. Migrate from an existing notebook (if needed)

Because encryption cannot be changed in-place:
  1. Open the old notebook.
  2. Export notebooks and data:
    • Save .ipynb files to a Git repo, Cloud Storage, or download locally.
    • Copy any data from the old persistent disk (e.g., to Cloud Storage).
  3. Open the new CMEK-encrypted notebook.
  4. Import your notebooks and data there.
  5. When confirmed working, stop and delete the old (non-CMEK) notebook instance.

If you tell me your notebook type (Managed vs User-Managed) and region, I can tailor the exact screen labels and service account to use.
Below are the remediation steps to ensure Vertex AI notebook instances use Customer-Managed Encryption Keys (CMEK) with the gcloud CLI.
Important: Encryption cannot be changed on an existing notebook instance. You must create a new CMEK-encrypted instance and migrate your work.

1. Set environment variables


2. Create a KMS key ring and key

Get the full key resource name:

3. Identify the service account used by the notebook

For Vertex AI Workbench (User-managed notebooks), the default service account is usually the Compute Engine default:
If you use a custom service account for notebooks, set it:

4. Grant KMS permissions to the notebook service account


5. Create a CMEK‑encrypted Vertex AI Workbench notebook

A. User-managed notebook instance

Key flags:
  • --kms-key – applies CMEK to the boot and data disks.
  • --service-account – must match the account granted KMS permissions.

B. Managed notebook runtime (if using Managed Notebooks)


6. Verify the notebook uses CMEK

Confirm the kmsKey fields match your $KMS_KEY.

7. Migrate from existing non‑CMEK notebooks (manual)

  1. In the existing notebook, back up notebooks/data (e.g., to Cloud Storage or Git).
  2. Create a new CMEK‑encrypted instance as above.
  3. Restore your notebooks/data to the new instance.
  4. Delete the old non‑CMEK instance:
Below is a concise, end‑to‑end way to ensure Vertex AI notebook instances use CMEK, using Python.Key points:
  • CMEK must be set at creation time; you cannot change disk encryption of an existing instance.
  • You’ll typically need to (1) create/choose a KMS key, (2) grant the notebook’s service account access to the key, and (3) create the notebook instance with that CMEK.

1. Prerequisites

Assume:
  • PROJECT_ID = your GCP project
  • LOCATION = e.g. us-central1
  • INSTANCE_ID = name for the notebook instance
  • SERVICE_ACCOUNT = SA that will run the notebook (or use default)

2. Create a CMEK key (Cloud KMS) via Python

Note the CMEK resource name, e.g.:

3. Grant KMS access to the notebook service account

Vertex AI Notebooks uses a service account (either user‑specified or a Compute Engine default SA). That SA must have roles/cloudkms.cryptoKeyEncrypterDecrypter on the KMS key.Example using gcloud (easiest):

4. Create a Vertex AI Notebook instance with CMEK using Python

For user-managed notebooks (legacy “AI Platform Notebooks” / NotebooksServiceClient):
Notes:
  • disk_encryption="CMEK" tells GCE to use the KMS key for the boot disk.
  • kms_key must be in a region compatible with the zone (e.g. us-central1 for us-central1-b).

5. For Managed Notebooks (Vertex AI Workbench “managed”)

Managed notebooks use the Vertex AI Notebooks API, but with Runtime/ManagedNotebookService. CMEK is set at the runtime level:

6. Migration: existing non‑CMEK notebooks

Because encryption is fixed at disk creation, to “remediate” existing notebooks:
  1. Create a new notebook / runtime with CMEK (as above).
  2. Migrate data:
    • Copy notebooks and data to Cloud Storage (gs://) from old instance.
    • Download them from new CMEK‑protected instance.
  3. Delete the old, non‑CMEK instance and its disks/snapshots.
Substitute:
  • PROJECT_ID with your GCP project ID.
  • LOCATION with the region of the Workbench/Vertex AI notebook and KMS key.
  • KEY_RING_NAME and VERTEX_NOTEBOOK_CMEK_KEY_NAME with your actual KMS key ring and key.
  • VERTEX_NOTEBOOK_INSTANCE_NAME with your actual instance name.
Changing an existing Vertex AI Workbench/Notebook instance to use CMEK (kms_key) forces replacement of the instance; Terraform will destroy and recreate it, which can cause downtime and loss of any non‑persisted data on the VM.To verify, terraform plan should show:
  • kms_key being added (or changed) in the gce_setup block of the google_workbench_instance resource.
  • No other unrelated changes.