nehem
nehem

Reputation: 13642

Using Django ORM inside an AWS Lambda function

I have an existing Django application data stored under Postgres RDS. Now I want to query/update the data via a lambda(AWS) function with Django style ORM.

I know in theory it is possible if,

I wanted to know if anyone has done this? Examples or write-ups are much appreciated

Upvotes: 12

Views: 8421

Answers (1)

Noel Llevares
Noel Llevares

Reputation: 16037

If you only want to use Django's ORM (no views, admin, templates), then yes, you can use Django ORM in AWS Lambda as a library and no need for Zappa.

You can see how to do it from here: Using only the DB part of Django

However, take note that in AWS Lambda, you are billed per 100ms of execution time and Django ORM is not exactly fast (vs. direct raw queries).

It is recommended that you keep your Lambdas as lean as possible. Loading up the entire Django package is opposite of that recommendation.

Upvotes: 15

Related Questions