Stay organized with collections
Save and categorize content based on your preferences.
This page lists the gcloud CLI commands needed to set up
prerequisites, provision an instance in a service project, describe an instance,
and delete an instance. In order to accomplish these tasks you should follow
the instructions in each section of this page.
For more detailed guidance for these tasks, see the following pages:
Enable the following APIs needed for configuring a service connection
policy, configuring Shared VPC,
and creating a Memorystore for Redis Cluster instance.
Replace the HOST_PROJECT_ID with the ID of your host project.
Create a service connection policy
Next, create a service connection policy
for the host project of the Shared VPC network, region, and subnets
where you want to provision the Memorystore for Redis Cluster instance. Usually this is
done by your network administrator. However, you can also do this if you're
assigned to the required roles
to run the command.
This quickstart uses the default network and default subnet.
gcloud
To create the service connection policy, run the create command:
REGION is the region where you want to provision your instance.
NODE_TYPE is your chosen node type. Accepted values are:
redis-shared-core-nano
redis-standard-small
redis-highmem-medium
redis-highmem-xlarge
SHARD_COUNT determines the number of shards in your
instance. Shard count determines the total memory capacity for storing
cluster data. To see more details about cluster specification, see Cluster and node specification.
REPLICA_COUNT is your desired number of read replicas (per shard).
Accepted values are 0, 1, and 2.
HOST_PROJECT_ID is the host project ID.
Describe the instance
To view instance details, run the following command:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Instance provisioning on a Shared VPC network\n\nThis page lists the gcloud CLI commands needed to set up\nprerequisites, provision an instance in a service project, describe an instance,\nand delete an instance. In order to accomplish these tasks you should follow\nthe instructions in each section of this page.\n\nFor more detailed guidance for these tasks, see the following pages:\n\n- [Networking](/memorystore/docs/cluster/networking)\n- [Create instances](/memorystore/docs/cluster/create-instances)\n- [List instances](/memorystore/docs/cluster/list-instances)\n- [Delete clusters](/memorystore/docs/cluster/delete-instances)\n\nEnable APIs\n-----------\n\nEnable the following APIs needed for configuring a service connection\npolicy, [configuring Shared VPC](/vpc/docs/provisioning-shared-vpc),\nand creating a Memorystore for Redis Cluster instance. \n\n### gcloud\n\n1. Enable the following APIs in the service project:\n\n ```\n gcloud services enable --project=SERVICE_PROJECT_ID networkconnectivity.googleapis.com\n gcloud services enable --project=SERVICE_PROJECT_ID serviceconsumermanagement.googleapis.com\n gcloud services enable --project=SERVICE_PROJECT_ID redis.googleapis.com\n ```\n\n Replace the \u003cvar translate=\"no\"\u003eSERVICE_PROJECT_ID\u003c/var\u003e with your service project ID.\n2. Enable the following APIs in the host project:\n\n ```\n gcloud services enable --project=HOST_PROJECT_ID networkconnectivity.googleapis.com\n ```\n\n Replace the \u003cvar translate=\"no\"\u003eHOST_PROJECT_ID\u003c/var\u003e with the ID of your host project.\n\nCreate a service connection policy\n----------------------------------\n\nNext, create a [service connection policy](/vpc/docs/about-service-connection-policies)\nfor the host project of the Shared VPC network, region, and subnets\nwhere you want to provision the Memorystore for Redis Cluster instance. Usually this is\ndone by your network administrator. However, you can also do this if you're\nassigned to the [required roles](/vpc/docs/configure-service-connection-policies#roles)\nto run the command.\n\nThis quickstart uses the `default` network and `default` subnet. \n\n### gcloud\n\n1. To create the service connection policy, run the `create` command:\n\n ```\n gcloud network-connectivity service-connection-policies create POLICY_NAME \\\n --network=default \\\n --project=HOST_PROJECT_ID \\\n --region=REGION \\\n --service-class=gcp-memorystore-redis \\\n --subnets=https://www.googleapis.com/compute/v1/projects/HOST_PROJECT_ID/regions/REGION/subnetworks/default\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePOLICY_NAME\u003c/var\u003e is your desired policy name.\n - \u003cvar translate=\"no\"\u003eHOST_PROJECT_ID\u003c/var\u003e is the host project ID.\n - \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e is the same region where you want to provision your Memorystore for Redis Cluster instance.\n2. To validate if the policy was created successfully, run the `list`\n command:\n\n ```\n gcloud network-connectivity service-connection-policies list \\\n --region=REGION \\\n --project=HOST_PROJECT_ID\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eHOST_PROJECT_ID\u003c/var\u003e is the host project ID.\n - \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e is the region where the service connection policy is defined.\n\nCreate an instance\n------------------\n\nTo create an instance in the service project that's attached to the\nShared VPC network, run the following command: \n\n### gcloud\n\n```\ngcloud redis clusters create INSTANCE_ID \\\n--project=SERVICE_PROJECT_ID \\\n--region=REGION \\\n--node-type=NODE_TYPE \\\n--shard-count=SHARD_COUNT \\\n--replica-count=REPLICA_COUNT \\\n--network=projects/HOST_PROJECT_ID/global/networks/default\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e is the instance ID.\n- \u003cvar translate=\"no\"\u003eSERVICE_PROJECT_ID\u003c/var\u003e is the service project ID.\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e is the region where you want to provision your instance.\n\n- \u003cvar translate=\"no\"\u003eNODE_TYPE\u003c/var\u003e is your chosen node type. Accepted values are:\n\n - `redis-shared-core-nano`\n - `redis-standard-small`\n - `redis-highmem-medium`\n - `redis-highmem-xlarge`\n\n | **Caution** : We recommend that you use the `redis-shared-core-nano` node type for development or testing purposes only. If you run Memorystore for Redis Cluster in a production environment, then we recommend using the `redis-standard-small`, `redis-highmem-medium`, or `redis-highmem-xlarge` node types. For more information about these node types, see [Choose a node type](/memorystore/docs/cluster/cluster-node-specification#choose_a_node_type).\n- \u003cvar translate=\"no\"\u003eSHARD_COUNT\u003c/var\u003e determines the number of shards in your\n instance. Shard count determines the total memory capacity for storing\n cluster data. To see more details about cluster specification, see [Cluster and node specification](/memorystore/docs/cluster/cluster-node-specification).\n\n- \u003cvar translate=\"no\"\u003eREPLICA_COUNT\u003c/var\u003e is your desired number of read replicas (per shard).\n Accepted values are `0`, `1`, and `2`.\n\n- \u003cvar translate=\"no\"\u003eHOST_PROJECT_ID\u003c/var\u003e is the host project ID.\n\nDescribe the instance\n---------------------\n\nTo view instance details, run the following command: \n\n### gcloud\n\n```\ngcloud redis clusters describe INSTANCE_ID \\\n--project=SERVICE_PROJECT_ID \\\n--region=REGION\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e is the instance ID.\n- \u003cvar translate=\"no\"\u003eSERVICE_PROJECT_ID\u003c/var\u003e is the service project ID.\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e is the region where your instance is located.\n\nDelete the instance\n-------------------\n\nTo delete an instance, run the following command: \n\n### gcloud\n\n```\ngcloud redis clusters delete INSTANCE_ID \\\n--project=SERVICE_PROJECT_ID \\\n--region=REGION\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e is the instance ID.\n- \u003cvar translate=\"no\"\u003eSERVICE_PROJECT_ID\u003c/var\u003e is the service project ID.\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e is the region where your instance is located."]]