DEV Community

David Haley
David Haley

Posted on

Getting notebook's machine type on Vertex AI

I'd like a Vertex AI notebook to output the machine type it's running. I found this StackOverflow reference to use the Compute Engine metadata server.

But this doesn't work with Vertex AI. (Not all roads lead to Compute Engine.)

Here's how I did it, using the notebook ID given in the workbench:

gcloud notebooks runtimes describe --format="value(virtualMachine.virtualMachineConfig.machineType)" --location=<region> <notebook_id>
n1-standard-2
Enter fullscreen mode Exit fullscreen mode

The value format prints out just the return value: no header or other information to parse out. I learned a lot about potential formats, see also: gcloud topic formats

So in a notebook running Python, just do:

! gcloud etc
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay