()
| 31 | const compute = require('@google-cloud/compute'); |
| 32 | |
| 33 | async function getInstance() { |
| 34 | const instancesClient = new compute.InstancesClient(); |
| 35 | |
| 36 | const [instance] = await instancesClient.get({ |
| 37 | project: projectId, |
| 38 | zone, |
| 39 | instance: instanceName, |
| 40 | }); |
| 41 | |
| 42 | console.log( |
| 43 | `Instance ${instanceName} data:\n${JSON.stringify(instance, null, 4)}` |
| 44 | ); |
| 45 | } |
| 46 | getInstance(); |
| 47 | // [END compute_instances_get] |
| 48 | } |