skip to Main Content

I am able to access GCP Memorystore Redis from gcp cloud run through vpc connector. But how can I do that from my localhost ?

2

Answers


  1. You can connect from a localhost machine with port forwarding and it can be helpful to connect to your Redis instance during development.

    Create a compute engine instance by running the following command:

             gcloud compute instances create NAME --machine-type=f1-micro --zone=ZONE
    

    Open a new terminal on your local machine.

    To create an SSH tunnel that port forwards traffic through the Compute Engine VM, run the following command:

             gcloud compute ssh COMPUTE_VM_NAME --zone=ZONE -- -N -L 6379:REDIS_INSTANCE_IP_ADDRESS:6379
    
    1. To test the connection, open a new terminal window and run the following command:

         redis-cli ping
      
    2. The SSH tunnel remains open as long as you keep the terminal window with the SSH tunnel connection up and running.

    I suggest you use the link for setting up a development environment.

    Login or Signup to reply.
  2. If you are using Redis as caching-only, or simple pub/sub, I would just spin up a local redis container for development.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search