Search code examples
google-cloud-platformgoogle-compute-enginegoogle-apis-explorer

How to get information about all available images to create vm instance through API


I am creating a sort of Demand entry App in which I want to populate metadata(regions, zones, images etc) through google API. I am calling this API, for example, https://compute.googleapis.com/compute/v1/projects/{project}/global/images with my project id. But I got 200 responses and don't see any data.

Thanks
Kovi

https://compute.googleapis.com/compute/v1/projects/{project}/global/images

{
  "id": "projects/sap-iidc-cde/global/images",
  "selfLink": "https://www.googleapis.com/compute/v1/projects/sap-iidc-cde/global/images",
  "kind": "compute#imageList"
}

Solution

  • This API only returns custom images available to the specified project. A custom image is one that the Project created.

    If you want to list images in other projects such as Debian or Windows, you need to use their project ID.

    Well known images projects:

    centos-cloud, coreos-cloud, debian-cloud, cos-cloud, rhel-cloud, rhel-sap-cloud, suse-cloud, suse-sap-cloud, ubuntu-os-cloud, windows-cloud, windows-sql-cloud
    

    To list images use the SDK CLI. This will show you the various Project IDs associated with each image.

    gcloud compute images list