Skip to content

Instantly share code, notes, and snippets.

@dex4er
Created April 1, 2022 08:57
Show Gist options
  • Save dex4er/9aae00a8022a2018793b87fe79e2cbfa to your computer and use it in GitHub Desktop.
Save dex4er/9aae00a8022a2018793b87fe79e2cbfa to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -z "$1" ]; then
gcloud compute images list --project $PROJECT
else
gcloud compute images export --project $PROJECT \
--async \
--image "$1" \
--destination-uri "gs://$BUCKET/$1.vmdk" \
--export-format=vmdk \
--network projects/$SERVICE_PROJECT/global/networks/$NETWORK \
--subnet projects/$SERVICE_PROJECT/regions/$REGION/subnetworks/$SUBNETWORK \
--zone $ZONE
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment