ETLMCPData Conveyance Works
Log in Start free
Guides

Aurora Serverless v2 auto-pause and etlmcp: first connection timeouts

Why the first etlmcp Test or run against a paused Aurora Serverless v2 cluster fails with 'could not connect', and how retries or capacity settings fix it.

If your Aurora PostgreSQL cluster has a minimum capacity of 0 ACUs, its instances pause when nobody is connected, and the first connection after that has to wait for the instance to wake up. AWS puts the typical wait at about 15 seconds. etlmcp gives up on a Postgres connection sooner than that, so the attempt that wakes the cluster can fail with could not connect. Nothing is wrong with your credentials or security group: press Test again after about 15 seconds, and let scheduled runs retry on their own.

How auto-pause works

Auto-pause is not a separate switch. Setting the cluster's minimum capacity to 0 ACUs turns it on, and you then choose how long an instance must sit with no user connections before it pauses. The interval runs from 300 seconds (five minutes, also the default) up to 86,400 seconds (one day). While an instance is paused you are not charged for its compute, and its status still reads Available in the console.

Auto-pause needs Aurora PostgreSQL 16.3, 15.7, 14.12 or 13.15 or later. Only db.serverless instances pause; a cluster with any provisioned instance keeps its serverless writer awake.

What wakes a paused instance

Any connection attempt resumes the instance, including one with a wrong password. AWS's guide says resuming typically takes about 15 seconds, and recommends client connect timeouts longer than that. An instance that stays paused for more than 24 hours can drop into a deeper sleep, and then resuming can take 30 seconds or more, close to a reboot. The connection that triggered the resume is only served once the instance is up, so a client with a short timeout gives up first.

What etlmcp does when it times out

etlmcp opens each Postgres session with a fixed connect timeout that is shorter than Aurora's typical resume time. When the connection fails for a reason other than a bad password or a missing database, etlmcp reports could not connect followed by the driver's message, and marks the failure as one that can pass.

For a run, that matters. A failure that can pass is retried: a run gets 3 attempts in all, and the second waits at least 60 seconds. The first attempt wakes the cluster, and by the time the retry connects the instance has long finished resuming, so the run usually succeeds on its second attempt. While a retry waits, the run shows as queued with the earlier error on it; see Retries.

The Test button has no automatic retry. If it fails once against a cluster that may have been idle, wait about 15 seconds and press it again before you change the host, user, password or network rules. If the second Test also fails, the problem is real; see Amazon RDS for PostgreSQL and Postgres SSL for the usual causes.

An authentication failure is different: etlmcp reports could not connect: authentication failed and does not retry, because waiting does not fix a wrong password.

How to avoid the first failure

  • Keep a floor of capacity. Set the minimum capacity to 0.5 ACUs or more. Any value above zero turns auto-pause off, at the cost of paying for that minimum around the clock.
  • Lengthen the idle interval. If your pipelines run daily, an interval longer than the gap between runs (up to one day) keeps the instance awake from one run to the next. Runs that are further apart than a day will still find it paused.
  • Know what keeps it awake anyway. An RDS Proxy attached to the cluster holds a connection open to every instance, so serverless instances behind it never pause. Logical replication, a zero-ETL integration to Redshift, and being the primary of a global database also keep the writer awake. Any client left connected, such as a SQL editor, does the same.

If you keep auto-pause on to save money, expect the first attempt after a quiet night to fail and the retry to load the data.

Related

Sources

  1. Scaling to Zero ACUs with automatic pause and resume for Aurora serverless — docs.aws.amazon.com, checked