Acts as a connection pool between a client (such as [[AWS Lambda]]) and an [[AWS RDS|RDS]] databsae. ## Troubleshooting ### RDS Proxy doesn't close idle connections #### Problem If you're using Aurora Serverless v2 with RDS Proxy and have a high `max_connections` configured in your Aurora cluster, you may notice that after a traffic spike the number of `DatabaseConnections` between the proxy and the cluster stays high and doesn't decrease, even after the configured idle timeout passes. While you may not care about open backend connections, the `ServerlessDatabaseCapacity` metric which measures the current scaling level of your Aurora Serverless cluster seems to be closely correlated with the number of open connections, and so you'll be paying for keeping it scaled high even when most connections are sitting idle. #### Fix RDS Proxy has a setting seemingly not visible on AWS Console and only accessible via the AWS CLI called `MaxIdleConnectionsPercent`. It defaults to 50% of the max available connections. So if you have manually configured a huge max_connections of say 50,000, then only if there are more than 25,000 idle connections will it start closing them. You can run the following command to decrease it to a lower level, in this case 5%. ``` aws rds modify-db-proxy-target-group \ --target-group-name default \ --db-proxy-name PROXY_NAME_HERE \ --connection-pool-config MaxConnectionsPercent=100,MaxIdleConnectionsPercent=5,ConnectionBorrowTimeout=120 ```