---
title: "Upgrades"
description: "Move a Valkey cache to a newer version in place, or through a blue/green deployment you test first. Both are one-way."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Upgrades

Patch releases within a version are applied in the cache's
[maintenance window](/caches/create#maintenance). Moving to a newer version, such as Valkey 8.1 to 9.1,
is your choice, made in one of two ways. Both are one-way: a cache can't go back to an older version,
and a downgrade is refused with `409 downgrade_not_supported`.

## In place

```sh
ezgh caches update cch_4k2m9x0a7qpe --engine-version 9.1 --wait
```

In the console, it's **Upgrade** on the cache's **Details** tab. The cache is `upgrading` and keeps serving. It
starts at once, on caches with or without a standby. When it moves over, writes pause for a few
seconds and open connections end; clients reconnect to the same endpoint. No data is lost.

If the upgrade can't complete, its operation fails and the cache stays on its version, unchanged.

**Memcached**: a new `engineVersion` is applied in the maintenance window, and the cache starts empty.

## Blue/green deployments

Valkey only (`409 not_supported` on Memcached). A blue/green deployment makes a copy of the cache
(**blue**) on the new version (**green**), kept in step with blue, with its own endpoint to test
against. A **switchover** then makes green the cache, at blue's endpoint and with its ID.

### Create a deployment

```sh
ezgh caches blue-green create cch_4k2m9x0a7qpe --target-engine-version 9.1 --wait
```

| Setting | |
| --- | --- |
| `targetEngineVersion` | The newer version green runs. |
| `targetInstanceType` | Green's size. The cache's by default. |
| `targetMode` | Green's mode, `memory` or `persistent`. The cache's by default. This is how a cache changes mode. |
| `targetStorage` | Green's storage, for a persistent green. |
| `switchoverTimeoutSeconds` | How long a switchover may wait for green to catch up, 1 to 300 seconds. 30 by default. |

A cache has one open deployment at a time. Green gets the cache's standby setting and its users.

### While it's open

- **Green** is read-only, on its own endpoint (`greenEndpoint`, `null` until the name resolves). Test
  your clients and reads against it.
- **Users** you create, change, rotate or delete apply to blue and green.
- **Other changes to the cache** are refused with `409 blue_green_in_progress`, except its name,
  description, tags and allowed sources, and maintenance waits.
- **A failover** of blue keeps green in step with it.

### Switch over

```sh
ezgh caches blue-green switchover cbg_6r2k8m4p1xqz --wait
```

Writes pause on blue until green has every write, then the cache's endpoint moves to green and green
takes writes. Open connections end, and clients reconnect to the same endpoint. No data is lost. The
cache keeps its ID, name and endpoint, and runs the new version. Green's test endpoint goes away.

If green hasn't caught up within the switchover timeout, blue takes writes again and nothing changes:
the switchover's operation fails, and the deployment is `available` again.

A switchover is refused with `409 not_ready` until the deployment is `available`. It's one-way: the old
copy is gone once it completes.

### Delete a deployment

```sh
ezgh caches blue-green delete cbg_6r2k8m4p1xqz --wait
```

Before a switchover, deleting discards green. After one, it removes the finished deployment.

### Status

| Status | Means |
| --- | --- |
| `creating` | Green is being made. |
| `available` | Green is ready to test and to switch over to. |
| `switching_over` | A switchover is running. |
| `switched_over` | Green is the cache. |
| `failed` | The deployment ended; `failure` says why. Delete it. |
| `deleting` | It's being deleted. |

Source: https://docs.ezghcloud.com/caches/upgrades/index.mdx
