0

I've never used Cloud Build. Referencing this guide: https://cloud.google.com/compute/docs/images/export-image and I've tried all the listed methods.

With different methods, it triggers different errors.

When using the cloud console method, the error as followed:
Validation of network "projects/product-id/global/networks/default" failed: googleapi: Error 404: The resource 'projects/project-id/global/networks/default' was not found, notFound ERROR ERROR: build step 0 "gcr.io/compute-image-tools/gce_vm_image_export:release" failed: step exited with non-zero status: 1

I have deleted the default network. I have tried creating new VPC, setting the region and zone, and specifying the region and zone and experimenting with different regions but none work.

When using the Google Cloud CLI method, the error as followed:
ERROR: (gcloud.compute.images.export) FAILED_PRECONDITION: generic::failed_precondition: due to quota restrictions, cannot run builds in this region

I do not understand how the regions restriction work in this case. Does it refer to the source or the destination? I checked the regions https://cloud.google.com/build/quotas and the region that I want to export the image from and import to is within the allowed regions.

I checked the quota limits but not sure which service export custom image falls into. This is the quota and for the rest of the list is 0: enter image description here

My questions:

  • If is due to the quota limits, are there other way to export image to GCS?
  • Which item from the list should I request to increase the quota?
  • The regions restriction is referred to the source or destination? In this case, is it the VPC the VM is in or the GCS bucket location?
CuppaCoffee
  • 124
  • 2
  • 12
  • check this [document](https://cloud.google.com/compute/docs/images/export-image) alternative ways to export an image to Google Cloud Storage.Also have a look at this [link1](https://www.googlecloudcommunity.com/gc/Developer-Tools/Google-Cloud-Build-throwing-quota-error/m-p/609957#M1167) & [link2](https://stackoverflow.com/a/73497493/18265638) – Sathi Aiswarya Jul 12 '23 at 05:08
  • @SathiAiswarya I believe my post contains information suggesting that the solutions provided in your reference links are not applicable. – CuppaCoffee Jul 18 '23 at 10:14
  • check your image you’re trying to export if it has has a size of 1TB. Cloud build has a known limitation which is the maximum timeout value permitted, the max value that can be applied to a build is 24 hours. This might pose a problem for really large Images. In line with that, you can try running the [command](https://cloud.google.com/sdk/gcloud/reference/compute/images/export) `gcloud beta compute images export --image=source-image --destination-uri=gs://bucket/image-name.vdi --export-format=vdi --docker-image-tag=latest --timeout=24h`. Also in which region your storage bucket located in – Sathi Aiswarya Jul 18 '23 at 12:49
  • @SathiAiswarya image size is smaller than 1TB. – CuppaCoffee Jul 18 '23 at 14:38
  • As you mentioned you are using vpc are you aware of this [Limitations and restrictions](https://cloud.google.com/compute/docs/images/export-image#limitations_and_restrictions) – Sathi Aiswarya Jul 19 '23 at 06:59
  • @SathiAiswarya Not using VPC service controls. Export within the same project. – CuppaCoffee Jul 20 '23 at 15:27
  • Seems like your issue needs to be inspected at project level and in-depth analysis is required to check the route cause. I recommend to contact [Google Support](https://cloud.google.com/support-hub) – Sathi Aiswarya Jul 21 '23 at 13:20

1 Answers1

0

If you delete the default VPC, which is a good practice, you can specify the network and subnetwork on the gcloud command as parameters.

PROJECT="my-project"
IMAGE_NAME="source-image"
BUCKET_NAME="destination-bucket"
REGION="europe-west1"
NETWORK="projects/${PROJECT}/global/networks/my-network"
SUBNET="projects/${PROJECT}/regions/${REGION}/subnetworks/my-subnet"
URI="gs://${BUCKET_NAME}/exported-image.vmdk"

gcloud compute images export --destination-uri $URI --image $IMAGE_NAME --project $PROJECT --network $NETWORK --subnet $SUBNET

Source: https://cloud.google.com/sdk/gcloud/reference/compute/images/export#--network

Ockham
  • 1
  • 1