Set up for Ray on Vertex AI

Before you begin with Ray on Vertex AI, follow these steps to set up yourGoogle project andVertex AI SDK for Python:

  1. Set up billing for your project,install thegcloud CLI, and enable the Vertex AI API. To do this,follow the steps atSet up a project and a developmentenvironment.

    Enable the Vertex AI API

  2. Prerequisite: You must know how to develop programs usingopen sourceRay.

  3. The Ray on Vertex AI SDK for Python used here is a version of the Vertex AI SDK for Pythonthat includes the functionality of theRayClient,Ray BigQuery connector, Raycluster management on Vertex AI, and predictions on Vertex AI.

    • If you use Ray on Vertex AI in the Google Cloud console, aColab Enterprisenotebook guides you through the Vertex AI SDK for Python installationprocess after youcreate a Ray cluster.

    • If you use Ray on Vertex AI in the Vertex AI Workbench or other interactive Python environment, install the Vertex AI SDK for Python:

      # The latest image in the Ray cluster includes Ray 2.47# The latest supported Python version is Python 3.11.$ pip install google-cloud-aiplatform[ray]

      After you install the SDK, restart the kernel before you import packages.

      Note: If you use a Vertex AI Workbench notebook as the client environment and usetheDeep Learning VM as the machineimage, Ray and the Vertex AI SDK for Python are pre-installed in thePython, TensorFlow Enterprise
  4. Optional: If you plan to read from BigQuery, create anew BigQuery dataset or use an existingdataset. To do this, seecreate a new BigQuery dataset.

    Note: If you run code on your Ray cluster on Vertex AI that interacts with Google services like BigQuery, theVertex AI Custom Code Service Agent authenticates.
  5. (Optional) To mitigate the risk of data exfiltration fromVertex AI, enable VPC Service Controls and specifya VPC network when you create a cluster. For moreinformation, seeVPC Service Controls withVertex AI.

    If you enable VPC Service Controls, you can't reach resourcesoutside the perimeter, such as files in a Cloud Storage bucket.

    Note: The best setup for Ray on Vertex AI is one auto mode VPC networkper project. If you use a custom mode VPC network or use multiple VPCnetworks to create clusters in the same project, you might encounter issues.
  6. (Optional) To use a custom container image, host it onArtifact Registry. A custom image lets you add Python dependencies that aren't included with the prebuilt container images. To build custom images, see Packing your software in theDocker documentation.

  7. (Optional) If you specify a VPC network when creating a Ray cluster onVertex AI, it's highly recommended that you use an auto mode VPC networkin your project. Custom mode VPC networks and multiple VPC networks in thesame project aren't supported and may cause cluster creation to fail.

Secure your clusters

FollowRay best practices and guidelines, includingrunning trusted code on trusted networks, to secure your Ray workloads.Deployment of ray.io in your cloud instances falls under the model ofshared responsibility.

For more information about Google Cloud best practices, see theGCP-2024-020 security bulletin.

Supported locations

TheFeature availability table lists the available locations for Ray on Vertex AI for Custommodel training.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-18 UTC.