Multi-Tenant Deployment on AWS Fargate (Single Container Approach)

Job ID: 39186285

Budget: $30 – $250 USD

Deploy a single container on AWS Fargate to handle multiple tenants dynamically using a shared application codebase. Tenant-specific configurations (like database credentials, API keys, etc.) will be loaded at runtime without modifying the codebase.

Key Requirements:

Single Deployment for Multiple Tenants:
Use one ECS/Fargate task (container) to serve requests for all tenants.
No separate deployments per tenant.

Tenant Identification:
Identify the tenant based on the domain/subdomain (e.g., tenant1.mysite.com, tenant2.mysite.com) or a custom header in the request.

Dynamic Configuration Loading:
For each tenant, fetch tenant-specific configuration at runtime (e.g., database credentials, API keys, feature flags).
Use AWS Systems Manager (SSM), AWS Secrets Manager, or Redis to store and retrieve tenant-specific configurations.

Configuration Storage:
Store tenant-specific configuration in SSM Parameter Store, Secrets Manager, or Redis.
Each tenant’s configuration is fetched based on the tenant identifier (e.g., subdomain).

Scaling:
The application should scale dynamically to handle requests from multiple tenants within the same container.
Use AWS Auto Scaling for Fargate services to scale based on demand.

Performance Optimization:
Use Redis (or other caching solutions) to cache configurations for fast retrieval, reducing repeated calls to SSM/Secrets Manager.
Ensure that cached configurations are updated periodically or based on tenant changes.

Security:
Use IAM roles/policies to ensure that only the Fargate container has access to tenant-specific configuration in SSM/Secrets Manager/Redis.
Ensure that sensitive configuration (like API keys and database credentials) is securely stored and retrieved.

Cost Optimization:
Since only one container serves all tenants, costs will be significantly reduced compared to running separate containers for each tenant.
Consider using Spot Instances for additional cost savings (if acceptable for non-production environments).

No Codebase Changes:
No code changes are required for adding new tenants. Simply add tenant-specific configuration to the chosen storage solution (SSM, Secrets Manager, Redis).
Related categories: Amazon Web Services Aws Lambda Amazon ECS