#15 on Fast Company’s Best Workplaces for Innovators List – Learn more

Connecting Cloud Functions To Redis (Memorystore) With Serverless VPC Connector

1 v3aq4mhfafz4pzv836mcdg

In software engineering factoring, modularization, and don’t repeat yourself (DRY) are popular concepts. Documentation, however, can be a nightmare of jumping all over the place and missing steps to get something to work.

If you’re like me and you just want answers now, it can cause unnecessary toil having to bounce from article to article just to get something to work. I recently experienced this while helping a company connect their cloud functions to Redis. Google’s documentation is pretty awesome and improving all the time, but sometimes those engineering principles of factoring make them difficult to follow.

Long story short, here are the steps below that work based on the example documentation.

1 v3aq4mhfafz4pzv836mcdg

Working cloud function connecting to Redis

Of course you will want to replace the project ID and other variables at the top, but I hope this helps simplify getting your cloud functions interacting with Redis (Memorystore) using serverless VPC connector.

Cleanup

If you are just trying out Cloud Functions and Redis (Memorystore), then don’t forget to delete the resources you create to avoid unnecessary expenses. The simplest way is just to delete the project.

Below are the steps to reverse the example above just in case you need them.

Enjoy!

Subscribe to updates, news and more.