[Python] Django and AWS Lambda runtime configuration change

Discussão em 'Python' iniciado por Stack, Fevereiro 4, 2025.

  1. Stack

    Stack Membro Participativo

    I have a business application written in Django where each tenant should have a completely separate environment, including:

    Separate database schema Separate Redis instance Separate S3 bucket, etc. However, I want to deploy a single instance of the application on AWS Fargate or AWS Lambda to reduce management costs. Each tenant will have a different domain, and the Django configuration should dynamically change based on the tenant.

    My idea is to store all tenant-specific configurations (credentials, environment variables, etc.) in AWS AppConfig. For example:

    A single AWS RDS database with separate schemas for each tenant A shared AWS ElastiCache (Redis) instance but logically separated A single Django Celery setup Dynamic configuration loading based on the tenant Since each tenant has different database credentials, email credentials, payment gateway credentials (Stripe, PayPal, etc.), I want to ensure this approach is scalable and maintainable.

    My questions: Is this a good approach for multi-tenancy in Django? Are there better alternatives to managing per-tenant configurations dynamically? How should I handle tenant-based database connections efficiently in Django? Any recommendations or best practices would be greatly appreciated.

    Continue reading...

Compartilhe esta Página