If you can't connect to a TPU VM using SSH, the TPU VM might not have an external IP address. To access a TPU VM without an external IP
address, follow the instructions inConnect to a TPU VM without a public IP
address.
// Import the TPUClient// TODO(developer): Uncomment below line before running the sample.// const {TpuClient} = require('@google-cloud/tpu').v2;// Instantiate a tpuClient// TODO(developer): Uncomment below line before running the sample.// tpuClient = new TpuClient();// TODO(developer): Update these variables before running the sample.// Project ID or project number of the Google Cloud project you want to retrive a list of TPU nodes.constprojectId=awaittpuClient.getProjectId();// The zone from which the TPUs are retrived.constzone='europe-west4-a';asyncfunctioncallTpuVMList(){constrequest={parent:`projects/${projectId}/locations/${zone}`,};const[response]=awaittpuClient.listNodes(request);returnresponse;}returnawaitcallTpuVMList();
// Import the TPUClient// TODO(developer): Uncomment below line before running the sample.// const {TpuClient} = require('@google-cloud/tpu').v2;// Instantiate a tpuClient// TODO(developer): Uncomment below line before running the sample.// tpuClient = new TpuClient();// TODO(developer): Update these variables before running the sample.// Project ID or project number of the Google Cloud project you want to retrive a node.constprojectId=awaittpuClient.getProjectId();// The name of TPU to retrive.constnodeName='node-name-1';// The zone, where the TPU is created.constzone='europe-west4-a';asyncfunctioncallGetTpuVM(){constrequest={name:`projects/${projectId}/locations/${zone}/nodes/${nodeName}`,};const[response]=awaittpuClient.getNode(request);console.log(`Node:${nodeName}retrived.`);returnresponse;}returnawaitcallGetTpuVM();
fromgoogle.cloudimporttpu_v2# TODO(developer): Update and un-comment below lines# project_id = "your-project-id"# zone = "us-central1-b"# tpu_name = "tpu-name"client=tpu_v2.TpuClient()node=client.get_node(name=f"projects/{project_id}/locations/{zone}/nodes/{tpu_name}")print(node)# Example response:# name: "projects/[project_id]/locations/[zone]/nodes/tpu-name"# state: "READY"# runtime_version: ...
Stop Cloud TPU resources
You can stop a single Cloud TPU to avoid incurring charges without losing its VM configuration and software.
Thequeued resourcesAPI does not support stopping TPU slices or TPUs. To stop
incurring charges for TPUs allocated through the queued resources API, delete the TPU.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-06-09 UTC."],[],[]]