Hi, Can anyone help with using Amazon Aurora RDS D...
# help
s
Hi, Can anyone help with using Amazon Aurora RDS DB in Lambda using Python in sst?
t
hey Sergey can you expand more on where you're stuck?
s
i created rds and lambda instance. i use python language in lambda. i want to query the data from rds. what python library can i use for db connection?
https://serverless-stack.com/examples/how-to-use-postgresql-in-your-serverless-app.html in this article i saw that it's using
data-api-client
in javascript.
is there alternative library for python?
t
I'm not as familiar with python so I don't know if there is
you can also use a normal postgres library and connect to it without data api if you put your lambdas in the same vpc
you are going to have a better experience with typescript or javascript so we'd suggest that if this is a new project
s
@Sergey Antonenko I inherited a legacy serverless application that works with RDS for Postgres (not Aurora) and it was a huge pain. If it makes sense for your use case, I'd recommend working with a serverless database (DynamoDB, Aurora Serverless v1 or v2). You'll have a much better experience
On the other hand, if you need to use RDS for Postgres (the non-serverless option) and Python, I was able to get my setup working with Psycopg2.
But I will warn you that psychopg2 requires special handling to work within lambda (you need to compile it yourself)
f
Hey @Sergey Antonenko, i’m not too familiar with Python. But see if this works https://pypi.org/project/aurora-data-api/?
s
@Frank do you know how to add a dependency layer to lambda (requirements.txt) file?
f
lemme follow up in the other thread.