Setting up Subdomains within Amazon AWS Elastic Beanstalk

Try the following link.

Add a config file in your root inside .ebextensions directory.

Then add this.

files:
  "/etc/httpd/conf.d/vhost.conf":
    mode: "000644"
    owner: root
    group: root
    encoding: plain
    content: |
      NameVirtualHost *:80

      <VirtualHost *:80>
        DocumentRoot "/var/app/current/"
         <Directory "/var/app/current/">
          Options Indexes FollowSymLinks MultiViews
          AllowOverride All
          Require all granted
         </Directory>
      </VirtualHost>

      <VirtualHost *:80>
       ServerName your-custom-domain-here.com
       DocumentRoot "/var/app/current/your-new-webroot"
        <Directory "/var/app/current/your-new-webroot">
         Options Indexes FollowSymLinks MultiViews
         AllowOverride All
         Require all granted
        </Directory>
      </VirtualHost> 

More info here:

http://blog.celingest.com/en/2013/04/05/elastic-beanstalk-cloudflare-newrelic-virtualhost-2/