1

The issue targets an SQL scaling problem. For Cloud SQL Proxy there are options and one of them is one to specify instances through instance metadata with -instances_metadata option.

Despite -instances flag where we can specify a list of Cloud SQL instances connections names the -instances_metadata flag is not clear how to use.

Is that means that instance metadata works only for SQL instances that are on VMs? Because I don't understand how to add metadata to Cloud SQL Instance or fetch it by some way.

If there is no way to set or rely on Cloud SQL instance metadata that means that there is no way to scale Cloud SQL instances without proxy configuration update. Don't believe it's true. GC should support that.

Thank you for any advice.

lazycommit
  • 414
  • 5
  • 18
  • Yes, instances_metadata applies to GCE VMs. Where are you running your app? – Vadim Sep 06 '17 at 18:36
  • Yes, my client application is running on GCE VM instance. But from documentation of cloud_sql_proxy I assume that SQL Instance inteslf is a Cloud SQL one and to discover connection address for cloud_sql_proxy it can use its metadata. Now I am considering that option of instance discovery by metadata is only for SQL instances that running on VMs but not Cloud SQL instances. – lazycommit Sep 08 '17 at 13:25
  • Let me know if my answer addresses your question. – Vadim Sep 08 '17 at 17:33

1 Answers1

2

Sorry, I can see how the name of the parameter can cause confusion. "instances_metadata" refers to metadata on GCE instances (VMs) that specifies Cloud SQL instances.

GCE allows you to add arbitrary key value pairs to VM metadata that processes on the VM can query and subscribe to listen for changes.

You can create a metadata entry on your VMs like "cloud_sql_instances" then specify ‑instances_metadata=cloud_sql_instances. Now whenever that property changes, proxy will automatically pick those changes up.

Drazen Bjelovuk
  • 5,201
  • 5
  • 37
  • 64
Vadim
  • 4,996
  • 1
  • 26
  • 30
  • Further clarification for anyone still confused: `-instances_metadata=cloud_sql_instances` is a flag you pass to your cloud_sql_proxy command. Specify the actual instance string as your metadata value (under key `cloud_sql_instances` in this case). – Drazen Bjelovuk Jul 04 '18 at 16:43