Resize VMs
2 minute read
Resizing is a server action named Resize VM, which Cloud Management Platform (CMP) enables by default. It runs against Azure and AWS servers.
Which sizes are offered
An Azure VM size, such as Standard_D2s_v3, sets the CPUs, memory, and disk types available to a server. Not every size can be resized to any other size, and what is possible depends on where the VM is deployed. See Microsoft’s documentation on sizes for Azure virtual machines.
The resize dialog offers the sizes that are in both of two sets: the sizes Azure reports the VM can move to, and the sizes CMP already knows as values of the Node Size parameter. A size Azure allows but CMP has never imported does not appear, and neither does a size CMP knows but Azure will not accept for that VM.
Enable or disable the action
Resize VM is enabled when CMP is installed. To turn it off or back on:
- Go to Admin > Server Actions.
- Find Resize VM and set its enable toggle.
When enabled, the action appears in the server actions list on every Azure and AWS server page.
Resize a server
- Open the server and select Resize VM from its server actions.
- Select a New Size.
- Select Run.
CMP starts a job to resize the VM and then refreshes the server, so the CPU and memory values in the server overview reflect the new size once the job finishes.
Resize through the API
For general API usage, including authentication, see REST API.
Request a server to see the actions available on it, each with the URI that runs it:
curl -H "Authorization: Bearer [encrypted_token_value]" https://[cb_server]/api/v2/servers/[server_number]/
The response lists each action under _links:
{
"_links": {
"actions": [
{
"Resize VM": {
"href": "/api/v2/servers/[server_number]/actions/2/",
"title": "Run 'Resize VM' on '[server_hostname]'"
}
}
]
}
}
Post the new size to the href given for Resize VM:
$ curl -XPOST -H 'Content-Type: application/json' \
-d '{"new_size": "Standard_D2s_v3"}' \
-H "Authorization: Bearer [encrypted_token_value]" \
https://[cb_server]/api/v2/servers/[server_number]/actions/2/
The API accepts the same sizes as the dialog. A size outside that set is accepted by the request but fails the job, with the message “Requested VM size … is not allowed.”
Related
- Provisioning: the Node Size parameter and the storage type its options depend on.
- Modify or add disks: change a server’s disks rather than its size.
- Server actions: how server actions are managed and who can run them.