0

I developed a website using django. Recently I am trying to make it serverless ( by deploying to lambda ). I haven't figured out how to maintain the session after user logged in when deployed to lambda.any suggestions please.

Vani Polnedi
  • 595
  • 2
  • 4
  • 19

2 Answers2

3

As you probably know, lambdas are stateless. You can use some database i.e. Dynamo DB to store and retrieve session related information, i.e. connection token. Otherwise you can integrate with AWS Cognito service which handles authentication and session information for you.

GiorgosDev
  • 1,757
  • 1
  • 14
  • 16
  • 1
    But django does not integrate with dynamob db, so you wouldn't be able to do things like `user.is_authenticated`, right? – Mojimi Apr 05 '19 at 12:15
2

Most session capabilities inherent to Django will work fine with a zappa deployed Django project as long as the appropriate infrastructure is available. For example if you choose database-backed session, then your Django deployment must have access to a database. But you must avoid File-based sessions since you cannot guarantee the file will exist for any given user request (the lambda container to which requests are routed are not deterministic).

For more information on Django sessions see the documentation

Edgar
  • 1,174
  • 8
  • 9