# Tutorial: Connecting Cloudrun and Cloudfunctions to Redis and other Private Services using Goblet

DevFeed: [Tutorial: Connecting Cloudrun and Cloudfunctions to Redis and other Private Services using Goblet](<https://devfeed.tech/articles/tutorial-connecting-cloudrun-and-cloudfunctions-to-redis-and-other-private-services-using-goblet-23881.md>)

Original publisher: [Read original article](<https://engineering.premise.com/tutorial-connecting-cloudrun-and-cloudfunctions-to-redis-and-other-private-services-using-goblet-5782f80da6a0?source=rss----c5fada0a103d---4>)

Author: Qua Jones

Published: 2023-02-13T16:38:05Z

Content type: tutorial

Language: en

Sources: [Engineering at Premise - Medium](<https://devfeed.tech/sources/engineering-at-premise-medium.md>)

Topics: [Tutorial](<https://devfeed.tech/topics/tutorial.md>), [Cloud Run](<https://devfeed.tech/topics/cloud-run.md>), [Redis](<https://devfeed.tech/topics/redis.md>), [VPC](<https://devfeed.tech/topics/vpc.md>), [Google Cloud Platform (GCP)](<https://devfeed.tech/topics/google-cloud.md>), [Serverless](<https://devfeed.tech/topics/serverless.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>), [Deployment](<https://devfeed.tech/topics/deployment.md>), [Python](<https://devfeed.tech/topics/python.md>), [Caching](<https://devfeed.tech/topics/caching.md>)

Tags: [caching](<https://devfeed.tech/tags/caching.md>), [cli](<https://devfeed.tech/tags/cli.md>), [cloud-computing](<https://devfeed.tech/tags/cloud-computing.md>), [cloud-run](<https://devfeed.tech/tags/cloud-run.md>), [deployment](<https://devfeed.tech/tags/deployment.md>), [gcp](<https://devfeed.tech/tags/gcp.md>), [google-cloud-run](<https://devfeed.tech/tags/google-cloud-run.md>), [python](<https://devfeed.tech/tags/python.md>), [redis](<https://devfeed.tech/tags/redis.md>), [serverless](<https://devfeed.tech/tags/serverless.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>), [vpc](<https://devfeed.tech/tags/vpc.md>)

## AI overview

A tutorial showing how to deploy a Cloud Run service that privately connects to a Redis instance through a VPC Connector. It explains how Goblet can provision the connector and inject the required configuration during deployment, using Google Cloud services and Python prerequisites.

## Source excerpt

By Qua Jones, Senior Software Engineer Photo by israel palacio on Unsplash Google Cloud Platform's (GCP) Private Services Access allows you to connect to GCP services without an external IP being assigned. Redis is an in-memory DB that is used for caching and is a service that supports private access. In order to take advantage of this feature, a private connection is necessary. For serverless environments, this can be done using a VPC Connector. VPC Connectors allow serverless environments to connect to VPC Networks by handling traffic between the network and environment, restricting requests to use only internal IP addresses. This can be beneficial for applications that do not require exposure to the public internet or if latency for requests across services needs to be improved. Currently you can provision a connector using the console, cli, or terraform but you will still need to configure your serverless environment to utilize this connector. Instead of manually going through the segmented process of creating a connector and updating your environment, you can leverage Goblet to provision your connector and inject needed configuration values into your deployment. This tutorial will walk you through the steps of deploying a Cloud Run service that privately connects to a Redis Instance using a VPC Connector. Prerequisites: GCP Account Python Environment (>= 3.7) Gcloud CLI You will also need to have goblet and redis installed which can be done by running pip install goblet-gcp && pip install redis Getting Started: Ensure you have credentials configured by running gcloud auth login and sign in to the desired project. Make sure to have the correct services enabled in your GCP project which include: Cloud Run Cloud Build Artifact Registry Serverless VPC Access Memorystore for Redis To get started, clone the code from the gcp-tutorials repository and navigate to the directory. This can be done with the Github CLI by running: gh repo clone premisedata/gcp-tutorials/014-