everythingpossible - Fotolia

Choosing the right Amazon EC2 instance type

Cloud expenses can spiral out of control if you purchase the wrong AWS instance types. To get the best deal on your cloud use, choose the right Amazon EC2 instance.

IT administrators need to understand the different options available for spinning up instances in AWS. The instance...

types are diverse -- and new ones are added regularly -- but the pricing constructs also vary. Amazon Elastic Compute Cloud offers a number of methods for purchasing different AWS instance types, each of which is based on buying a virtual machine instance for some period of time. A key factor in controlling cloud computing costs is to choose the right AWS instance types, as Amazon EC2 offers On-Demand, Reserved and Spot instances to meet customer needs.

Amazon EC2 On-Demand and Reserved instances are fairly straightforward.

You can start an On-Demand instance at any time and pay a fixed hourly price, which varies by instance size but generally ranges from $0.02 per hour for a micro-instance running Linux to $2.28 per hour for a quadruple, extra-large, high-memory instance running Windows. Installing an On-Demand instance means you make no commitment to how long you will use it; you can shut down the VM at any time and pay only for the time used.

Reserved instances allow cloud managers to purchase at a lower hourly rate by paying an upfront fee. For example, a one-year purchase of a medium-use Reserved large instance running Linux costs $640 upfront and $0.096 per hour; the same size instance in an On-Demand scale costs $0.32 per hour. Reserved instances can be purchased for one- or three-year periods. On-Demand and Reserved Instances both have fixed prices and offer consistent access to instances when needed.

Spot yourself some cash

Spot instances were created to address a usage problem with the Amazon cloud. For example, there are times when Amazon EC2 servers have excess capacity. Because Amazon only generates revenue from its EC2 servers when they're in use, the company wants to entice customers to run more jobs during times of underutilization.

Spot instances are available in the same configurations as On-Demand instances, but they have two major differences compared to other AWS instance types. First, the price of Spot Instances varies over time. A large instance running Linux might cost $0.10 now, for example, but the cost could be higher or lower an hour from now. Amazon sets these Spot prices and will change them according to instance demands. The price of a Spot Instance can conceivably range from nearly zero to that of the On-Demand price.

If you’re willing to wait for periods of low demand in the Amazon cloud, and you can accommodate unwanted shutdowns, you can have access to instances at fraction of on-demand costs.

Customers make offers to buy Spot Instances by setting the price they are willing to pay for an hour. If the customer's bid price is at or above the Spot Instance price, he gets an instance. If, for example, a customer bids $0.15 for an hour on a large instance and the Spot price is $0.11, then the customer will get an instance and is charged $0.11 per hour. If the Spot price were $0.16 per hour, the customer won't gain access to an instance because the bid is below the Spot price.

The second way in which Spot Instances differ from other AWS instance types is that Amazon can shut them down at any time. This happens when a Spot Instance price rises above a customer's bid.

As an Amazon EC2 customer, you might start a Spot Instance during a period of low demand in the Amazon cloud with a Spot price that's lower than your bid price. The Spot Instance might run for hours, or even days, before the Spot price rises above your bid price. When that happens, Amazon will shut down your Spot instance. This sounds fairly dramatic at first, but most non-mission-critical applications can accommodate an unwanted shutdown without issue.

ec2 instance pricing
The pricing on Amazon EC2 instances is based on several factors.

Spot Instances are especially suited for jobs that do not have to run on a fixed schedule. Ad hoc jobs -- converting documents or analyzing a large data set -- are good candidates for Spot Instances. If you're willing to wait for periods of low demand in the Amazon cloud, and you can accommodate unwanted shutdowns, you can have access to instances at fraction of On-Demand costs.

Next Steps

Match an EC2 instance type to your compute workload

Use EC2 instances to your budgetary advantage

Make sense of the containerization craze

Dig Deeper on AWS instances strategy and setup