DEV Community

Discussion on: Deploying a Django project on AWS Lambda using Serverless (Part 1)

Collapse
 
kostjapalovic profile image
Kostja Appliku.com

Great article. Grew my curiosity about serverless framework.

Okay, Question here.

How it compares with Zappa? Have you tried it? I’ve built one big project with it (in terms of amount of code, no production usage so far).

Thoughts about Zappa:

  • Easy to deploy
  • Easy to get SSLed custom domain
  • convenient json configuration
  • Had to suffer a bit to make WeasyPrint (for generating PDFs) work, had to create an additional Layer with required files.
  • loved their @task decorator to make async functions
  • scheduling of function execution in json files works pretty cool too.

With non-production amount of traffic it is kind of slow at times. For example, when I work alone and test the app and there is an async task (I click something that causes email sending in @task function - it feels like it doesn’t go async. Or it take a while for another instance to spin up (watching cloudwatch logs in terminal).

Launch of that app is soon, so I am thrilled to see how all this stuff will behave.

But with initial learning curve, before I see any benefits of scaling, I think that could be better off with small ec2 instance.

Collapse
 
vaddimart profile image
Vadym Khodak

Hi Kostja,

I didn't have experience with Zappa. I tried it one time.
Zappa/Serverless is just a one of ways to deploy Django App on AWS infrastructure.
I think for some cases it will be better to use Zappa for other casses it is better to use Serverless or something else.

The same thing is about using EC2 instances vs AWS Lambdas.

About using nice json format, from my personal point of view yaml is more human readble format than json. But it is just my personal opinion. ("Many people many minds")

I have a couple of small projects (based on trafic) where Django is deployed on AWS Lambdas and it works well.

Regarding async task, I may be wrong, I think that if it will not work as async function if you call it from sync function. Django is not async framework, as far as I know.

Thank you for your comment here. I appreciate it.

Collapse
 
kostjapalovic profile image
Kostja Appliku.com

Hey. Thanks for the response.

I don't honestly care about json vs yaml. I mean i will not go in a holywar abou it :D but probably yaml is more human readable.

Anyway, the whole question was to make sure if i am missing out on not looking hard into the Serverless framework, maybe it is somehow superior to Zappa or anything like that.

From what I understand it is not and both are just possible options, if I understood you right. Thanks again.

Now about async stuff.

If a function is wrapped in a Zappa @task, then when it is called it checks if it is called in lambda environment. in this case it invokes a lambda function goes on.

So this invocation on cold dev/staging environment(when there are no concurrent requests, for example when only one me playing with the app) it takes quite a while to invoke it. But it feels that it gets faster once at least 2-3 people work with the app in parallel.

Anyway. Thanks again for the post!
Great work!

Thread Thread
 
vaddimart profile image
Vadym Khodak

Thank you for the feedback.

In Serverless you also can call another Lambda function from Django Lambda. But I think it is a bit more complex than just @task decorator. There are a lot of plugins for Serverless framework. One of them serverless-plugin-warmup. It can help you to keep warm your lambdas.