You can still retain state — by declaring the connection pool outside the function handler, i.e. as a global variable in the Node.js module / as a static object in Java/.Net.
If you want to use RDS from Lambda, then there’s couple of configurations you need to tune. Jeremy Daly has a good summary of what these are: https://www.jeremydaly.com/manage-rds-connections-aws-lambda/