# Resize VMs

> Resizing changes an Azure server's VM size in place, from the server's own page or through the API

---

Site [llms.txt](/llms.txt)

---

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](https://docs.microsoft.com/en-us/azure/virtual-machines/sizes).

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:

1. Go to **Admin** > **Server Actions**.
1. 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

1. Open the server and select **Resize VM** from its server actions.
1. Select a **New Size**.
1. 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](/docs/cmp/developer-resources/rest-api/).

Request a server to see the actions available on it, each with the URI that runs it:

```bash
curl -H "Authorization: Bearer [encrypted_token_value]" https://[cb_server]/api/v2/servers/[server_number]/
```

The response lists each action under `_links`:

```json
{
  "_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**:

```bash
$ 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/
```

<div class="alert alert-info" role="alert">


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."
</div>


## Related

- [Provisioning](/docs/cmp/configure/infrastructure/resource-handlers/azure/provisioning/): the **Node Size** parameter and the storage type its options depend on.
- [Modify or add disks](/docs/cmp/configure/infrastructure/resource-handlers/azure/modify-or-add-disks/): change a server's disks rather than its size.
- [Server actions](/docs/cmp/use/orchestration/actions/server-actions/): how server actions are managed and who can run them.
