# Rename and tag an instance

> Change an instance's hostname, add tags, and copy the identifiers support and the API ask for.

Source: https://docs.coritan.com/cloud-compute/settings/

In the dashboard:

- /dashboard/compute/…/settings: https://www.coritan.com/dashboard/compute

The **Settings** tab holds an instance's name, its tags and the identifiers that support and the API ask for. It also links to the tabs where you rebuild or cancel the instance.

## Before you begin

- A new name reaches the inside of the instance when you next start or restart it from the dashboard. To apply it at once, the instance must be running so that it can restart.
- The instance must not be suspended or moving to another host. Renaming a suspended instance fails with `Instance is suspended`.

## Rename the instance

1. In the [dashboard](https://www.coritan.com/dashboard/compute), go to **Cloud Compute**, open the instance and select the **Settings** tab.
2. On the **Name** card, type the new name under **Hostname**. Use letters, digits and hyphens, up to 63 characters, with no hyphen at the start or end.
3. To apply it now, tick **Reboot now so the guest picks it up**. Leave it clear to apply the name at the next start.
4. Select **Save hostname**.

The **Cloud Compute** list and the instance header show the new name at once. Inside the instance, cloud-init sets it as the hostname at the next start or restart from the dashboard. The **Hostname** card on the **Access** tab changes the same name, as [Change the hostname](/cloud-compute/access/#change-the-hostname) describes.

A hostname is one label, such as `web-2`, and it creates no DNS record. To reach the instance at a name such as `web-2.example.com`, follow [Manage an instance's addresses and names](/cloud-compute/networking/).

## Tag the instance

1. On the **Tags** card, type a tag in **Add a tag**, such as `production`.
2. Press <kbd>Enter</kbd> or select **Add tag**. **Suggestions** offers tags you already use on other instances.
3. To remove a tag, select the cross on its chip.

A tag uses lowercase letters, digits and hyphens, and starts with a letter or a digit. The dashboard saves each change at once. Tags on the instance filter the **Cloud Compute** list. Its service keeps a separate set, as [Tag your services](/get-started/tags/) explains.

## Find the instance's identifiers

The **Identifiers** card lists what support asks for when you contact them.

**Instance**
: The instance's ID, a UUID. The card shows its first eight characters. Select **Copy instance ID** to copy all of it. The API uses this ID in every Cloud Compute path.

**VM ID**
: The number of the virtual machine on its host.

**Node**
: The host the instance runs on, with its location.

**Service**
: The service that carries the instance's plan and billing, as `#` and its number. Select it to open the service.

**Created**
: When we created the instance.

**State**
: Whether the instance is running or stopped now.

## Rebuild or cancel the instance

The **Danger zone** card links to the two actions that erase the instance's data. Each one asks you to type a word before it goes ahead.

- **Rebuild operating system** wipes the disk and installs a fresh image. Select **Open Access** to go to the **Access** tab, then follow [Rebuild an instance](/cloud-compute/rebuild/).
- **Cancel service** stops billing and deletes the instance. Select **Open Billing** to go to the **Billing** tab, then follow [Cancel the instance](/cloud-compute/billing/#cancel-the-instance).

## Result

The instance has its new name in the dashboard at once. Inside the instance, the name applies after the next start or restart from the dashboard. The instance's tags show on the **Tags** card and in the **Cloud Compute** list.

## Troubleshooting

`Letters, digits and dashes only; up to 63 characters; no leading or trailing dash.`
: The name has a dot, a space or another character a hostname cannot hold, or it is too long. Use one label, such as `web-2`.

**Save hostname** stays greyed out
: The name is the one the instance already has, or it breaks the rules above. Change it, or correct the mistake the field shows.

**Reboot now so the guest picks it up** is greyed out
: The instance is stopped. Save the name without it. The instance takes the name when you start it.

`hostname` inside the instance still prints the old name
: The instance has not booted since you saved the name. Select **Restart** in the instance header. A `reboot` typed inside the instance does not apply the name.

`Instance is suspended`
: We suspended the instance, usually for an unpaid invoice. Select **Open Billing** in the alert at the top of the page and pay the open invoice.

**Could not save the tags** with `Tag must be 1–128 chars: lowercase letters, digits, hyphen, underscore`
: The tag has a character that tags cannot hold, such as a dot, a colon or a slash, or it starts with a hyphen. Use lowercase letters, digits and hyphens.

## Related

- [Manage an instance's password, SSH keys and hostname](/cloud-compute/access/)
- [Tag your services](/get-started/tags/)
- [Rebuild an instance](/cloud-compute/rebuild/)
- [Change an instance's plan or cancel it](/cloud-compute/billing/)
- [Contact support from the dashboard](/support/conversations/)

## With the API

`GET /api/v1/client/vps/{uuid}` returns the identifiers on this tab: `uuid`, `vmid`, `node_name`, `location_name`, `service_id`, `created_at` and `status`.

```bash
curl -s https://api.coritan.com/api/v1/client/vps/$INSTANCE_UUID \
  -H "Authorization: Bearer $CORITAN_TOKEN"
```

To rename the instance, send `hostname`. Add `"reboot": true` to restart it at once.

```bash
curl -s -X PATCH https://api.coritan.com/api/v1/client/vps/$INSTANCE_UUID/hostname \
  -H "Authorization: Bearer $CORITAN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"hostname": "web-2", "reboot": true}'
```

```json
{"hostname": "web-2", "rebooted": true}
```

`rebooted` repeats what you asked for. A stopped instance does not start, even when it says `true`. A name that breaks the rules answers `400` with `Invalid hostname`, or `422` when it is longer than 63 characters.

An instance's tags use the source type `vps` and the instance's UUID:

```bash
curl -s -X PUT https://api.coritan.com/api/v1/client/tags/sources/vps/$INSTANCE_UUID \
  -H "Authorization: Bearer $CORITAN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"tags": ["production", "eu-customers"]}'
```

[Tag your services](/get-started/tags/#with-the-api) covers the rest of the tags API. The [Cloud Compute API reference](/api/reference/client/cloud-compute/#op-patch-api-v1-client-vps-uuid-hostname) lists every field.
