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

# Amazon ElastiCache Serverless for Valkey

> AWS ElastiCache Serverless cache on Valkey 9, billed on usage, with TLS and a password-protected user, on the Qovery cluster network. Needs a cluster-mode client.

Qovery creates it in the AWS account of the environment's cluster, as a [Blueprint](https://www.qovery.com/docs/configuration/blueprints.md) service in one of your environments.

| | |
| - | - |
| Catalog name | `aws-elasticache-valkey-serverless` |
| Category | Databases & Caches |
| Provider | AWS |
| Engine | terraform |
| Major versions (latest release) | `9` (1.2.1) |
| Source | [AWS/valkey-serverless/9](https://github.com/Qovery/service-catalog/tree/AWS/valkey-serverless/9/1.2.1/AWS/valkey-serverless/9) |

> [!TIP]
>
> **New to this?** You don't need to know Kubernetes or Terraform. Qovery sets up Amazon ElastiCache Serverless for Valkey in your cloud account and manages it for you: you fill in a form, or paste the prompt below into your coding agent. The values it publishes, listed under Outputs, reach your other services as environment variables. Qovery tells you when a newer version of the Blueprint is available. Check the requirements in the Reference section before you start, and try it first in a development environment.

## Create it

> [tab] Console
>
> 1. Open the environment, then **New service** › **Blueprint**.
> 2. Find **Amazon ElastiCache Serverless for Valkey** in the catalog and pick the major version.
> 3. Fill in the variables. Required ones are marked; the others use their defaults.
> 4. Create the service, and deploy it now or later.

> [tab] CLI and API
>
> List the catalog to get the latest tag, then create the service from it. `qovery api` signs the requests with your CLI session.
>
> ```bash theme={null}
> ORG_ID="REPLACE_WITH_ORGANIZATION_ID"
> ENV_ID="REPLACE_WITH_ENVIRONMENT_ID"
>
> qovery api "organization/$ORG_ID/blueprint/catalog" | jq '.. | objects | select(.name? == "aws-elasticache-valkey-serverless")'
>
> cat > blueprint.json <<'EOF'
> {
>   "name": "aws-elasticache-valkey-serverless",
>   "tag": "AWS/valkey-serverless/9/1.2.1",
>   "icon": "app://qovery-console/redis",
>   "variables": [
>     {
>       "name": "valkey_name",
>       "value": "REPLACE_WITH_VALKEY_NAME"
>     }
>   ],
>   "spec_overrides": {
>     "engine_version": "1.9.7"
>   }
> }
> EOF
> BLUEPRINT_ID=$(qovery api "environment/$ENV_ID/blueprint" --method POST --input - < blueprint.json | jq -r .id)
> rm blueprint.json   # it can hold secret values
> qovery api "blueprint/$BLUEPRINT_ID"   # status of the latest deployment
> ```
>
> Replace each `REPLACE_WITH_` value. Add optional variables to `variables` the same way.
>
> Creating the service starts its first deployment. To deploy it again later, run `qovery api "blueprint/$BLUEPRINT_ID/deploy" --method POST`.

> [tab] Coding agent
>
> Paste this into Claude Code, Cursor, Codex or another coding agent with the [Qovery agent skills](https://www.qovery.com/docs/getting-started/quickstart/agent-skills.md) installed (`curl -fsSL https://skill.qovery.com/install.sh | bash`).
>
> ```text Prompt wrap theme={null}
> Add the Qovery Blueprint Amazon ElastiCache Serverless for Valkey (aws-elasticache-valkey-serverless) to one of my Qovery environments and deploy it. Ask me for valkey_name.
> Ask me before deploying to a production environment.
> Docs: https://www.qovery.com/docs/configuration/blueprints/aws-elasticache-valkey-serverless.md
> ```

You don't add any file to your repository. Qovery creates the Blueprint from the Console or the API.

## Variables and outputs

Generated from `qbm.yml` at `AWS/valkey-serverless/9/1.2.1`, the manifest the Console form is built from.

> [accordion] All 10 variables
>
> | Name | Type | Required | Default | Secret | Description |
> | - | - | - | - | - | - |
> | `valkey_name` | string | Yes | | | Letters, digits, single hyphens; must start with a letter and end with a letter or digit; max 32 chars. No underscores. |
> | `valkey_password` | string | | | Yes | Leave empty and Qovery generates a 32-character one. To set your own: 16–128 chars, no comma, /, @, " or spaces. A change replaces it. |
> | `data_storage_max_gb` | number | | `0` | | 0 = the AWS maximum, 5000 GB. Else the most data the cache may store, in GB (1–5000). |
> | `ecpu_per_second_max` | number | | `0` | | 0 = the AWS maximum, 15000000. Else the most ECPUs per second the cache may use (1000–15000000). |
> | `subnet_ids` | string | | | | Leave empty — derived from the cluster's ElastiCache subnet group. Set it (comma-separated, one per AZ) only on a user-provided VPC; read at creation. |
> | `security_group_ids` | string | | | | Leave empty for the blueprint's own group (opens 6379–6380 to allowed\_cidrs). Else comma-separated ids. |
> | `allowed_cidrs` | string | | | | Leave empty to allow the whole VPC (every cluster pod). Else comma-separated IPv4 CIDRs; only affects the blueprint's security group. |
> | `backup_retention_period` | number | | `14` | | Days to retain daily automatic snapshots (0 disables) |
> | `daily_snapshot_time` | string | | `00:00` | | UTC, format hh24:mi. Only used when backup\_retention\_period > 0. |
> | `role_arn` | string | | | | Unset = use the cluster credentials directly. Set an IAM role ARN of the cluster's AWS account to assume it; cross-account roles are not supported. |

Outputs become environment variables that other services in the environment can use. By default Qovery also creates an alias for each output, prefixed with the Blueprint's name; see [Aliases Qovery creates for outputs](https://www.qovery.com/docs/configuration/environment-variables.md#aliases-qovery-creates-for-outputs) for the naming rules and the cases where no alias is created.

> [accordion] All 10 outputs
>
> | Name | Secret | Description |
> | - | - | - |
> | `valkey_identifier` | | ElastiCache serverless cache name |
> | `valkey_host` | | Hostname applications connect to (cluster-mode clients only) |
> | `valkey_port` | | Port of the primary endpoint, for writes and consistent reads |
> | `valkey_reader_port` | | Port of the reader endpoint, on the same hostname |
> | `valkey_username` | | Valkey user applications authenticate as |
> | `valkey_password` | Yes | Password of that user (generated when the input was left empty) |
> | `valkey_url` | Yes | Connection URL over TLS, on the primary endpoint |
> | `valkey_arn` | | Serverless cache ARN |
> | `valkey_engine_version_actual` | | Engine version actually running (including the patch AWS chose) |
> | `valkey_security_group_id` | | Security group created for the cache (empty when security\_group\_ids is set) |

> [!WARNING]
>
> Secret variables and outputs are encrypted and masked in Qovery, but Terraform can also keep their values, and values derived from them, in its state. With the Qovery-managed state backend (the default), Qovery stores the state. If you use your own backend, protect it and keep state files out of version control.

## Reference

From the Blueprint's [README](https://github.com/Qovery/service-catalog/blob/AWS/valkey-serverless/9/1.2.1/AWS/valkey-serverless/9/README.md).

Creates an AWS ElastiCache Serverless cache on Valkey 9. There is no node type or shard count to pick: AWS scales the cache with the load and bills the data stored and the ECPUs consumed. Traffic is encrypted in transit, data is encrypted at rest, and access goes through a password-protected user.

For a cache with a fixed node type, use the `aws-elasticache-valkey` blueprint instead.

### Connecting

Three things differ from the node-based blueprint:

* **Use a cluster-mode client.** A serverless cache always runs in cluster mode, and AWS only supports clients that speak the cluster protocol. Multi-key commands only work on keys that share a hash slot; across slots they fail with `CROSSSLOT`.
* **Two ports.** The cache serves writes and consistent reads on `6379` and replica reads on `6380`, on the same hostname. Many clients open connections to both, so the security group opens both.
* **A user name is required.** Applications authenticate as the `app` user with `valkey_password`. There is no auth token and no usable `default` user.

The `valkey_url` output carries all of it: `rediss://app:<password>@<host>:6379`. The `rediss://` scheme is correct: Valkey speaks the Redis protocol, and TLS is always on.

### Variables

#### Required

| Name | Type | Sensitive | Description |
| - | - | - | - |
| `valkey_name` | string | | Cache name, lowercased by AWS. Must start with a letter, end with a letter or digit, and use single hyphens between them; max 32 chars. Underscores are not allowed. |

The limit is 32 characters to leave room for the suffixes of the user id (`<name>-app`) and the user group id (`<name>-users`), which ElastiCache caps at 40.

#### Credentials

| Name | Type | Sensitive | Default | Description |
| - | - | - | - | - |
| `valkey_password` | string | yes | *generated* | Omit and Qovery generates a 32-character alphanumeric password. To set your own: 16–128 chars, must not contain a comma, /, @, ", or spaces. |

In the Console, leaving the field blank omits it. Through the API or Terraform, omit the variable rather than sending an empty string: the platform rejects an empty variable value.

Changing `valkey_password` replaces the password in place, without touching the cache or its data. AWS takes a few minutes to apply it (close to four in testing). Applications still holding the old one must be redeployed with the new value.

#### Usage limits

| Name | Type | Default | Description |
| - | - | - | - |
| `data_storage_max_gb` | number | `0` | Most data the cache may store, in whole GB (1–5000). `0` = the AWS maximum, 5000 GB. |
| `ecpu_per_second_max` | number | `0` | Most ECPUs per second the cache may use, a whole number (1000–15000000). `0` = the AWS maximum, 15000000. |

With both at `0`, the cache scales as far as AWS allows. A cap bounds the bill as well as the capacity.

The blueprint always sends both limits, with `0` translated to the AWS maximum. A cache whose limits are removed altogether cannot be updated: AWS rejects the call with `No modifications were requested`.

#### Network

| Name | Type | Default | Description |
| - | - | - | - |
| `subnet_ids` | string | | Leave empty — derived from the Qovery cluster's ElastiCache subnet group. Set it (comma-separated, one per Availability Zone) only on a cluster with a user-provided VPC, where that lookup finds nothing. Read at creation only. |
| `security_group_ids` | string | | Leave empty for the blueprint's own security group. Set it (comma-separated ids) to attach existing groups instead; they must open 6379 and 6380 to the cluster. |
| `allowed_cidrs` | string | | Leave empty to allow the whole VPC, which covers every pod of the cluster. Set it (comma-separated IPv4 network addresses, such as `10.0.0.0/24`) to narrow the blueprint's security group. Ignored when `security_group_ids` is set. |

By default the cache is attached to the Qovery cluster network. The subnets come from the ElastiCache subnet group created at cluster bootstrap (`elasticache-<cluster vpc id>`): one subnet per Availability Zone, three at most. The security group is created by the blueprint, named `qovery-valkey-serverless-<name>`, and opens 6379–6380 to every CIDR of the VPC. It does not reuse the cluster workers security group, which opens 6379 only.

ElastiCache cannot move a serverless cache to other subnets, so `subnet_ids` is read once. A later change to the variable or to the cluster's subnet group leaves the cache where it is.

#### Backups

| Name | Type | Default | Description |
| - | - | - | - |
| `backup_retention_period` | number | `14` | Whole days to retain daily automatic snapshots (0–35). `0` disables. |
| `daily_snapshot_time` | string | `00:00` | Time of the daily snapshot (UTC), `hh24:mi`. Only used when `backup_retention_period > 0`. |

**Deleting the service deletes the cache without a final snapshot.** The AWS Terraform provider has no argument for one on a serverless cache. To keep the data, take a manual snapshot in AWS before deleting the service.

#### IAM role

| Name | Type | Default | Description |
| - | - | - | - |
| `role_arn` | string | — | Unset = use the cluster credentials directly. Set an IAM role ARN of the cluster's AWS account to assume it; cross-account roles are not supported. |

### Outputs

| Name | Sensitive | Description |
| - | - | - |
| `valkey_identifier` | | ElastiCache serverless cache name |
| `valkey_host` | | Hostname to connect to, for cluster-mode clients |
| `valkey_port` | | Port of the primary endpoint (`6379`), for writes and consistent reads |
| `valkey_reader_port` | | Port of the reader endpoint (`6380`), on the same hostname |
| `valkey_username` | | Valkey user applications authenticate as (`app`) |
| `valkey_password` | yes | Password of that user (generated when the input was left empty) |
| `valkey_url` | yes | `rediss://app:<password>@<host>:<port>` on the primary endpoint |
| `valkey_arn` | | Serverless cache ARN |
| `valkey_engine_version_actual` | | Engine version actually running (incl. AWS-chosen patch) |
| `valkey_security_group_id` | | Security group created for the cache (empty when `security_group_ids` is set) |

### Access control

The blueprint creates one ElastiCache user and one user group, both on the `valkey` engine, and attaches the group to the cache:

* user `<name>-app`, user name `app`, access string `on ~* &* +@all` (every key, every pub/sub channel, every command), authenticated by password;
* user group `<name>-users`, holding that user.

Terraform manages the membership list of the group: a user added to it outside the blueprint is removed on the next deployment.

### Lifecycle ignore\_changes

* `subnet_ids` — set at creation; see [Network](#network).

### Assuming an IAM role

Optional. Set the `role_arn` variable to make the blueprint assume an IAM role instead of using the configured credentials directly; leave it unset to use them as is.

* Format: `arn:aws:iam::<account-id>:role/<name>`, with an optional path (`role/<path>/<name>`). The `aws-cn`, `aws-us-gov` and `aws-iso*` partitions are accepted too.
* The role must be in the **same AWS account** as the credentials; cross-account roles are not supported.
* The role's trust policy must allow the deploy credentials' IAM principal to assume it.
* The role itself must carry the permissions listed in [Required AWS IAM permissions](#required-aws-iam-permissions).

### Required AWS IAM permissions

> When `role_arn` is set, Terraform makes these AWS calls as the assumed role, so the permissions below belong to that role. Access to a user-provided Terraform backend, if you use one, is not covered by `role_arn`: it keeps using the deploy credentials.

Unless `role_arn` is set, the credentials used to deploy this blueprint must allow the actions below. The EC2 read actions let Terraform look up the cluster VPC and its subnets. `ec2:CreateVpcEndpoint`, the `ec2:CreateTags` that goes with it and `iam:CreateServiceLinkedRole` are the ones the AWS managed policy `AmazonElastiCacheFullAccess` grants for serverless caches: ElastiCache places a VPC endpoint in the chosen subnets.

```json theme={null}
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "elasticache:CreateServerlessCache",
        "elasticache:ModifyServerlessCache",
        "elasticache:DeleteServerlessCache",
        "elasticache:DescribeServerlessCaches",
        "elasticache:CreateUser",
        "elasticache:ModifyUser",
        "elasticache:DeleteUser",
        "elasticache:DescribeUsers",
        "elasticache:CreateUserGroup",
        "elasticache:ModifyUserGroup",
        "elasticache:DeleteUserGroup",
        "elasticache:DescribeUserGroups",
        "elasticache:DescribeCacheSubnetGroups",
        "elasticache:AddTagsToResource",
        "elasticache:RemoveTagsFromResource",
        "elasticache:ListTagsForResource"
      ],
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeVpcs",
        "ec2:DescribeSubnets",
        "ec2:DescribeSecurityGroups",
        "ec2:DescribeAvailabilityZones",
        "ec2:CreateSecurityGroup",
        "ec2:DeleteSecurityGroup",
        "ec2:AuthorizeSecurityGroupIngress",
        "ec2:RevokeSecurityGroupIngress",
        "ec2:RevokeSecurityGroupEgress",
        "ec2:CreateTags",
        "ec2:CreateVpcEndpoint"
      ],
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": "iam:CreateServiceLinkedRole",
      "Resource": "arn:aws:iam::*:role/aws-service-role/elasticache.amazonaws.com/AWSServiceRoleForElastiCache",
      "Condition": {
        "StringEquals": { "iam:AWSServiceName": "elasticache.amazonaws.com" }
      }
    }
  ]
}
```


## Related topics

- [Blueprints](https://www.qovery.com/docs/configuration/blueprints.md)
- [Amazon ElastiCache for Valkey](https://www.qovery.com/docs/configuration/blueprints/aws-elasticache-valkey.md)
- [Amazon ElastiCache for Redis](https://www.qovery.com/docs/configuration/blueprints/aws-elasticache-redis.md)
- [Amazon ElastiCache for Redis (legacy single node)](https://www.qovery.com/docs/configuration/blueprints/aws-elasticache-redis-node.md)
- [Databases](https://www.qovery.com/docs/configuration/database.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.