[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[],[],null,["# Instance provisioning on a VPC network\n\nThis page lists the gcloud CLI commands needed to set up\nprerequisites, provision an instance, describe an instance, and delete an\ninstance on a standard VPC network. For instructions on performing these tasks\non a Shared VPC network, see [Instance provisioning on a Shared VPC network](/memorystore/docs/cluster/instance-provisioning-shared-vpc). In order to accomplish these\ntasks you should follow the 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\nBegin by enabling the APIs in this section. These APIs are needed because\nMemorystore for Redis Cluster uses Private Service Connect service\nconnectivity automation to automate connectivity for instances. For more\ninformation, see [Networking](/memorystore/docs/cluster/networking).\n\nTo enable the APIs, run the following commands: \n\n### gcloud\n\n```\ngcloud services enable --project=PROJECT_ID networkconnectivity.googleapis.com\ngcloud services enable --project=PROJECT_ID compute.googleapis.com\ngcloud services enable --project=PROJECT_ID serviceconsumermanagement.googleapis.com\ngcloud services enable --project=PROJECT_ID redis.googleapis.com\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e is your project ID.\n\nCreate a service connection policy\n----------------------------------\n\nYou must create a [service connection policy](/vpc/docs/about-service-connection-policies)\nfor the project, network, and region where you want to provision the\nMemorystore for Redis Cluster instance. A service connection policy lets you authorize\nthe `gcp-memorystore-redis` service class to create a Private Service Connect\nconnection between producer and consumer VPC networks in the region where the\npolicy is defined, and in the subnets that the policy specifies.\n\nTo see the permission needed to create a service connection policy, see [required roles](/vpc/docs/configure-service-connection-policies#roles).\n\nThis walkthrough uses the `default` network and `default` subnet.\n\nTo create the service connection policy, run the following command: \n\n### gcloud\n\n```\ngcloud network-connectivity service-connection-policies create POLICY_NAME \\\n --network=default \\\n --project=PROJECT_ID \\\n --region=REGION \\\n --service-class=gcp-memorystore-redis \\\n --subnets=https://www.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/subnetworks/default\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePOLICY_NAME\u003c/var\u003e is your desired policy name.\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e is the 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.\n\nValidate service connection policy creation\n-------------------------------------------\n\nValidate if the policy was created successfully by running the `list` command: \n\n### gcloud\n\n```\ngcloud network-connectivity service-connection-policies list --region=REGION --project=PROJECT_ID\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e is the 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, run the `create` command: \n\n### gcloud\n\n```\ngcloud redis clusters create INSTANCE_ID \\\n--project=PROJECT_ID \\\n--region=REGION \\\n--node-type=NODE_TYPE \\\n--shard-count=SHARD_COUNT \\\n--replica-count=REPLICA_COUNT \\\n--network=projects/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\"\u003ePROJECT_ID\u003c/var\u003e is the 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| **Note:** When running the `create` command you must use the same network and same region where the service connection policy is defined.\n\nDescribe the instance\n---------------------\n\nTo view instance details, run the `describe` command: \n\n### gcloud\n\n```\ngcloud redis clusters describe INSTANCE_ID \\\n--project=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\"\u003ePROJECT_ID\u003c/var\u003e is the 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 `delete` command: \n\n### gcloud\n\n```\ngcloud redis clusters delete INSTANCE_ID \\\n--project=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\"\u003ePROJECT_ID\u003c/var\u003e is the project ID.\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e is the region where your instance is located."]]