For anyone who might find this useful, below is a summary of the steps you can take to get this all set up.
Set-up:
There are three options covered in the below steps:
A = NO domain name, NO load balancing
B = YES domain name, NO load balancing
C = YES domain name, YES load balancing
- (A+B+C) Create an EC2 instance.
- (A+B+C) Install all the necessities on your instance. At the very least, you'll want apache2 and whatever language(s) you wish to use for any backend scripts you want to run on your instance. I've used php.
- (A+B) If you don't want to get a domain name to use to access your EC2 instance, or if you want a domain name but don't need load balancing, you'll want to get an elastic IP address for your instance. This can be easily done through AWS. (C) If you want to use a domain name and load balancing, you won't need an elastic IP address. Go ahead and get yourself a domain name. I used namecheap.com. They currently (August, 2015) have .xyz TLDs for just $1.18 USD/year.
- (A+B+C) Add your backend files to the apache web server you installed on your EC2 instance in step 2.
- (B+C) Set up a hosted zone in Amazon Route 53. NOTE: Route 53 is NOT included in the AWS free tier and is therefore NOT FREE. The costs are here. (B only) Add A record(s) to your Route 53 hosted zone that point to the elastic IP of your EC2 instance.
- (B+C) Transfer the name servers of your domain name to the 3-5 name servers Route 53 gave you after completing step 5. The transfer will be done from the site you registered your domain name with.
- (C) Set up load balancing for your EC2 instance(s) in AWS. Note your load balancer's end point.
- (C) Add alias record(s) to your Route 53 hosted zone that point to your load balancer's end point.
Accessing your files on EC2
Let's say you have a php script myscript.php that you saved to your server in step 4. To run this script on your EC2 server after finishing the set up, you can do the following:
A - Open up a web browser and enter the following into the address bar: elastic_IP_of_your_EC2_instance/myscript.php
B+C - Open up a web browser and enter the following into the address bar: yourdomain.com/myscript.php
Hope this is helpful!