CodexBloom - Programming Q&A Platform

AWS RDS Aurora not using the expected read replicas for load balancing

👀 Views: 14 💬 Answers: 1 📅 Created: 2025-08-24
AWS Aurora RDS Java Database

I'm sure I'm missing something obvious here, but Hey everyone, I'm running into an issue that's driving me crazy. I have an AWS RDS Aurora setup with a primary instance and two read replicas for handling read traffic. Despite having enabled the read replicas, my application (using the AWS SDK for Java version 2.13.0) seems to consistently route read requests to the primary instance instead of distributing them across the replicas as expected. I am using a connection pool configured with the DataSource from Amazon RDS, and I have verified that the replicas are in a healthy state. My connection string looks like this: ```java String jdbcUrl = "jdbc:mysql:aurora://<username>:<password>@<cluster-endpoint>:3306/<database>?useSSL=false"; ``` I've also set the `useAuroraReadReplica` parameter to true in my connection properties: ```java Properties properties = new Properties(); properties.setProperty("useAuroraReadReplica", "true"); ``` Additionally, I have checked the parameter group settings to ensure that the connection timeouts are sufficiently high, but I still see all reads being directed to the primary instance. My application logs show entries indicating that the read calls are hitting the primary instance consistently: ``` 2023-08-01 12:00:00 INFO - Executing read query on primary instance ``` I have also tried to manually specify the read replica endpoint in the connection string but that introduced issues with failover, as my application couldn’t gracefully switch under load. What could be causing this behavior? Am I missing a configuration step or best practice for using read replicas with Aurora? I'm working on a CLI tool that needs to handle this. I'd really appreciate any guidance on this. I'm working with Java in a Docker container on Windows 10. Cheers for any assistance!