Intro To Amazon Compute Instances (EC2)
Here are some “crib notes” on setting on an Amazon compute instance based on my most recent research (Aug 2016). You may find some of these notes useful or interesting or just plain boring geek-stuff. I’m sure I will find them in 6 months from now when I Google “what is AWS HVM” or something equally obscure.
M3 versus M4
Amazon classifies their EC2 instances by general “compute types” or “profiles” for how the virtual machine is configured. They have things like “T*” for “burstable performance” , “M*” for what I call “moderate usage”, and a few others like C* for “crazy CPU cycles” and “X*” for “X-Men Memory Monger” if you need to track the thoughts of every person on earth.
The most common profiles I like to use for standard production servers is the “M-class”. Because it is faster than the regular 3-series… no , wait, that is BMW. Regardless the M-Class is good for decent disk + network performance and comes in reasonable “sizes” for most daily production sites.
M3 is the older generation EC2 class and uses “local SSD drives” to store your operating system and software. They tend to have slightly slower CPUs and less memory than the M4 equivalents. Also if you terminate and permanently delete the instance all that software and configuration stuff you did goes away. Forever.
M4 is the newer generation and is only “EBS” (Elastic Block Storage, not to be confused with Elastic Beanstalk) based disk drives. When the machine is running this works just like a local SSD drive but it is stored in a more resilient “disk farm”. The contents of an EBS drive can also survive an EC2 instance termination ; this means you can kill an older M4 instance but keep the drive intact and re-attach it to a new instance. Think of it like pulling out a physical hard drive from a physical PC and putting into a new physical PC – but with a lot less hassles on driver configurations and other “gotchas” that normally accompany the physical-compute world.
I recommend using M4 instances for new servers.
On Demand versus Reserved
You can either pay for your servers each month (On Demand) or pre-pay for a year (Reserved). If you pay each month you pay a stiff penalty for the ability to “stop using AWS whenever I feel like it”. Turn off your server and the bill goes away. Nice. But expensive.
If you plan on running your server for more than 9 months then reserved is almost always the better option. I prefer the 1-year partial reserved payment. Here you pay a chunk up front on day 1 – usually equal to several months of “On Demand” (pay-as-you-go) fees in return for much lower ongoing monthly fees.
In the case of an M4.large instance the fees are currently $956 up-front + $130/month for reserved ($2,516/year = $210/month) versus $352/month ($4,224/year). You pay a $1,708 premium if you decided you want to go “month-to-month”.
HVM versus PV
When you create your EC2 server you will need to pick your operating system. These are pre-packaged with the base OS and possibly pre-installed software in what is known as an “Amazon Machine Image” (AMI). All AMIs come in two basic “flavors” that determine how the machine configuration (virtual hardware) is created.
HVM is a harward virtual machine. HVM-based AMIs take advantage of the AWS virtualization at a lower-level of the operating system and tend to provide superior performance.
PV machines use paravirtualization which is an older methodology.
When possible choose the HVM image and use a newer AWS EC2 instance such as the M4 instances.