怎么可能?
➢ gcloud compute instances list
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
my-instance-1 us-east4-a n1-standard-8 10.16.22.11 RUNNING
my-instance-2 us-east4-a n1-standard-8 10.16.22.12 RUNNING
my-instance-3 us-east4-a n1-standard-8 10.16.22.13 RUNNING
(.venv)
~/Workspace/staging-env-configs workablestg9 ✔ 1h40m
➢ gcloud compute instances describe my-instance-1
ERROR: (gcloud.compute.instances.describe) Could not fetch resource:
- The resource 'projects/my-project/zones/us-central1-b/instances/my-instance-1' was not found
(.venv)
答案 0 :(得分:5)
如果您的实例在默认区域“ us-central1-b”中运行,则只需执行gcloud compute instances describe <instance-name>
。但是,如果您的实例不在defautl区域中运行,则还必须提供该区域您将这样做:
gcloud compute instances describe my-instance-1 --zone us-east4-a
如果您查看输出:“资源'projects / my-project / zones / us-central1-b / instances / my-instance-1'”,您可以清楚地看到它在默认区域us-central1中查找-b