<a id="cloud-cluster-resize"></a>

# Resize a Dedicated Kafka Cluster

Basic, Standard, Enterprise, and Freight
clusters are elastic and scale automatically based on load. Dedicated
clusters don’t scale automatically, but you can resize one to meet your needs by
changing its [Confluent Unit for Kafka (CKU)](../_glossary.md#term-Confluent-Unit-for-Kafka-CKU) count to expand or shrink
capacity.

Choosing the right number of [CKUs](cluster-types.md#cku-details) helps you reduce costs or
scale to meet your streaming needs. Use the
[Confluent Cloud Console](#cloud-cluster-resize-console-walkthrough),
[Confluent CLI](#cloud-cluster-resize-cli-walkthrough), or
[REST API](#cloud-cluster-resize-restapi-walkthrough) to resize your
cluster.

When you resize a [Dedicated Kafka cluster](cluster-types.md#dedicated-cluster),
Confluent rebalances the cluster to help ensure a balanced load across the
remaining brokers in the cluster. If you’re reducing the size of the cluster,
Confluent removes unused brokers at the end of the rebalance operation.

Prerequisites:

- An existing [Dedicated Kafka cluster](cluster-types.md#dedicated-cluster)
- Usage-based billing enabled

Considerations:

- You cannot request another resize until the current resize completes.
- To decide whether to expand, see [Interpret a high cluster load value](../monitoring/monitor-performance.md#cloud-cluster-load-expansion).
- Confluent blocks shrink requests that would violate the per-CKU dimension
  limits for partitions or ingress/egress throughput for the requested cluster
  size. Multi-zone Dedicated Apache Kafka® clusters require a minimum capacity
  of 2 CKUs. For more information, see
  [CKU limits per cluster](cluster-types.md#cku-limits-per-cluster) and
  [Kafka cluster service quotas](../quotas/service-quotas.md#ccloud-resource-limits-kafka-cluster).
- If a shrink operation fails, the cluster expands to its original capacity, and
  you receive a notification when the expansion is complete.

<a id="dedicated-provisioning-and-scaling-time"></a>

## Time estimates

A resize operation involves Confluent provisioning the added or removed
capacity and rebalancing partitions across the cluster.

### Provisioning time

Provisioning typically takes less than two hours. You receive an email when
provisioning is complete.

Sometimes, due to cloud-provider-specific constraints, provisioning can take
longer. Check the
[Confluent Cloud status page](https://status.confluent.cloud/) for any
ongoing service disruptions. Contact
[Confluent Support](https://support.confluent.io) if provisioning takes
longer than 6 hours.

Provisioning time is excluded from the
[Confluent SLA](https://confluent.io/confluent-cloud-uptime-sla/).

### Resizing time

Resizing typically takes about 30 to 60 minutes per CKU. You receive an email
when the resize operation is complete.

When a cluster is under heavy load or has many partitions to move, resizing can
take longer than expected. If you foresee a scheduled event that requires more
CKU capacity, proactively scale up the cluster in advance. Doing so accounts for
potential delays caused by resource constraints and the rebalancing process.

During a resize operation, your applications might detect leader elections, but
performance remains stable. Supported Kafka clients handle these changes
gracefully.

## Resize a cluster

Choose a method to resize your cluster:
[Confluent Cloud Console](#cloud-cluster-resize-console-walkthrough),
[Confluent CLI](#cloud-cluster-resize-cli-walkthrough), or
[REST API](#cloud-cluster-resize-restapi-walkthrough).

<a id="cloud-cluster-resize-console-walkthrough"></a>

### Cloud Console

1. Navigate to the clusters page for your environment and select your
   Confluent Cloud cluster.
2. Select the **Settings** tab. Under **CKU limits**, the current capacity
   displays with an **Adjust capacity** button.
3. Click **Adjust capacity**. Use the slider to set the number of CKUs for
   the cluster, either expanding or shrinking from the current value. The
   estimated hourly cost updates as you move the slider.
   ![Adjust capacity slider on the cluster Settings tab.](images/_clusters/cluster-adjust-capacity.png)

   #### NOTE
   In rare scenarios, such as when you have recently expanded
   your cluster, you might see a warning that cluster metrics are
   delayed in the Cloud Console. If this occurs, wait 1 to 2
   hours and retry the shrink operation.
4. When the new capacity looks correct, click **Apply changes**.

<a id="cloud-cluster-resize-cli-walkthrough"></a>

### Confluent CLI

To resize a cluster, run the following command in your terminal, specifying the
number of CKUs you want with `--cku`. For full details, see
[confluent kafka cluster update](https://docs.confluent.io/confluent-cli/current/command-reference/kafka/cluster/confluent_kafka_cluster_update.html).

```none
confluent kafka cluster update <id> --cku <cku>
```

For example, the following command resizes the `lkc-abc123` cluster to 4
CKUs:

```none
confluent kafka cluster update lkc-abc123 --cku 4
```

<a id="cloud-cluster-resize-restapi-walkthrough"></a>

### Confluent Cloud APIs

To resize a cluster, make a `PATCH` call that specifies the number of CKUs you
want with `"cku":`. For parameter descriptions and more details, see
[Update Kafka clusters](update-cluster.md#cloud-cluster-update-api).

For example, the following command resizes the `lkc-abc123` cluster to 4
CKUs:

```bash
PATCH /cmk/v2/clusters/lkc-abc123?environment=env-test1 HTTP/1.1
Host: api.confluent.cloud

{
   "spec": {
         "config": {
               "kind": "Dedicated",
               "cku": 4
         },
         "environment": {
               "id": "env-test1"
         }
   }
}
```
