Unable to connec to Azure Database for PostgreSQL flexible server from AWS VPC with site-to-site VPN

Zhan, Kael 0 Reputation points
2025-08-10T13:10:45.9033333+00:00

I want to connec to Azure Database for PostgreSQL flexible server from AWS VPC.

I created site-to-site VPN and the VPN status is all right.

But I still cannot connec to the Azure Database for PostgreSQL flexible server from AWS VCP with this VPN.

Logs as below:

codeuser@ct-webapp-84f48f595c-rzzpx:/app> psql -h 10.0.2.4 -U ct_production

psql: error: connection to server at "10.0.2.4", port 5432 failed: server closed the connection unexpectedly

This probably means the server terminated abnormally

before or while processing the request.

codeuser@ct-webapp-84f48f595c-rzzpx:/app> telnet 10.0.2.4 5432

Trying 10.0.2.4...

Connected to 10.0.2.4.

Escape character is '^]'.

Connection closed by foreign host.

Azure Database for PostgreSQL flexible server Info:

Subscription ID: c39ac57b-719f-4e84-a558-7f2a95cb1357

Resource group: shoot--sap-jam--eu21-int1

Server name: eu21-int1

VPN: eu21-int1_pg_db_vnet_gateway

Azure Database for PostgreSQL
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.