Hi, guys. How to enable a lambda to access an Auro...
# help
a
Hi, guys. How to enable a lambda to access an Aurora Serverless? I got the secrets through the SecretManager, and aurora/lambda sits in one VPC, and still get error from the ORM library: Can’t reach database server at `blahblah.rds.amazonaws.com`:`5432` Please make sure your database server is running at `blahblah.rds.amazonaws.com`:`5432` (edited)
f
Hey @Albert Gao, is ur Lambda and RDS in the same subnet? different subnet?
I don’t know enough about RDS/VPC to spot the issue. But here’s a sample app I put together awhile back with similar setup, and I was able to connect to the RDS from the Lambda.
a
Thanks for the info! this is a pretty clear setup, let me try if I can start using that
rds.DatabaseInstance()
, which might doing something permission deriving underneath to enable the access, i am using a setup from this code https://github.com/ryands17/graphql-api-cdk-serverless-postgres/blob/main/lib/appsync-cdk-rds-stack.ts, the only difference is I do not use AppSync, I am using
sst.api
f
I see. Yeah, I’m not sure if instance vs cluster makes a difference. Give it a try. Also, you can try connecting to the VPC through from an EC2 instance or CloudShell.. just to make sure the RDS is configured correctly.
Then try to connect to it from the Lambda.
A bit of hassle.. but might help identify the cause 🤷‍♂️
a
ffs, https://www.prisma.io is getting in my way. I get it working with raw SQL…… what a bloody joke,,,,waste me a day….
thanks mate, you pointed me to the right direction!
f
oh man.. glad u got something worked out🤪