etlmcp loads a Cloud SQL for PostgreSQL instance by connecting straight to the instance's public IP address with a database user and password. For that to work you need three things on the Google Cloud side: Public IP turned on, etlmcp's IPv4 address added to the instance's authorized networks, and an SSL mode other than the one that requires trusted client certificates. Leave any of them out and the connection test on the destination page fails.
Why the instance turns etlmcp away by default
A Cloud SQL instance's public IP accepts only clients listed in its authorized networks. Google's authorized-networks page explains that a client reaching the public IP must have its IPv4 address, or a range that contains it, on the instance's list of authorized networks. An address not on the list never gets as far as a password check.
etlmcp does not use the Cloud SQL Auth Proxy or the Cloud SQL language connectors. Both run on the client side and open an authenticated tunnel; etlmcp has no such component. Its PostgreSQL destination opens an ordinary PostgreSQL connection to the host you type, so the authorized-networks rule applies to it in full.
Find the address to authorize
The address etlmcp connects from is a server setting, and the destinations page shows it in the note under your destinations: when the server has a published address, the note reads "Behind a firewall? Allow connections from" followed by that address. The server's example configuration describes this setting as the server's public IPv4 address.
Google states that Cloud SQL does not support IPv6 authorized networks. An IPv4 address is what the list accepts.
Add the authorized network
In the Google Cloud console:
- Open the instance and go to Connections, then the Networking tab.
- Make sure Public IP is selected.
- Under Authorized networks, expand New IP range. Give it a name such as
etlmcpand enter the address as a single address, or as a CIDR range such as203.0.113.10/32. - Click Done, then Save.
If you manage the instance with gcloud, the gcloud sql instances patch command takes an --authorized-networks flag. Be careful with it: Google notes that the flag replaces the whole list, not just the entries you add, so pass every network you want to keep.
Do not click Use my IP for this entry. That button fills in the address of the computer you are browsing from, which is not etlmcp's address.
Use the public IP as the host
On the PostgreSQL destination form, enter the instance's public IP address in Host. etlmcp accepts an IPv4 address written as the usual four numbers separated by dots, such as 203.0.113.10; it refuses shortened or other numeric forms. Put the port in Port, not after a colon in the host.
Do not use the instance's private IP. Before connecting, etlmcp resolves the host and refuses any host whose address is private or local, so a private address such as one in 10.0.0.0/8 is turned away whatever your VPC allows. Google also notes that some ranges cannot be added as authorized networks, among them the private RFC 1918 ranges, which Cloud SQL already includes implicitly.
The rest of the form asks for the database, user, schema, table and password. Use a built-in PostgreSQL user with a password. Google's SSL page says that, under the client-certificate mode, users who sign in with IAM database authentication must connect through the Auth Proxy or a connector, which etlmcp does not use. For the grants that user needs, see PostgreSQL privileges.
Pick an SSL mode that etlmcp can meet
By default etlmcp connects with SSL required (the require mode): the connection is encrypted or it is not made. Cloud SQL's SSL setting is under Connections, then Security, and has three values:
| Cloud SQL mode | What it accepts | With etlmcp |
|---|---|---|
ALLOW_UNENCRYPTED_AND_ENCRYPTED (the default) |
Plain and encrypted connections; no client certificate check | Connects, encrypted |
ENCRYPTED_ONLY ("Allow only SSL connections") |
Encrypted connections only; no client certificate check | Connects, encrypted |
TRUSTED_CLIENT_CERTIFICATE_REQUIRED |
Encrypted connections from clients with a valid client certificate (mutual TLS) | Refused |
ENCRYPTED_ONLY is the strictest mode that works. TRUSTED_CLIENT_CERTIFICATE_REQUIRED makes a client certificate mandatory, and etlmcp's PostgreSQL destination has no field for one: it holds only host, port, database, user, schema, table and the password. Under that mode the server refuses etlmcp's connection.
Google notes that changing the mode does not need a restart but applies only to new connections; existing unencrypted connections stay that way until a restart. etlmcp opens a new connection on every run, so the next run uses the new setting.
For what require protects against, and what it does not, see PostgreSQL SSL modes and etlmcp.
Test before you schedule
Save the destination and run its test. Testing a database inserts one sample row and rolls it back, so it checks the network rule, the SSL mode, the password and the user's rights in one step. If it fails, check in this order: Public IP on, the authorized network holds etlmcp's exact address, the SSL mode is not the client-certificate one, and the user is a password user. The messages etlmcp shows are listed under PostgreSQL destination errors, and the fields are described on the PostgreSQL destination page.