From VPS to the AWS Cloud
As I mentioned in one of my last posts, my primary client and I have undertaken a mission to make the application kronum.com more scalable and nimble, as we are experiencing sudden and dramatic spikes in our traffic.
The process of migrating from a traditional VPS stack to a nimbler Cloud setup has been quite educational and illuminating. It definitely alters how you view the architecture of your application. It’s hard but fun.
I want to call out that I am new to this AWS world and recognize that some or many of the options I’ve selected may not be ideal or the best ones. I did my best to research it thoroughly and make good choices.
Build the AMI YOU Want
I’ve been mulling over how to approach this series and, as if often the case, I find myself typically searching for similar topics over and over. One thing I often check for is how to install things on a Unix server. So, I wanted to detail how I built our current server on AWS, what services I chose to install, how I configured them and how it’s played out.
I suppose the best place to start is to list off what we’ll install and in which order these services will be installed. Please note that our production instance is a large 64-bit Ubuntu machine while the one I’ll create below is for our staging system and will be a small 32-bit machine. Despite the differences in instance type (large v. small) and bit (64-bit v. 32-bit), the process for installing and the software chosen is identical.
The Amazon Machine Image (AMI)
I chose the pre-built Amazon Linux AMI made available publically via the AWS console. For the purposes of this blog post, I chose this image because it’s a minimal Linux install (you don’t need to remove lots of options/software from some of the other available images) yet has the AWS configurations built in.
With my server chosen and running, I set out to begin installing the services I would need to run our application. In order of installation, they are:
- Apache Tomcat 7.0.x
- ActiveMQ 5.5.x
- Apache 2.2.x
- Railo 3.3.000.x
- VFTPD (ftp)
- Postfix (mail)
Picking an Instance
- Log onto AWS and select the EC2 tab
- Click the Launch Instance button
- Select the Amazon Basic 32-bit Amazon Linux AMI 2011.02.1 Beta (note: the date may change depending on when Amazon makes updates and this post is read)
- Follow the Request Instances Wizard steps to complete the setup of your AMI
- You should probably pick the Small instance (a few bucks per month) or the micro (free) unless you know you want a large instance (more money)
- It will take a few minutes but, in short order, your instance will be up and running
The instance wizard looks like this (and we’re using the top AMI in this screen shot):
One thing to note about AWS is that each time you shut down (versus reboot) your instance, the IP address assigned to it will ‘go away’ and upon your next boot, a new one will be assigned. This can be a pain in the ass for SSH connections, FTP, DNS, etc. To get around this issue, AWS has Elastic IP addresses. These IPs are static in that AWS allocates them to you. What’s cool is that you can assign this IP address to any instance you want … and it will persist beyond stop/starts.
Getting started with an Elastic IP is quite easy.
- Select the Elastic IP link on the left-hand side of the EC2 page (under the section for Networking & Security)
- Press the button to allocate a new IP address and follow the prompts
- Select the Elastic IP in the grid
- Click the now-enabled button: Associate Address
- Select your instance identifier from the select list
Now you have a static IP from which you can access your server.
Installing the Software/Services
The first step to installing your software is to connect to the server itself. I use my Terminal and connect via SSH. For help doing this, return to the Instances section of the EC2 tab and select your instance in the grid. Then, expand the Instance Actions menu and select Connect. This will show you the SSH details. If you’re not familiar with SSH and PEM key files, spend a few minutes learning about them.
Once connected to your instance, you’re ready to install. To make your life easier for the installations, type ‘sudo su’ (no quotes) at the prompt so you are now working as the super-user.
In order to keep the posts fairl readable, in terms of length, I’ll stop here and create a new post, which I am working on now, for the actual installations.