AWS RDS proxy connection close

0

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?

1 Answer
1
Accepted Answer

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

profile pictureAWS
EXPERT
Uri
answered 2 years ago
AWS
EXPERT
Parnab
reviewed 2 years ago
  • 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)

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions