<a id="cluster-manage-instance"></a>

# How to manage instances in a cluster

In a cluster setup, each instance lives on one of the cluster members.
You can operate each instance from any cluster member, so you do not need to log on to the cluster member on which the instance is located.

<a id="cluster-target-instance"></a>

## Launch an instance on a specific cluster member

When you launch an instance, you can target it to run on a specific cluster member.
You can do this from any cluster member.

For example, to launch an instance named `c1` on the cluster member `server2`, use the following command:

```none
lxc launch ubuntu:24.04 c1 --target server2
```

You can launch instances on specific cluster members or on specific [cluster groups](https://canonical.com/lxd/docs/latest/howto/cluster_groups/index.html.md#howto-cluster-groups).

If you do not specify a target, the instance is assigned to a cluster member automatically.
See [Automatic placement of instances](https://canonical.com/lxd/docs/latest/explanation/clusters/index.html.md#clustering-instance-placement) for more information.

## Check where an instance is located

To check on which member an instance is located, list all instances in the cluster:

```none
lxc list
```

The location column indicates the member on which each instance is running.

<a id="howto-cluster-manage-instance-migrate"></a>

## Migrate an instance

You can migrate an existing instance to another cluster member.
For example, to migrate the instance `c1` to the cluster member `server1`, use the following commands:

```none
lxc stop c1
lxc move c1 --target server1
lxc start c1
```

See [How to migrate LXD instances between servers](https://canonical.com/lxd/docs/latest/howto/instances_migrate/index.html.md#howto-instances-migrate) for more information.

To migrate an instance to a member of a cluster group, use the group name prefixed with `@` for the `--target` flag.
For example:

```none
lxc move c1 --target @group1
```
