GAE Internal connection to Redis on GCE

632 views
Skip to first unread message

Ridha El Bekri

unread,
Aug 7, 2017, 11:12:58 AM8/7/17
to Google App Engine

Hi there,

I dont know know if I'm searching for the solution in the right place so please pardon me if I'm not.

I'm deploying Redis on with Google Compute Engine (GCE) through the Cloud Launcher of Google. I'm needing the Redis solution to do some "sensitive" work for my Google App Engine (GAE) service (a python backend service).

I need my GAE service to communicate with redis through the internal IP of the GCE instance. They are of course on the same network and sub-network and region.

I get a beautiful : " ConnectionError: Error 13 connecting someIP:6379. Permission denied. " whenever I try to run commands on redis through my service and through the internal IP. It runs fine on the external IP of the GCE instance.
Redis is running with a default config file

If you have any ideas I would be glad to try.
Thanks in advance

Yannick (Cloud Platform Support)

unread,
Aug 7, 2017, 12:33:19 PM8/7/17
to Google App Engine
Hello Ridha, have you tried configuring your App Engine application according to our guide on using Redis with App Engine Flexible?

Ridha El Bekri

unread,
Aug 8, 2017, 4:53:50 AM8/8/17
to Google App Engine
Hi Yannick, thank you for your answer. We didn't go with the Redis Lab Cloud because we dont want to have our Redis exposed to the internet but profit from the "internal network" of the google cloud solutions. We could just go with the external IP of the GCE instance of redis we have, it would be almost the same thing than the Redis Lab Cloud solution and we got that working already with the external IP but its not what we want :/

Faizan (Cloud Platform Support)

unread,
Aug 8, 2017, 7:32:46 PM8/8/17
to Google App Engine
Hello Ridha,

Make sure you have GCE firewall rules configured to allow traffic on port 6379 for internal IP. As a test can you try to connect to the Redis server from another GCE VM using internal IP? Can you provide me with the steps you use to connect to Redis VM from GAE flex app?

Faizan

Ridha El Bekri

unread,
Aug 9, 2017, 5:52:21 AM8/9/17
to Google App Engine
Hello Faizen,

Thank you for your answer. I did already did put in place a firewall rule but I didn't think about going with a test from another GCE instance. But talking about the connexion to Redis, I 'm not using a GAE flex app but a GAE standard python app ! Does that change anything ?

Faizan (Cloud Platform Support)

unread,
Aug 9, 2017, 9:51:05 AM8/9/17
to Google App Engine
Hello Ridha,

If you are using GAE standard environment the behavior you have observed is expected because the app is deployed in a sandbox and doesn't use GCE network. Moreover, you can cannot choose the network when deploying the standard app. The only option to connect your GAE standard app to GCE is using external IP.

With that said, you can deploy your app using GAE flexible environment which give you an option to choose the network for your app. You need to make sure your GCE Redis VM and flex app are in the same network in order to use the internal IP to connect. For more information you can refer to network setting in app.yaml for GAE python flexible environment.

I hope that helps.

Faizan

Ridha El Bekri

unread,
Aug 9, 2017, 10:39:45 AM8/9/17
to Google App Engine
Hello again Faizen,

Since you first answered me you made me discover the GAE flex environment, I didn't know it existed ^^ but I went through it a little around and started guessing that my actual setup with the standard GAE was the cause of the problem.

So I was wondering something (since I didn't really find an explicit list), what are the drawbacks and benefits from choosing flex or standard in terms of, scaling, managing and cost ? I might be asking too much here so I apologize in advance :)

Ridha El Bekri

unread,
Aug 9, 2017, 12:04:51 PM8/9/17
to Google App Engine
Okey never minde I somehow missed this link : https://cloud.google.com/appengine/docs/the-appengine-environments#choosing_your_app_engine_environment

Thank you for your help ! 
Reply all
Reply to author
Forward
0 new messages