Skip to content

Using automatic PSC endpoint creation with Auth Proxy, backup recovery considerations #2418

@OscarVanL

Description

@OscarVanL

Question

Hi,

I am trying to use the CloudSQL Auth Proxy to connect to an existing private database instance that is in a different project to my consumer VPC. It is not possible to use Private Service Access (PSA) in this case (for the reasons described by @jackwotherspoon here) and I must use Private Service Connect (PSC).

Background

I have successfully used Private Service Connect (PSC) in my dev environment using the new "Create the endpoint automatically" approach, however I have some concerns about the implications this has on database backup restore operations. I'd like your advice on how to architect this.

My knowledge of CloudSQL backup restores is that it is bad practice to restore to the same instance you're running in production. The console warns not to do this in production:
Image

Based on this, my database disaster recovery playbooks involve creating a new database instance. However, when using PSC to connect to the database, this introduces operational complexities which are not fully alleviated by using the new "Create the endpoint automatically" approach.

PSA-only DB restores

If I were connecting to the database only via PSA, backup restores are trivial. I simply create a new instance, restore the backup, and change my CloudSQL Auth Proxy config to point to the new instance connection name.

PSC DB restores

It is not as simple as above when using PSC. I think it's best to explain with some architecture diagrams.

To start, here's how my architecture looks when using PSC with CloudSQL Auth Proxy:

Image

Suppose I need to do a database backup restore due to some data corruption in production. The way I would do this is by creating a new database instance and restoring the backup. The PSC Endpoint will be automatically created in my consumer project, as per my service connection policy.

Image

To complete the database backup restore, I need to:

  1. Create a new DNS A record from "recommended instance PSC DNS name" to the auto-created PSC endpoint's IP Address
  2. Switch the CloudSQL Auth Proxy instance connection name to new DB and deploy

This looks like this:

Image

Problem

The main problem is that this turns a database restore into a much more operationally complex procedure. Imagine being the on-call engineer that needs to do all of this at 2am, imagine if you didn't know anything about Private Service Connect. Additionally, this makes the potential downtime in this disaster much longer than necessary, which increases the likelihood we will miss our SLAs.

Really, what we need is a way to automate this DNS record creation following the automatic PSC creation. If this were the case, switching to the new instance would be as simple as before, as it just requires changing the instance connection name on the CloudSQL Auth Proxy.

Please can you check the following:

  1. Is there an alternative architecture where I do not have these challenges?
  2. Is there a way to automatically provision the DNS records too?
  3. Are there any planned features or feature requests to allow this?

This functionality means a lot to my company, and will give us tremendous value, but I am struggling with the practicalities right now.

Thank you in advance!

Metadata

Metadata

Assignees

Labels

priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions