ETLMCPData Conveyance Works
Log in Start free
Guides

Connect etlmcp to Amazon RDS for PostgreSQL: public access, security group and SSL

The three AWS settings an RDS for PostgreSQL instance needs before etlmcp can load it: Public access, an inbound security group rule, and SSL.

An Amazon RDS for PostgreSQL instance accepts no connections from outside AWS until you change three things: set Public access to Yes, add an inbound rule to its VPC security group for etlmcp's address, and make sure the subnets behind it can reach the internet. etlmcp connects over the public internet from its own servers, so an instance that only has a private address can never be a destination. SSL needs no work: etlmcp asks for an encrypted connection by default, which is what recent RDS versions demand.

Each failure points to a different setting. A run that ends with host not allowed means the endpoint resolved to a private address, so check Public access. A run that ends with could not connect after waiting means the address was public but nothing answered, so check the security group and the route to the internet.

Public access and "host not allowed"

Every RDS instance in a VPC gets a private IP address for traffic inside that VPC. The Public access option, under Additional connectivity configuration in the instance's Connectivity settings, decides whether it also gets a public one. You can change it on a running instance by modifying it.

When Public access is Yes, AWS answers a DNS lookup of the endpoint differently depending on who asks: from inside the VPC you get the private address, from outside you get the public one. etlmcp asks from outside, so it sees the public address.

When Public access is No, the instance has only its private address, which etlmcp cannot use. Before it opens any connection, etlmcp resolves the host you entered and checks every address it gets back. If any of them is private, loopback or otherwise not on the public internet, it stops and the destination test or run reports host not allowed. This check exists so that a destination cannot be pointed at internal networks, and it cannot be switched off for one destination. Turning on Public access is the fix; entering the private IP by hand fails the same check.

AWS lists two more conditions for a publicly accessible instance, and missing either one leaves you with an instance that has a public address but still cannot be reached:

  • The VPC must have both DNS hostnames and DNS resolution turned on. These are attributes of the VPC, set in the VPC console, not on the database.
  • Every subnet in the instance's DB subnet group must be public, which means its route table sends traffic for everything outside the VPC to an internet gateway. Do not mix public and private subnets in the subnet group of a public instance.

The security group and "could not connect"

A new DB instance allows no inbound access. Traffic gets in only through the inbound rules of the VPC security group attached to the instance.

Add an inbound rule to that security group:

Field Value
Protocol TCP
Port range the port your instance listens on
Source etlmcp's IPv4 address, as a single address

etlmcp's address is printed under the destinations list on the Destinations page, in the line that starts "Behind a firewall? Allow connections from". That line appears only when the etlmcp server you use has its outgoing address configured; if you do not see it, ask whoever runs your etlmcp account for the address rather than opening the port to the whole internet. Do not use the console's My IP shortcut: it adds the address of your own browser, not etlmcp's.

When the rule is missing, the security group does not let etlmcp's connection in. etlmcp stops waiting after a fixed connection timeout and tries each address the endpoint resolved to. If none answers, the error is reported as could not connect followed by the driver's reason, and it is treated as a temporary failure, so the run is tried again, up to 3 attempts in all. A wrong password or database name is different: those end as could not connect: authentication failed or could not connect: database does not exist and are not retried, because waiting does not fix them.

Fill in the port on the destination form only if you changed it from the PostgreSQL default when you created the instance; when the field is empty, etlmcp uses the PostgreSQL default port.

SSL and rds.force_ssl

RDS controls whether unencrypted connections are refused with the rds.force_ssl parameter. On RDS for PostgreSQL 15 and later it defaults to 1, which turns the requirement on; on 14 and older it defaults to 0. Changing it means creating a custom DB parameter group, and on a running instance a reboot so that the new group takes effect.

You do not need to change it for etlmcp. etlmcp connects with sslmode=require unless the operator of your etlmcp server has changed that setting, so it already meets the requirement on version 15 and later and encrypts the connection on older versions too. With require the connection is encrypted but the server's certificate is not checked against the RDS certificate authority, so you do not need to download any certificate bundle. If you see an SSL error, read the PostgreSQL SSL guide for what each sslmode does.

Testing before the first run

After you save the destination, use Test on the Destinations page. For a database it inserts one sample row and rolls it back, so it exercises the address check, the security group, SSL, the password and the table's permissions at once without leaving data behind. The error messages it can return are explained in PostgreSQL destination errors, and the user and grants the table needs are in PostgreSQL privileges for etlmcp.

Related

Sources

  1. Troubleshooting for Amazon RDS — docs.aws.amazon.com, checked
  2. Working with a DB instance in a VPC — docs.aws.amazon.com, checked
  3. Using SSL with a PostgreSQL DB instance — docs.aws.amazon.com, checked