This page provides instructions for creating single-zone and multi-zone instances in Memorystore for Valkey.
Before you begin
Complete the before you begin instructions:
- In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.
Go to project selector - Make sure that billing is enabled for your project. Learn how to check if billing is enabled on a project.
Install and initialize the Google Cloud CLI.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by running
gcloud components update. You need at least gcloud CLI version489.0.0to access the Memorystore for Valkey gcloud CLI commands.-
Enable the Memorystore for Valkey API
Memorystore for Valkey -
Enable the Network Connectivity API
Network Connectivity API -
Enable the Service Consumer Management API
Service Consumer Management API
Other prerequisites
- You must have one of these IAM roles in the Google Cloud project you're using:
roles/memorystore.admin(the Memorystore Admin predefined IAM role)roles/owner(the Owner basic IAM role)roles/editor(the Editor basic IAM role)
Set up networking
Read the Networking page to determine if you need to set up a service connection policy.
If a service connection policy hasn't been created for the network with which you will create the Valkey instance, follow the Networking guidance to create it.
Create a multi-zone instance
This section provides instructions on creating a multi-zone instance.
Console
In the Google Cloud console, go to the Memorystore for Valkey page.
Click Create instance.
In the Name your instance section, enter an ID for the instance. The instance ID must use only lowercase letters, numbers, and hyphens. It must also start with a letter and be unique in its region.
From the Region menu, select a region for your instance.
In the Zonal availability section, select the Multi-zone option because you want to create a multi-zone instance.
In the Node Type section, select one of the following node types:
- Shared-Core (
shared-core-nano) - Small (
standard-small) - Medium (
highmem-medium) - X-Large (
highmem-xlarge)
- Shared-Core (
In the Cluster Mode section, specify whether you want a Cluster Mode Enabled or Cluster Mode Disabled instance. For more information about these types of instances, see Enable and disable cluster mode.
In the Instance size section, enter the number of shards for your instance. The shard count determines the total memory capacity for storing instance data. For more information about instance specifications, see Instance and node specification.
If you want to create an instance with replicas, then in the Replicas section, select the number of replicas (per shard). You can select 0-5 replicas. The default value is 1 replica.
In the Set up connection section, select the network that your applications can use to connect to this instance. For more information about private networking for Memorystore for Valkey, see Networking.
Optional. If you want to increase the security of your instance, then in the Security section, enable IAM authentication by selecting the Enable IAM AUTH checkbox.
In the Data persistence strategy section, specify how you want Memorystore for Valkey to persist the data in your instance. Acceptable values are No persistence, Append Only File (AOF) persistence, and Memory Snapshot persistence.
Optional. If you want to enable automated backups for your instance, then do the following:
- Select the Automated daily backups checkbox.
- In the Days to retain backups field, enter the number of days
that you want Memorystore for Valkey to keep backups before they're
deleted automatically. You can specify from
1to365days. The default value is35days. - From the Time window menu, select a time for the daily backup.
In the Choose version section, select your Valkey version. Available versions are 7.2, 8.0, and 9.0 (Preview). The default version is version 8.0.
Click Create instance.
gcloud
To create a Memorystore for Valkey instance, run the create command:
gcloud memorystore instances create INSTANCE \
--location=REGION_ID \
--endpoints='[{"connections": [{"pscAutoConnection": {"network": "projects/PROJECT_ID/global/networks/NETWORK_ID", "projectId": "PROJECT_ID"}}]}]' \
--replica-count=REPLICA_COUNT \
--node-type=NODE_TYPE \
--engine-version=ENGINE_VERSION \
--shard-count=SHARD_COUNT \
--mode=MODE
Replace the following:
INSTANCE is the ID of the Memorystore for Valkey instance you're creating. Your instance ID must be 1 to 63 characters and use only lowercase letters, numbers, or hyphens. It must start with a lowercase letter and end with a lowercase letter or number.
REGION_ID is the region where you want the instance placed.
PROJECT_ID is the ID of the project where you want to create your instance.
NETWORK_ID is the ID of the network you want to use to create your instance.
REPLICA_COUNT is the number of replicas (per shard). Accepted values are
0-5.NODE_TYPE is your chosen node type. Accepted values are:
shared-core-nanostandard-smallhighmem-mediumhighmem-xlarge
ENGINE_VERSION is the version of your Memorystore for Valkey instance. Accepted values for this parameter are
VALKEY_7_2,VALKEY_8_0, andVALKEY_9_0(Preview). If you don't specify a value, thenVALKEY_8_0is the default value.SHARD_COUNT determines the number of shards in your instance. Shard count determines the total memory capacity for storing instance data. Cluster Mode Disabled instances only support one shard. For more information, see Instance and node specification.
MODE determines if the instance is Cluster Mode Enabled or Cluster Mode Disabled. If this field is omitted, then the instance defaults to Cluster Mode Enabled. For more information, see Enable and disable Cluster Mode.
For example:
Cluster Mode Enabled example
gcloud memorystore instances create my-instance \
--location=us-central1 \
--endpoints='[{"connections": [{"pscAutoConnection": {"network": "projects/my-project/global/networks/default", "projectId": "my-project"}}]}]' \
--replica-count=2 \
--node-type=highmem-medium \
--shard-count=8 \
--mode=cluster
Cluster Mode Disabled example
gcloud memorystore instances create my-instance \
--location=us-central1 \
--endpoints='[{"connections": [{"pscAutoConnection": {"network": "projects/my-project/global/networks/default", "projectId": "my-project"}}]}]' \
--shard-count=1 \
--replica-count=2 \
--node-type=highmem-medium \
--mode=cluster-disabled
By default, in-transit encryption
is disabled and the authorized network is default.
Create a single-zone instance
This section provides instructions on creating a single-zone instance.
Console
In the Google Cloud console, go to the Memorystore for Valkey page.
Click Create instance.
In the Name your instance section, enter an ID for the instance. The instance ID must use only lowercase letters, numbers, and hyphens. It must also start with a letter and be unique in its region.
From the Region menu, select a region for your instance.
In the Zonal availability section, do the following:
Select the Single zone option.
From the Zone menu, select the zone where you want Memorystore for Valkey to create the instance.
In the Node Type section, select one of the following node types:
- Shared-Core (
shared-core-nano) - Small (
standard-small) - Medium (
highmem-medium) - X-Large (
highmem-xlarge)
- Shared-Core (
In the Cluster Mode section, specify whether you want a Cluster Mode Enabled or Cluster Mode Disabled instance. For more information about these types of instances, see Enable and disable cluster mode.
In the Instance size section, enter the number of shards for your instance. The shard count determines the total memory capacity for storing instance data. For more information about instance specifications, see Instance and node specification.
If you want to create an instance with replicas, then in the Replicas section, select the number of replicas (per shard). You can select 0-5 replicas. The default value is 1 replica.
In the Set up connection section, select the network that your applications can use to connect to this instance. For more information about private networking for Memorystore for Valkey, see Networking.
Optional. If you want to increase the security of your instance, then in the Security section, enable IAM authentication by selecting the Enable IAM AUTH checkbox.
In the Data persistence strategy section, specify how you want Memorystore for Valkey to persist the data in your instance. Acceptable values are No persistence, Append Only File (AOF) persistence, and Memory Snapshot persistence.
Optional. If you want to enable automated backups for your instance, then do the following:
- Select the Automated daily backups checkbox.
- In the Days to retain backups field, enter the number of days
that you want Memorystore for Valkey to keep backups before they're
deleted automatically. You can specify from
1to365days. The default value is35days. - From the Time window menu, select a time for the daily backup.
In the Choose version section, select your Valkey version. Available versions are 7.2, 8.0, and 9.0 (Preview). The default version is version 8.0.
Click Create instance.
gcloud
To create a single-zone instance, run the create command:
gcloud memorystore instances create INSTANCE \
--location=REGION_ID \
--endpoints='[{"connections": [{"pscAutoConnection": {"network": "projects/PROJECT_ID/global/networks/NETWORK_ID", "projectId": "PROJECT_ID"}}]}]' \
--replica-count=REPLICA_COUNT \
--node-type=NODE_TYPE \
--engine-version=ENGINE_VERSION \
--shard-count=SHARD_COUNT \
--zone-distribution-config-mode=ZONE_DISTRIBUTION_CONFIG_MODE \
--zone-distribution-config=ZONE \
--mode=MODE
Replace the following:
INSTANCE is the ID of the Memorystore for Valkey instance you're creating. Your instance ID must be 1 to 63 characters and use only lowercase letters, numbers, or hyphens. It must start with a lowercase letter and end with a lowercase letter or number.
REGION_ID is the region where you want the instance placed.
PROJECT_ID is the ID of the project where you want to create your instance.
NETWORK_ID is the ID of the network you want to use to create your instance.
REPLICA_COUNT is the number of replicas (per shard). Accepted values are
0-5.NODE_TYPE is your chosen node type. Accepted values are:
shared-core-nanostandard-smallhighmem-mediumhighmem-xlarge
ENGINE_VERSION is the version of your Memorystore for Valkey instance. Accepted values for this parameter are
VALKEY_7_2,VALKEY_8_0, andVALKEY_9_0(Preview). If you don't specify a value, thenVALKEY_8_0is the default value.SHARD_COUNT determines the number of shards in your instance. The Shard count determines the total memory capacity for storing instance data. If the mode that you select is Cluster Mode Disabled, then you can specify only one shard for your instance. For more information, see Instance and node specification.
MODE determines if the instance should be Cluster Mode Enabled or Cluster Mode Disabled. If you omit this field, then the mode defaults to Cluster Mode Enabled. For more information, see Enable and disable Cluster Mode.
ZONE_DISTRIBUTION_CONFIG_MODE is the mode that lets you choose between provisioning a single-zone instance or a multi-zone instance. The default is multi-zone. Accepted values are
single-zone, andmulti-zone.ZONE is the zone where you want to provision your nodes. This flag is applicable only if the
--zone-distribution-config-mode=is set tosingle-zone.