Amazon Web Services (AWS) provides computing resources in the cloud. You can get access to as many ‘machines’ as you’re willing to pay for, as well as storage, database services and many others. All these can be combined to create a rapidly scalable application.
AWS does provide a free usage tier, allowing anyone to sign up and try out the service for free for a year, as long as the application remains below limits. Full details of these limits can be found on their website.
The free usage tier includes 750 hours of an EC2 micro instance, enough to run a little web server. The rest of this post will give a brief overview of how to get WordPress running on EC2.
Start by creating a new instance in the region of your choice. The Amazon Machine Images (AMIs) which are free to use are marked with a yellow star. AWS has recently started offering Ubuntu as a free image. This has made it much easier for me to get stuff working.
AWS provides instructions on how to create a SSH key and use it to login to the instance. If you want to allow others or other machines to login, generate SSH keys for them and place the public portion in the /home/ubuntu/.ssh/authorized_keys file.
Install Apache, PHP and MySQL using apt-get. This is basic LAMP setup stuff.
Install SVN. This is optional, but I like using SVN to install WordPress because it’s so easy to update.
To change the location of the webroot folder, change the DocumentRoot setting of /etc/apache2/sites-enabled/000-default
For permalinks to work, mod_rewrite must be enabled. Also, the AllowOverride setting in the 000-default apache configuration file must be set to ‘all’.
From the AWS Management Console, click on the instance to see its public DNS information. This address is the publicly accessible IP address. The full domain name ending in ec2-xxx-xxx-xx-xx..compute.amazonaws.com can be used for the WordPress site and home URLs. You can also create a shorter address with DynDNS and point it to the IP address given.
Before your web server can be reached from the internet, there’s one more thing to do. Go to Security Groups in the AWS Management Console, it’s under the Network & Security section. Select the security group used by your instance. Add a new inbound rule for port 80 (HTTP). This is necessary for the web server to be publicly accessible.
Now that everything is ready, use any method you like to install WordPress. Remember to create a database and user first.