I trying to setup as part of a study a PaaS (Platform as a service) for Ruby on Rails applications. I have already played with Amazon EC2 and Chef creating EC2 instances based on Chef's recipes and roles.
Now I need to be able to give every "customer" account or every app a unique subdomain like app1.mydomain.com, app2.mydomain.com, etc. which points to my customer's app on an EC2 instance. I then need to allow the customer to point their domain to their customized subdomain (app1.mydomain.com, app2.mydomain.com).
Can someone explain to me how I can achieve that?