Search code examples
google-cloud-platformgoogle-compute-enginegcloudgsutil

(gcloud.compute.images.create) Could not fetch resource: Invalid value for field 'resource.rawDisk.source'


I'm trying to create a custom image for Google Compute Engine by using a file from Cloud Storage with the following command:

gcloud compute images create my-custom-image-name --source-uri gs://my-storage-bucket-name/gce-demo-tar.gz  

Output:

ERROR: (gcloud.compute.images.create) Could not fetch resource:
  - Invalid value for field 'resource.rawDisk.source': 'https://storage.googleapis.com/storage/v1/b/my-storage-bucket-name/o/gce-demo-tar.gz'.
    The provided source is not a supported file.

The file in question is from a virtual machine exported in RAW format using the following command:

VBoxManage clonehd -format RAW ~/VirtualBox\ VMs/SLES12sp5/SLES12sp5.qcow ~/disk.raw

Then archived with the following command:

gtar -cSzf gce-demo-tar.gz disk.raw

However, I'm not sure if the problem is related to the file itself as I have exactly the same error if I try to import an OVA file or it may be related to storage permissions or configuration?

Thank you!


Solution

  • In the file path when specifying your --source-uri flag, try gs://my-storage-bucket-name/gce-demo.tar.gz and make sure the file is uploaded with the same name.

    The error might be occurring because of the file extension you tried to use, which is .gz and it should be .tar.gz instead.