The AWS Cloud Practitioner Exam: Understand the Economics of AWS
Stackery sponsored this post.
The AWS Certified Cloud Practitioner Exam asks you to demonstrate familiarity with Amazon Web Services as the first step on your way to earn other AWS certifications. In order to pass this first exam, you must be familiar with AWS’s features and how to select the best product among the compute, storage and database categories for your needs.
A significant chunk of the questions on the exam revolves around the best type of EC2 instance to use for specific tasks. This can feel daunting when you look at the several dozen sizes and types of EC2 instances available, and find dry information for each type.
AWS tells you to be ready to pick the right type of instance. Do they really expect you to memorize that an a1.2xlarge type has 16 gigabytes of memory?
Thankfully, this is not the instance type they’re talking about. It’s actually referring to one of four pricing types for your instances, which you must select separately. They are:
- On-Demand Instances
- Spot Instances
- Reserved Instances
- Dedicated Instances
Even these four shouldn’t require you to memorize a grid of details if you remember that their various costs are based on market economics.
Which one of these above types is always cheaper than the others? None of them. Each will get you the best deal in certain specific situations.
On-Demand Instances: The Simplest and Most Expensive
When you want more EC2 instances, Amazon will have them for you. Did the president just call your CEO a ‘failing jerk’ on Twitter, sending your page views through the roof? AWS can easily provide all the capacity you’ll need. But buying your server capacity this way is the most expensive. Why?
The explanation is that AWS needs to be able to meet sudden spikes in demand almost anywhere. In order to have the capacity to meet higher demand, servers must exist that are not in use most of the time. When you pay for an on-demand instance, some of the cost will cover the time that server sat idle waiting for someone to need it.
So, on-demand instances are the most expensive in a dollars-per-computing hour, but you only need to pay for the capacity you’re using. When demand dips back down, you should be able to configure your deployment to “scale down” and use less of your capacity.
Spot Instances: What do we want? Computing! When do we want it? I dunno, whenever is fine, no rush.
Spot instances offer computing for jobs that can wait. The name can be a bit confusing since buying something ‘on the spot’ sounds like you’re buying it right away, but in fact, a task on a spot instance might not run for several hours!
The “spot” does refer to “on the spot” market, but what’s really happening is quick selling of capacity.
Think of the economics from AWS’s perspective: They have a huge stable of servers. In order to help clients meet their capacity needs on demand, a huge number of servers must be available. Well and good, but wouldn’t it be nice if, at 4 a.m. on the east coast when everyone is asleep and no one needs computing capacity, there were some way to sell that server time?
Enter Spot Instances, a great place to re-compile video or do your machine-learning training sets. Spot instances are the cheapest in terms of dollars per hour, but you can’t be certain when you’ll get the computing time you bought.
Reserved Instances: The One with the Most Obvious Name
Very often I use the example of “our super bowl ad just aired” to explain why we need reserved instances. Sometimes we know we’ll need server capacity way ahead of time and can reserve it.
After Spot Instances, Reserved will be the cheapest way to buy capacity. AWS is selling you server space with no need to guess how much you’ll need. Every single bit of computing capacity you reserved is going to be sold, so Amazon isn’t in danger of needing to sell time on the spot market as described above.
This price advantage also describes reserved instances’ downside: You will always end up paying for computing capacity you didn’t need.
Dedicated Instances: For When You’re Stuck in the Past
AWS servers are a great deal. They’re definitely cheaper than running your own data center and generally cheaper than any other infrastructure vendor. Why not use them always?
Well, one reason would be that you’re using software with licensing that was written before AWS became de rigeur. Many older software licenses don’t handle the actual nature of what AWS calls a server or “EC2 instance.”
Think about it for a minute: When you buy an EC2 instance with X amount of RAM and so much CPU capacity, are you really renting a box somewhere? Is there a gal running around a data center with a label maker writing “Dave’s server” on your bit of rack space running your stack?
No. Most of the servers you buy are just virtualized subsections of larger servers. That’s why AWS can offer hundreds of different capacity configurations since what you’re really buying is a slice of a larger pie.
From one moment to the next, “your” server might also move location to more efficiently distribute capacity. This should be invisible to you as a user but it saves AWS money.
Unfortunately, some licensed software won’t allow any of this; if your server moves from one piece of hardware to another they want to sell you a new license. As such, installing restrictively-licensed software on EC2 can be problematic.
Enter Dedicated Instances: now your server is guaranteed to run on a specific bit of hardware. This removes some efficiencies for AWS and as such Dedicated Instances will always be a bit more expensive, but are the only option for some stacks.
Go Forth and Certify
Passing this exam is part of why Stackery has its AWS DevOps Competency status. Our solutions are a great way to start building serverless apps with the confidence that you are choosing a solution that has achieved AWS’ rigorous DevOps standards.