Skip to content

Instantly share code, notes, and snippets.

@QuentinBrosse
Last active August 9, 2021 12:24
Show Gist options
  • Save QuentinBrosse/d8ece883ec0dbcc2dabd2d453945b4fb to your computer and use it in GitHub Desktop.
Save QuentinBrosse/d8ece883ec0dbcc2dabd2d453945b4fb to your computer and use it in GitHub Desktop.
Find Scaleway Image ID by Label

Find Scaleway Image ID by Label

It could be difficult to find a Scaleway image ID for the right zone, architecture, and instance type. The Scaleway marketplace API has an endpoint dedicated to that but it could be difficult to understand the response and to find the right image UUID.

Here is a bash command that returns a JSON with just the necessary information needed to find your image ID.

curl -s 'https://api-marketplace.scaleway.com/images?page=1&per_page=100' | sed 's/par1/fr-par-1/g; s/ams1/nl-ams-1/g' | jq '.images | map({"key": .label | gsub("_";"-"), "value": .versions[0].local_images}) | from_entries'

The response is a map with the image label in key and an array of compatible images in value:

{
  "ubuntu-bionic": [ // Image label that can be used in terraform and Go SDK.
    {
      "compatible_commercial_types": [ // Instance types that are compatible with this image.
        "DEV1-S",
        "DEV1-M"
      ],
      "arch": "x86_64", // Architectures that are compatible with this image.
      "id": "f974feac-abae-4365-b988-8ec7d1cec10d", // UUID of the image.
      "zone": "fr-par-1" // Zone in which the image is available.
    },
    {
      "compatible_commercial_types": [
        "C1"
      ],
      "arch": "arm",
      "id": "f63fe42a-900f-4a5e-ba99-ab0e59469b7e",
      "zone": "fr-par-1"
    },
    // ...
  ]
}

Requirements

To run this command, curl, jq and sed are required.

@mig5
Copy link

mig5 commented Mar 17, 2021

Merci Quentin !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment