AWS RDS proxy connection close
I have a question about how the rds proxy works. If I close the connection to the proxy endpoint from the application (lambda function), does it also close the underlying database connection (proxy to rds) ? Or it just closes the application to proxy connection and return the database connection back to the pool? If the latter is true, can I safely close the connection from the application when the work is done and request it again when necessary?
RDS Proxy is a managed connection pool for RDS. As such, it creates a pool of connections to the database. The clients create the connections to the proxy. There is not a 1-1 relation between client connections and database connections. Whenever a request is received from the client, the proxy will take a connection from the pool, perform the request and return the connection to the pool.
Given the above, your application can create and destroy connections and will have little effect on the database connections. Saying that, it is recommended that you will maintain the connection between your Lambda function and the proxy to reduce execution time.
You can find more information about connections settings here
Thanks for the clarification. The only reason I wanted to close the application connection was to prevent database connection closed error after long period of inactivity. Now that rds proxy re-uses the db connection during the application idle period, I don’t think there would be any database connection closed errors (need to make sure there is no connection pinning to allow db connection re-use)
RDS Proxy on MySQL Lambda Function (C# .Net Core 3.1 Runtime)asked 4 months ago
Some metrics missing for RDS proxy MySql AuroraAccepted Answerasked 4 months ago
Using DocumentDB with Lambda: connection poolingAccepted Answerasked a year ago
Using AWS Lambda with RDS Proxy: Socket Ended Errorasked 4 months ago
RDS Proxy Metricsasked 4 months ago
AWS RDS proxy connection closeAccepted Answerasked 3 months ago
Database Connection Pooling with Aurora Serverless & Lambdasasked 2 months ago
RDS Database Instance does not show up in dropdown when creating RDS Proxyasked 3 months ago
RDS connections in LambdaAccepted Answerasked 21 days ago
RDS Proxy raises InvalidParameterValue errorAccepted Answerasked 2 years ago