MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / listInstances

Function listInstances

compute/listInstances.js:32–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30
31 // List all instances in the given zone in the specified project.
32 async function listInstances() {
33 const instancesClient = new compute.InstancesClient();
34
35 const [instanceList] = await instancesClient.list({
36 project: projectId,
37 zone,
38 });
39
40 console.log(`Instances found in zone ${zone}:`);
41
42 for (const instance of instanceList) {
43 console.log(` - ${instance.name} (${instance.machineType})`);
44 }
45 }
46
47 listInstances();
48 // [END compute_instances_list]

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected