Create a sub-domain using Amazon AWS vs Creating the sub-domain from within the server - What's the difference?

That's the thing with Amazon Web Services. You have a lot of options to construct your infrastructure, beginning with the simple EBS (Elastic Beanstalk) which provides an easy-to-deploy (a.k.a. quick-and-dirty way) environment.

Another option is to use EC2 and build it yourself, and since this is the way you've chosen so far, basically what you need is:

In your Route 53, create a CNAME or an A record pointing to your instance's IP address (you should use Elastic IPs to make sure your instance always get the same IP address). I would suggest a CNAME entry because you already has an A record in your zone. It makes your DNS resolution a little bit slower, but it's easier to manager through time. We can call that tools.example.com.

In your Apache configuration's directory (usually /etc/apache2/sites-available), create a file called tools.example.com.conf with the following content:

<VirtualHost *:80>
    ServerName tools.example.com
    ServerAdmin [email protected]

    ErrorLog /srv/www/tools.example.com/logs/error.log
    CustomLog /srv/www/tools.example.com/logs/access.log combined
    DocumentRoot /srv/www/tools.example.com/public_html
</VirtualHost>

Create the directory which will store your site/application with:

mkdir -p /srv/www/tools.example.com/{public_html,logs}

Enable the new virtualhost and reload Apache's service:

sudo a2ensite tools.example.com.conf
sudo service apache2 reload

A tip: in most cases, using AWS infrastructure and out-of-the-box solutions is cheaper.

Note: Basically, this is what you need, but this is not 100% ideal for a production environment.

Cya!


You need two things for your subdomain to work properly.

  1. A DNS Record in a DNS Server. This Records should be created on the name servers that you have set up on your naked domain (yourdomain.tld). If you are already using Amazon Route53 for your naked domain that's fine you can also use it for your subdomain (Amazon Route53 is just a dns hosting service)

  2. A virtual host in a web server.