2

Several of Google Cloud Platform's pre-built disk images have their location set to asia,eu,us.

Pre-built images with asia,eu,us location

However, I have not been able to set the location to asia,eu,us for my own disk images.

The documentation for gcloud compute images create says:

--storage-location=LOCATION

Specifies a Cloud Storage location, either regional or multi-regional, where image content is to be stored. If not specified, the multi-region location closest to the source is chosen automatically.

However, using the --storage-location= flag, I've only been able to set it to a single multi-region, like us.

Context

I want to avoid intercontinental egress every time I boot a VM in Europe or Asia using a disk image I authored in a US region. Rather, want to pay the intercontinental egress cost once when I author the disk image, and then benefit from same zone/same region egress pricing for each VM boot.

  • I didn't have a chance to verify this yet, but seems like the REST API might support multiple storage locations per image: https://cloud.google.com/compute/docs/images/create-delete-deprecate-private-images#api – ehudt Nov 02 '21 at 12:25

3 Answers3

1

A good workaround would be to create a disk snapshot and save it in different regions, you can then use those to spin up new vms from the snapshots. So essentially you would take a snapshot of your existing vm and save it in a different region. Once that is done, you can go to your snapshots that you have saved in different regions and create an instance from the snapshot, thus eliminating cross region egress. Please view this documentation for further instructions[1]

[1] https://cloud.google.com/compute/docs/disks/create-snapshots

0

The Google compute images create API endpoint takes a list of strings but has validation to only permit 1 item. If you try pass more than one location you receive a 400 response with the following error message.

{
  "message": "Value for field 'resource.storageLocations' is too large: maximum size 1 element(s); actual size 2.",
  "domain": "global",
  "reason": "fieldSizeTooLarge"
}
0

You can't. The image lives in a GCS bucket and its location is restricted to regions and multi-regions that a bucket can be assigned to.

From Creating a Custom Image:

Selecting an image storage location

When creating a custom image, you can specify the image's Cloud Storage location, excluding dual-region locations. By specifying the image storage location, you can meet your regulatory and compliance requirements for data locality as well as your high availability needs by ensuring redundancy across regions.

The storage location feature is optional. If you do not select a location, Compute Engine stores your image in the multi-region closest to the image source.