Background: SaaS company here. Each of our customers is going to receive their own private ec2 instance containing their own copy of one or more of our apps. The plan is for customers to be able to sign up on our site and automatically launch the ec2 instance via the AWS ec2 api.

My question is: How can we begin routing them to their instance as soon as it's been set up? (I don't want to give non-tech people an IP address and have to explain to them that they need to use it until their custom subdomain propagates.)

As far as urls go, either of these two methods would be acceptable (but I'd prefer the first):

  • www.ourcompany.com/{appName}/{customerName}
  • {app}-{customerName}.ourcompany.com

How would I go about routing traffic via one of these two URL set-ups to the customer's newly launched ec2 instance?

  • 1
    Only your second example requires a DNS record. Generally, sub-domains can be available immediately assuming a few things; one, that the users DNS does not cache DNS records, and two, that each new requested URL is resolved from the SOA by the browser which is the norm. Your second example requires automation and access to the DNS that is your SOA (statement of authority) which often requires your own DNS or perhaps API access to your DNS provider. Your first example requires nothing from your DNS. It is far easier to do. It would be my personal first choice.
    – closetnoc
    Oct 27, 2016 at 16:59
  • Perfect. Forgive my ignorance, but how would I go about pointing www.ourcompany.com/{appName}/{customerName} to the new instance?
    – ka101
    Oct 27, 2016 at 17:08
  • 1
    One really simple way is to create the URI (path such as /bugetmanager/acme/) within the web server and do one of two things; one, create another instance of your app specifically designed for your customer such as branded or special features, or two, create a symlink (assuming Linux - would be something similar in Windows) to your shared instance. There may be other options too. This can be done in code fairly easily. I do not know PHP for code help - sorry. I use another language that will not help you.
    – closetnoc
    Oct 27, 2016 at 17:39

1 Answer 1


For the first alternative, use Alt-SVC headers and prepare your SaaS customer instances to accept requests under the domain names and urls that you proposed. Tell your customer to try the new instance using a reasonably modern browser.

(At the time of this writing,j only Firefox has reasonably complete Alt-SVC support. Chrome has filled bug: https://bugs.chromium.org/p/chromium/issues/detail?id=615413 and they seem to be working on it).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.