Create instances

This page provides instructions for creating Memorystore for Valkey instances.

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 an instance

Console

  1. Go to the Memorystore for Valkey page in the Google Cloud console.

    Memorystore for Valkey

  2. Click Create Instance.

  3. On the Create a Valkey instance page, select your desired configurations for your new instance.

    • Under Name your instance enter an instance ID. The instance ID must use only lowercase letters, numbers and hyphens. It must also start with a letter and be unique in its region.
      • For example: my-instance-1.
    • Under Choose region select a region for your instance.
    • Under Node Type select your chosen node type.
    • Under Instance size, define the number of shards for your instance. The shard count determines the total memory capacity for storing instance data. To see more details about instance specification, see Instance and shard specification.
    • If you want to create an instance with replicas, enter your desired number of replicas (per shard) under Replicas. Acceptable values are No Replica, 1 Replica, and 2 Replicas. The default value is 1 Replica when using the Google Cloud console.
    • Under Set up connection select your desired network. For more details on private networking for Memorystore for Valkey, see Networking.
    • If you want to enable IAM authentication select Enable IAM AUTH.
    • If you want to enable in-transit encryption select Enable Transport Layer Security (TLS).
  4. Click the Create Instance button.

gcloud

To create a Memorystore for Valkey instance, run the create command:

gcloud beta memorystore instances create INSTANCE \
--location=REGION_ID \
--psc-auto-connections=network=projects/PROJECT_ID/global/networks/NETWORK_ID,projectId=PROJECT_ID \
--replica-count=REPLICA_COUNT \
--node-type=NODE_TYPE \
--shard-count=SHARD_COUNT

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 your desired number of replicas (per shard). Accepted values are 0, 1, and 2.

  • NODE_TYPE is your chosen node type. Accepted values are:

    • shared-core-nano
    • standard-small
    • highmem-medium
    • highmem-xlarge

    For more details on node types and instance configurations, see Instance and node specification.

  • SHARD_COUNT determines the number of shards in your instance. Shard count determines the total memory capacity for storing instance data. To see more details about instance specification, see Instance and node specification.

For example:

gcloud beta memorystore instances create my-instance \
--location=us-central1 \
--psc-auto-connections=network=projects/my-project/global/networks/default,projectId=my-project \
--replica-count=2 \
--node-type=highmem-medium \
--shard-count=8

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.

gcloud

To create a single-zone instance, run the create command:

gcloud beta memorystore instances create INSTANCE \
--location=REGION_ID \
--psc-auto-connections=network=projects/PROJECT_ID/global/networks/NETWORK_ID,projectId=PROJECT_ID \
--replica-count=REPLICA_COUNT \
--node-type=NODE_TYPE \
--shard-count=SHARD_COUNT \
--zone-distribution-config-mode=ZONE_DISTRIBUTION_CONFIG_MODE \
--zone-distribution-config=ZONE

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 your chosen number of replicas (per shard). Accepted values are 0, 1, and 2.

  • NODE_TYPE is your chosen node type. Accepted values are:

    • shared-core-nano
    • standard-small
    • highmem-medium
    • highmem-xlarge

    For more details on node types and instance configurations, see Instance and node specification.

  • SHARD_COUNT determines the number of shards in your instance. Shard count determines the total memory capacity for storing instance data. For more information about instance specification, see Instance and node specification.

  • 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.