# Update a Database Instance

Launch stage: Public Preview

`PATCH /api/2.0/database/instances/{name}`

Update a Database Instance.

 For new workloads, Databricks recommends the Postgres API equivalents:
 [Update a project](https://docs.databricks.com/api/postgres/v1/update-project) and
 [Update an endpoint](https://docs.databricks.com/api/postgres/v1/update-endpoint).

API scopes: postgres

Clouds: AWS, Azure

## Path parameters

- `name` (string, required)
  The name of the instance. This is the unique identifier for the instance. Must be 1 to 63
   characters long, contain only letters, digits and hyphens, start with a letter, and not contain
   consecutive hyphens.

## Query parameters

- `update_mask` (string, required)
  The list of fields to update. If unspecified, all fields will be updated when possible. Use "*" to
   update every field. To wipe out custom_tags, specify custom_tags in the update_mask with an empty
   custom_tags list.

## Request body

Specifies the instance to update, identified by its name.
- `capacity` (string, optional)
  The sku of the instance. Valid values are "CU_1", "CU_2", "CU_4", "CU_8". Must be set when
   creating an instance.
- `stopped` (boolean, optional, Input only)
  Whether to stop the instance. An input only param, see effective_stopped for the output. An
   instance cannot be created in the stopped state; set this field on update to stop or start
   the instance.
- `node_count` (int32, optional, Input only)
  The number of nodes in the instance, composed of 1 primary and 0 or more secondaries. Defaults to
   1 primary and 0 secondaries. This field is input only, see effective_node_count for the output.
- `enable_readable_secondaries` (boolean, optional, Input only)
  Whether to enable secondaries to serve read-only traffic. Defaults to false. Requires a
   node_count greater than 1.
- `retention_window_in_days` (int32, optional, Input only)
  The retention window for the instance. This is the time window in days
   for which the historical data is retained. The default value is 7 days.
   Valid values are 2 to 35 days.
- `parent_instance_ref` (object, optional, Immutable)
  The ref of the parent instance. This is only available if the instance is a
   child instance. A child instance inherits custom_tags and usage_policy_id from
   its parent and cannot set them.
   Input: For specifying the parent instance to create a child instance. Optional.
   Output: Only populated if provided as input to create a child instance.
  - `name` (string, optional)
    Name of the ref database instance.
  - `lsn` (string, optional, Input only)
    User-specified WAL LSN of the ref database instance.
    
     Input: For specifying the WAL LSN to create a child instance. Optional.
     Output: Only populated if provided as input to create a child instance.
  - `branch_time` (string, optional)
    Branch time of the ref database instance.
     For a parent ref instance, this is the point in time on the parent instance from which the
     instance was created.
     For a child ref instance, this is the point in time on the instance from which the child
     instance was created.
     Input: For specifying the point in time to create a child instance. Optional.
     Output: Only populated if provided as input to create a child instance.
- `enable_pg_native_login` (boolean, optional, Input only)
  Whether to enable PG native password login on the instance. Defaults to false.
- `usage_policy_id` (string, optional, Beta, Input only)
  The desired usage policy to associate with the instance.
- `custom_tags` (array of object, optional, Beta, Input only)
  Custom tags associated with the instance. This field is only included on create and update responses.
   An instance can have at most 10 tags; keys must be unique ignoring case.
  - `key` (string, optional, Beta)
    The key of the custom tag.
  - `value` (string, optional, Beta)
    The value of the custom tag.

## Returns

Returns the DatabaseInstance object.

## Request

### Resize an instance (update_mask=capacity)

```json
{
  "capacity": "CU_2"
}
```

## Response

### Instance being resized

```json
{
  "uid": "6f1c2f1e-5b4a-4e3d-9c8b-7a6d5e4f3c2b",
  "name": "sales-orders-db",
  "creator": "user@example.com",
  "read_write_dns": "instance-6f1c2f1e-5b4a-4e3d-9c8b-7a6d5e4f3c2b.database.cloud.databricks.com",
  "creation_time": "2025-06-01T12:00:00Z",
  "state": "UPDATING",
  "pg_version": "PG_VERSION_16",
  "capacity": "CU_2",
  "effective_capacity": "CU_2",
  "effective_stopped": false,
  "effective_node_count": 1,
  "effective_enable_readable_secondaries": false,
  "effective_retention_window_in_days": 7,
  "effective_enable_pg_native_login": false
}
```

