How to manually manage keys in Memorystore Redis in GAE? - google-app-engine

I have setup a Memorystore Redis with my Nodejs in Google App Engine. I wonder though how would I access my redis instance so I can manually manage(like del) keys?
There is this doc accessing from Compute Engine but what about from GAE?

There is a similar tutorial on how to connect your App Engine to Cloud Memorystore that you could find here.
Basically the steps consist in setting up Serverless VPC Access and afterwards using the standard nodejs Redis library to interact with your Memorystore instance. Apart from this there are no more Cloud specific steps to follow, just write your code and have fun.
Separately, as filip26 pointed out you also have the Google Cloud Memorystore library, this is meant to manage Memorystore instances and configurations as you would do through the Cloud SDK or the Console. However they don'tserve to interact with the database in the sense of adding or deleting entries.
As a side note be aware that some Redis commands available in on-premises Redis servers are not allowed in Memorystore, you could find more about these limitations here.

Related

Can I use Google App Engine's memcache service alongside the newly released memorystore with Redis?

I am interested in using Google's newly released memorystore with Redis for the new features on my app. However, I would still want my old code that use memcache to run without any changes. Is it possible to run memcache alongside memorystore? Or, would I have to completely migrate to memorystore to use it?
Although it is recommended to migrate from Python2 to Python3 and switch from Memcache to Memorystore solution you can still use both I believe.
You will need to setup VPC connector in order to be able to connect to Memorystore from App Engine and install required dependancies. The step-by-step process is described here

Is it possible to connect to Google Cloud Memorystore from another project?

I have 2 different projects (Project A and Project B) in the same region (Europe west 2).
I've created one instance of Memorystore in project A.
So, I'm able to connect to the Memorystore from project A, but I'm also trying to connect to the same Memorystore from project B with no success.
What I'm doing wrong? Is it even possible to connect multiple projects to the same basic Memorystore?
No it's not possible. In the official documentation for Connecting to a Redis instance it states:
You can access Redis instances from Compute Engine VM instances,
Google Kubernetes Engine clusters, and App Engine flexible environment
applications within the same Google Cloud Platform project.
We are working on enabling this use case using Shared VPC. We expect to have this available soon.
In your case I'm assuming these are two regular projects with regular VPC networks and not service projects using Shared VPC. Currently there isn't a way to do this with regular VPC.

Connect to kubernetes engine from app engine

We want to use an app engine flexible process to update our ElasticSearch index, which is on Google Kubernetes Engine. We need to connect to ElasticSearch via a http(s) address. What's the recommended way to do this? We don't want to expose the cluster to the external networks since we don't have authentication in front of it.
I've seen this SO post but both k8s and AE have changed a lot in the 2 years since the question/answer.
Thanks for your help!
The post you linked to was about App Engine Standard. App Engine Flex is built on top of the same Google Cloud networking that is used by Google Compute Engine virtual machines and Google Kubernetes Engine clusters. As long as you put the App Engine flex application into the same VPC as the Google Kubernetes Engine cluster you should be able to communicate between them using internal networking.
On the other hand, to expose a Kubernetes service to anything running outside of the cluster will require you to modify the service for Elastic search because by default Kubernetes services are only reachable from inside of the cluster (due to the way that the service IPs are allocated and reached via IPTables magic). You need to "expose" the service, but rather than exposing it to the internet via an external load balancer, you expose it to the VPC using an internal load balancer. See https://cloud.google.com/kubernetes-engine/docs/how-to/internal-load-balancing.
in addition to Robert's answer, make sure that app engine and GKE are in the same region,
because Internal load balancers are not usable from other region.
check this https://issuetracker.google.com/issues/111021512

What is the recommended way to connect to CloudSQL (or PubSub etc) in a GAE custom runtime

I want to deploy a multi-service application on GAE using custom runtimes.
I've everything set, my service expects some environment variable to know when to connect to the database and other services.
But I can't see anywhere in the doc where it explains how to connect to other Google Cloud service from a custom runtime.
If it is explained, thanks for pointing me there. if not, can someone who has been successful on doing that explain to me how he/she achieved it.
The documentation for connecting from Flexible Environment apps is found in Cloud SQL > Documentation > MySQL > Connecting from App Engine. Some of the languages (for example, for python) make use of the Cloud SQL Proxy, while others (such as java) don't.
As for Pub/Sub, you can read about client libraries in the documentation.

Is it possible to use Google App Engine with Google Cloud VPN?

The documentation from Google is not really clear about it.
Here ( https://cloud.google.com/compute/docs/vpn/overview ) it says
Google Cloud VPN securely connects your existing network to your Google Cloud Platform (GCP) network through an IPsec VPN connection
Considering that Both Google App Engine (GAE) and Google Compute Engine (GCE) are part of Google Cloud Platform (GCP), it would mean that Google Cloud VPN works for both GAE and GCE.
Also, the section for Cloud VNP is at the same level than GAE and GCE in the project console :
But the documentation is located in /compute/docs which should not obviously be compatible with /appengine/docs
And here is a graph describing the tunnel, which talks only about GCE, which could exclude GAE :
So, is GAE compatible with Cloud VPN or is it restricted to GCE only ?
Google Cloud VPN securely connects your existing network to your Google Cloud Platform (GCP) network through an IPsec VPN connection. Therefore, only resources that are connected to GCP networks can communicate through Cloud VPN tunnels.
App Engine Flexible Environment is based on Google Compute Engine and consequently can connect to your remote network via Cloud VPNs. As described in this article, you can specify network settings in your app.yaml configuration file of your GAE Flexible application.
EDIT Rodrigo Torres has pointed out that this is NOW possible.
(Leaving up the old post below. It is now WRONG!!!)
OLD POST:
Google App Engine standard CAN'T use VPN directly, however the new Flexible Google App Engine (now officially released, no longer in beta) CAN use it directly. Just set up google cloud VPN and your network from the console and make sure to include the network in your app.yaml file.
Flexible App Engine is be the easiest way for new applications to utilize VPN connections since there won't be any migration headaches.
For a standard app engine application that can't be ported over to flexible for whatever reason, you CAN still use a VPN connection - however, it requires a service to be running on flexible app engine (or compute engine), and your app will need to interface with it somehow. This may be the simplest method, as migrating from standard to flexible is not the simplest of tasks. I know - I've done it.

Resources