amazon-web-servicesdomain-mapping

Allowing custom domain names for tenants on multi tenant SaaS platform hosted on AWS


Overview

I am building a multi tenant SaaS platform on AWS. The deployment architecture for now is very simple.

Everything is in a VPC and the EC2 and RDS are in private subnets,

Problem

I would prefer my clients (tenants) to have their own domain name. For e.g. Let's say that right now my application is accessible at the URL http://xyz-elb.amazon.aws.com

I would like to enable my clients to access the application using

Research I have done till now: I read about reverse proxy which can accomplish it however, I didn't get any reliable link. Tried reading about HAProxy but I feel that I am going in the wrong direction.

What I need

Thank you so much for reading my question. And thanks in advance for your efforts to reply on this.


Solution

  • Just create a DNS CNAME resource record in each tenant domain, pointing to your apps ELB DNS name.

    I prefer to alias the ELB DNS name to my service domain, then alias the tenant domain to it. Example:

    app.example.com IN CNAME my-loadbalancer-1234567890.us-west-2.elb.amazonaws.com

    Then in my tenant DNS:

    app.tenant1.com IN CNAME app.example.com.

    This aliasing allows you to change your ELB endpoint if required, without having to change the DNS records for all clients.