Obtain a list of image and plan types using Linode API/CLI?
We are currently using a script to automatically create nodes, the image and type is listed below:
"image": "linode/ubuntu18.04",
"type": "g6-nanode-1",
We need a node with more memory, however, I am unable to find a list of nodes with listed CPU/Memory combination with exact 'type' that I need to specify in our script.
Can you point me to the right document?
Thank you.
2 Replies
While I'm not very familiar with the API myself, as I don't do a lot of actual programming, I do use the Linode CLI in Bash scripts quite a bit, and this can also be found very easily using that tool. If you have the Linode CLI installed, you can list the available image and plan types using the commands:
linode-cli images list
linode-cli linodes types
These commands will list all of the values that you would need for assigning the 'image' and 'type' variables. With 'linode-cli' commands, you are also able to easily use tools like 'grep' and 'awk' to obtain specific pieces of data by appending your 'linode-cli' commands with the '--text' flag. For example, to get a Linode's ID number and assign it to a variable, assuming the Linode's label lives in the variable $Label:
LinID=$(linode-cli linodes list --text | grep "${Label}" | awk '{print $1}')
You can also figure out the plan types by following the format (leave out the ''):
planGeneration-planClass-numberOfvCPUs
For example:
1GB Nanode (1 vCPU):
g6-nanode-1
2GB Linode (1 vCPU) or 4GB Linode (2 vCPUs):
g6-standard-1
g6-standard-2
300GB High Memory Linode (16 vCPUs):
g6-highmem-16
Linode images work similarly, and follow the format:
source/os_version
For example:
A Linode-supplied Ubuntu 16.04 LTS or Fedora 28 image:
linode/ubuntu16.04lts
linode/fedora28
A custom install from a saved image on your account titled 'savedimage':
private/savedimage
You can also find our documentation on obtaining a list of images here,
as well as a list of plan types here. These links lead to the relvant pages of the Linode APIv4 documentation.