Connection to AWS Aurora RDS failed Caused by: Read timed out

I have a successful manual process for running Liquibase on EC2 and running change sets against AWS Aurora RDS (Postgres) and am working on automation. My issue is the first time I attempt to run a change on the RDS I receive the error shown below. If I go to the RDS and run a quick query and then retry to run a changeset from EC2 it runs no problem. I believe it is an issue with the RDS being serverless and needs to spin up due to a lack of traffic to the database prior to liquibase attempting to connect. My question: how can I get the connection to succeed with the first attempt to run a changeset? Some how modify the connection timeout settings to allow the RDS more time to spin up?

Error received: Unexpected error running Liquibase: Connection could not be created to jdbc:postgresql:(dbcluster) with driver org.postgresql.Driver. The connection attempt failed.

  • Caused by: Read timed out

Can you do the update using docker-compose? I know that gives you a depends-on option to see if another service is running. Admittedly I don’t know how you connect to an external database from within the docker compose file but might give you a heads up.

Here’s a forum post I did before with a docker-compose file I used to run liquibase against a DB Image, might be of some help - Docker Liquibase image Certificates issue with SQL Server - #6 by markmann