title: Setting up subdomains in Rails 3 on AWS Elasticbeanstalk
body: <p>My rails app has the following subdomains: my, admins, locations</p>
  
  <p>I have set up my routes file as follows:</p>
  
  <p>routes.rb</p>
  
  <pre><code>match '/' =&gt; 'admins#index', :constraints =&gt; { :subdomain =&gt; "admins" }
  match '/' =&gt; ‘users#index', :constraints =&gt; { :subdomain =&gt; "my" }
  match '/' =&gt; ‘locations#index', :constraints =&gt; { :subdomain =&gt; “locations” }
  </code></pre>
  
  <p>Locally, this works fine…If I point to admins.lvh.me, or my.lvh.me, it points to the right page.</p>
  
  <p>My issue is when I deploy it to AWS ElasticBeanstalk. Elasticbeanstalk makes my app accessible at aws_assigned_name.elasticbeanstalk.com. So I added a CNAME to my DNS as follows:</p>
  
  <pre><code>my.mydomain.com CNAME aws_assigned_name.elasticbeanstalk.com
  </code></pre>
  
  <p>Can I do this multiple times, one for each subdomain? So my DNS would look like:</p>
  
  <pre><code>my.mydomain.com CNAME aws_eb_assigned_name.elasticbeanstalk.com
  admins.mydomain.com CNAME aws_eb_assigned_name.elasticbeanstalk.com
  locations.mydomain.com CNAME aws_eb_assigned_name.elasticbeanstalk.com
  </code></pre>
  
  <p>Or what is the generally accepted method to handle this?</p>