Jane Doe
Pro Plan
Google Cloud Memory Store is a fully managed in-memory data store service for Redis and Memcached. It provides fast, scalable caching and session management for cloud applications. In this post, we'll walk through how to set up a Redis instance in Memory Store and connect to it securely from a Cloud Run service using a VPC connector.
gcloud redis instances create my-redis \ --size=1 \ --region=[REGION] \ --tier=standard \ --project=[PROJECT-ID]After creation, note the private IP address (e.g., 10.152.209.200).
gcloud compute networks vpc-access connectors create my-connector \ --region=[REGION] \ --network=default \ --range=10.10.0.0/28 \ --project=[PROJECT-ID]gcloud run deploy my-service \ --image gcr.io/my-project/my-image \ --vpc-connector my-connector \ --region=[REGION] \ --project=[PROJECT-ID]Use the private IP and port 6379 to connect to Redis from your application code.
gcloud run services update [SERVICE] \ --vpc-connector=my-connector \Google Cloud Memory Store makes it easy to add fast, scalable caching to your cloud applications. By connecting through a VPC connector, you ensure secure, private access to your Redis instance from Cloud Run or other serverless services.
gcloud run services update [SERVICE] \ --vpc-connector=my-connector \ --region=[REGION] \ --project=[PROJECT-ID]