user1700890
user1700890

Reputation: 7730

gcloud compute: issue command and close terminal

Since it takes time to create snapshot of google compute engine instance, I wonder it is possible to issues gcloud compute disks snapshot command on my local machine and close terminal on local machine without interrupting shapshot creation process?

Upvotes: 0

Views: 90

Answers (1)

Zachary Newman
Zachary Newman

Reputation: 21374

From the documentation for gcloud compute disks snapshot:

FLAGS

--async

Display information about the operation in progress, without waiting for the operation to complete.

You can run gcloud compute disks snapshot --async and note the operation ID, then run gcloud compute operations describe <OPERATION ID> to check on the operation (you may also have to provide the zone of the operation, which should be the same as the zone of the disk).

Even if you don't use the --async flag, the operation is running asynchronously in the background (gcloud is just staying open until it finishes). If you close the terminal, the snapshot will finish. You'd just need to do some digging to find the operation ID if you're interested in following up on its status.

Upvotes: 2

Related Questions