Create instances

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:

  1. 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
  2. Make sure that billing is enabled for your project. Learn how to check if billing is enabled on a project .
  3. 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 version 489.0.0 to access the Memorystore for Valkey gcloud CLI commands.

  4. Enable the Memorystore for Valkey API
    Memorystore for Valkey
  5. Enable the Network Connectivity API
    Network Connectivity API
  6. 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 .

Important : Before you follow the steps in this procedure, complete the steps in the Before you begin and Set up networking sections.

If you create an instance with replicas, and a single zone of the region where you want the instance to be created is unavailable, then Memorystore for Valkey creates the instance in the available zones of the region. This zonal allocation is temporary. After the unavailable zone becomes available, Memorystore for Valkey redistributes the nodes of the instance so that they're evenly distributed among the zones.

If you create an instance without replicas and a single zone is unavailable, then Memorystore for Valkey fails to create the instance.

Console

  1. In the Google Cloud console, go to the Memorystore for Valkeypage.

    Memorystore for Valkey

  2. Click Create instance.

  3. In the Name your instancesection, 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.

  4. From the Regionmenu, select a region for your instance.

  5. In the Zonal availabilitysection, select the Multi-zoneoption because you want to create a multi-zone instance.

  6. In the Node Typesection, select one of the following node types :

    • Shared-Core( shared-core-nano )
    • Small( standard-small )
    • Medium( highmem-medium )
    • X-Large( highmem-xlarge )
  7. In the Cluster Modesection, 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 .

  8. In the Instance sizesection, 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 .

  9. If you want to create an instance with replicas, then in the Replicassection, select the number of replicas (per shard). You can select 0-5 replicas. The default value is 1 replica.

  10. In the Set up connectionsection, 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 .

  11. Optional. If you want to increase the security of your instance, then in the Securitysection, enable IAM authentication by selecting the Enable IAM AUTHcheckbox.

  12. In the Data persistence strategysection, 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 Snapshotpersistence .

  13. Optional. If you want to enable automated backups for your instance, then do the following:

    1. Select the Automated daily backupscheckbox.
    2. In the Days to retain backupsfield, enter the number of days that you want Memorystore for Valkey to keep backups before they're deleted automatically. You can specify from 1 to 365 days. The default value is 35 days.
    3. From the Time windowmenu, select a time for the daily backup.
  14. In the Choose versionsection, select your Valkey version . Available versions are 7.2, 8.0, and 9.0 (Preview). The default version is version 8.0.

  15. 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-nano
    • standard-small
    • highmem-medium
    • highmem-xlarge
  • ENGINE_VERSION is the version of your Memorystore for Valkey instance. Accepted values for this parameter are VALKEY_7_2 , VALKEY_8_0 , and VALKEY_9_0 (Preview). If you don't specify a value, then VALKEY_8_0 is 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

  1. In the Google Cloud console, go to the Memorystore for Valkeypage.

    Memorystore for Valkey

  2. Click Create instance.

  3. In the Name your instancesection, 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.

  4. From the Regionmenu, select a region for your instance.

  5. In the Zonal availabilitysection, do the following:

    1. Select the Single zoneoption.

    2. From the Zonemenu, select the zone where you want Memorystore for Valkey to create the instance.

  6. In the Node Typesection, select one of the following node types :

    • Shared-Core( shared-core-nano )
    • Small( standard-small )
    • Medium( highmem-medium )
    • X-Large( highmem-xlarge )
  7. In the Cluster Modesection, 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 .

  8. In the Instance sizesection, 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 .

  9. If you want to create an instance with replicas, then in the Replicassection, select the number of replicas (per shard). You can select 0-5 replicas. The default value is 1 replica.

  10. In the Set up connectionsection, 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 .

  11. Optional. If you want to increase the security of your instance, then in the Securitysection, enable IAM authentication by selecting the Enable IAM AUTHcheckbox.

  12. In the Data persistence strategysection, 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 Snapshotpersistence .

  13. Optional. If you want to enable automated backups for your instance, then do the following:

    1. Select the Automated daily backupscheckbox.
    2. In the Days to retain backupsfield, enter the number of days that you want Memorystore for Valkey to keep backups before they're deleted automatically. You can specify from 1 to 365 days. The default value is 35 days.
    3. From the Time windowmenu, select a time for the daily backup.
  14. In the Choose versionsection, select your Valkey version . Available versions are 7.2, 8.0, and 9.0 (Preview). The default version is version 8.0.

  15. 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-nano
    • standard-small
    • highmem-medium
    • highmem-xlarge
  • ENGINE_VERSION is the version of your Memorystore for Valkey instance. Accepted values for this parameter are VALKEY_7_2 , VALKEY_8_0 , and VALKEY_9_0 (Preview). If you don't specify a value, then VALKEY_8_0 is 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 , and multi-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 to single-zone .

Design a Mobile Site
View Site in Mobile | Classic
Share by: