Google Cloud Sql usage in external application - google-cloud-sql

Is there a way to use Google Cloud Sql from external application that can't use JDBC, for example from node.js?

You can now use native MySQL connections to access Cloud SQL from just about anything, including, for example, node-db. See:
https://developers.google.com/cloud-sql/docs/access-control
http://nodejsdb.org/

Related

Google Cloud SQL Postgres Vs Self Hosted Postgres using GCP Compute instances: HIPAA Compliance

This question is about infosec, data privacy, specifically HIPAA compliance on GCP.
Is there any advantages for self managing Postgres server (built on GCP Compute instances using lets say Terraform) my own Vs using the managed offering, i,e. Cloud SQL
Thanks in advance
Google Cloud SQL Postgres is a fully managed option for deploying PostgreSQL to Google Cloud. The fully managed option is convenient, but is mainly suitable for cloud-native applications, or applications rebuilt for the cloud.
It has Built-in encryption for database tables, temporary files, backups, and any data transferred over Google’s internal networksSecure connections via SSL/TLS or the Cloud SQL Proxy.
Update1
As you are referring to HIPAA You can check this guide for HIPAA Compliance on Google Cloud Cloud sql encrypts the data at rest using the 256-bit Advanced Encryption Standard (AES-256), or better, with symmetric keys: that is, the same key is used to encrypt the data when it is stored, and to decrypt it when it is used. You can use your own encryptions as well with CMEK for cloud sql
And also you mentioned Infosec. I have not completely understood the term. I assume that you are referring to securing information from vulnerabilities. You can use Cloud Armor, which is a network security service that provides defenses against DDoS and application attacks like cross-site scripting (XSS) and SQL injection (SQLi).
Self hosted Postgres gives you full control over your PostgreSQL database on GCP, letting you to fine-tune server parameters, modify database configuration, and tune performance, just like in a local deployment.
Update2
As per this thread, it seems like postgresql is not HIPAA compliant.
For Encryption at rest on postgresql use can PostgreSQL TDE and Pgcrypto as discussed in this similar thread
For self hosted postgres You can also use shielded VM using which you can protect enterprise workloads from threats like remote attacks, privilege escalation, and malicious insiders
I am not sure on your application requirement, But based upon my
understanding about both cloud sql and self hosted postgres I
would recommend considering cloud sql as the best option as it is
fully managed by google and also complies with HIPAA and encryption.
For more information about pros and cons of Google Cloud SQL Postgres and Self hosted Postgres, Check this document

JAVA APIs to modify postgres parameters : GCP Postgres

Our organisation is planning to migrate to GCP Postgres from on-premise. Currently, we have a JAVA program that modifies the config parameters of Postgres. I understand that CloudSQL provides a CLI tool to modify or automate the modification of DB parameters. However are there any APIs which we can call from the JAVA program to modify the parameters?
Thanks in advance!
You can use the Cloud SQL Admin API to administrate with Cloud SQL instances. There are Client Libraries for many languages, including Java.

Trying to get data from Google Cloud SQL in Flutter

I'm making a Flutter app with a login page, and I've been trying to query data from a Google Cloud MySQL server and serve it to my app. I was able to replicate the result I want in python using bigquery but I need something like that but in a dart/flutter version(any other ways work too as long as the result is the same)
Any help would be really appreciated!
It is not recommended to connect to the Cloud SQL databases directly over the internet from the client application. So one should avoid connecting to the Cloud SQL database directly from the Flutter Application. In this case, it would be a good idea to create an API endpoint to do the operations in Cloud SQL and hit that endpoint from the Flutter Application.
To achieve the above, we can follow these steps:
Deploy a Http Cloud Functions which connects to the Cloud SQL
database
In this step we have to deploy a Http Cloud Functions and from the Cloud Functions we can connect to the Cloud SQL database. Inside the Cloud Functions we can do the operations on the Cloud SQL database. This document explains how to connect to Cloud SQL from Cloud Functions.
Call the Http Cloud Functions URL from the Flutter Application
After deploying the Cloud Functions, we will get a unique URL for it, which looks like this https://GCP_REGION-PROJECT_ID.cloudfunctions.net/FUNCTION_NAME. We have to call this URL from the Flutter Application. This blog explains how to call the Cloud Functions URL from the Flutter Application.

Local Postgres database to Google Cloud PostgreSQL Github

I would like to build a Google Cloud PostgreSQL database using the instructions here
I was able to successfully create the Postgres databases with appropriate tables and views locally.
What do I need to do in order to get the data on Google Cloud PostgreSQL? My goal is to have remote access to this data.
You have 2 options, The first one is use the Cloud SQL proxy as is described here. As the shared links say, the Cloud SQL Proxy provides secure access to your instances without the need for Authorized networks or for configuring SSL.
On the other hand, the second option is only to configure access to your instance under Authorized networks using or not SSL. The complete steps are listed here
You could connect to Cloud SQL from a local test environment using cloud sql proxy. See quickstart-proxy-test.
The workflow is:
Your Application(Running Locally) => cloud sql proxy (Running locally) => GCP remote Cloud SQL service

Google Data Studio JDBC connection to PostgreSQL integration with Sheets?

Google Apps Script JDBC doesn't support a connection to PostgreSQL directly but Google Data Studio supports a connection to PostgreSQL to pull data and build reports. I've also heard they support a low-key export to .csv option. Is it then possible to exploit the Data Studio Service in Google Apps Script to populate Google Sheets with that data, effectively creating a workaround?
All I need is a one-way access from PostgreSQL into Google Sheets by means of Google Apps Script, I do NOT expect to import anything back into my database.
Looking at the reference documentation, the built-in Apps Script service for DataStudio does not allow you to pull data from a connected data source. It can be used to create connectors but its does not allow direct access to connected data sources.
However, you can try creating a custom API or server-less mirco-service in a language that supports PostgreSQL, and then expose that service as HTTP endpoints that you can call via URLFetchApp. You can leverage Google Cloud Functions to do this and write the mirco-service in either back-end Javascript(Node.js), Python or Go. This approach will take you well-outside the bounds of your typical GAS script, but it is a viable option.