0

We are using Java Spring Boot 2.3 alongside Postgresql as our database. For better availability, we want to implement Multi A-Z and RDS Proxy for Postgresql.
In application.properties file, we are using the following properties for normal connection to the database and all works fine

spring.datasource.url=jdbc:postgresql://zzzz.us-east-1.rds.amazonaws.com:5432/postgres
spring.datasource.username=xxx
spring.datasource.password=yyy

When using RDS Proxy, i am trying to use same properties, but instead of the DB URL, i am using the endpoint of the RDS Proxy

spring.datasource.url=jdbc:postgresql://rds-proxy-endpoint.us-east-1.rds.amazonaws.com:5432/postgres
spring.datasource.username=xxx
spring.datasource.password=yyy

For testing purposes, RDS Proxy Security group is open and my machine has access to it, but still it wont let me connect, here is the error

24832 [task-1] ERROR com.zaxxer.hikari.pool.HikariPool  --- HikariPool-1 - Exception during pool initialization. 
org.postgresql.util.PSQLException: The connection attempt failed.

Am i missing something?
Thanks a lot in advance

jtoberon
  • 8,706
  • 1
  • 35
  • 48
alext
  • 678
  • 1
  • 11
  • 25
  • Your `Spring Boot` is running on an instance in same vpc as your rds proxy is using? – Marcin Jan 02 '21 at 10:20
  • yes it is, but i want to test it on my local machine as well. Does rds proxy make sense if they are in same VPC? My use case is because i want to have instance in other AZ and in case of failure RDS proxy would help for faster DNS switch – alext Jan 02 '21 at 10:22
  • 1
    rds proxy can't be accessed from outside of vpc. To access it from your local machine you would have to setup vpn or ssh tunnel or some other proxy, to access rds proxy. – Marcin Jan 02 '21 at 10:42
  • If you have enabled VPC Flow Logs, then you can trace vpc flow logs to check, which aws resource is rejecting the network traffic. For VPC flow logs information please refer https://aws.amazon.com/blogs/aws/vpc-flow-logs-log-and-view-network-traffic-flows/ document from AWS. – amitd Jan 02 '21 at 10:53

0 Answers0