Posted on

Which EC2 Instance should you use?

EC2 On Demand Instance

The most expensive instance launch type but only pay for what you use with no upfront payment and no commitment.
Available with Mac OS (Billed per hour), Linux and Windows operating systems (Billed per second of use after the first minute)

Use case is for short-term use where the instance cannot be interrupted and where it is impossible to predict how the application will behave

EC2 Reserved Instance

An EC2 Reserved Instance is an instance where you are prepared to commit to leasing the instance for a specific period of time (Between one and three years).

The longer you commit to having the instance the more discount you will receive. As an example you can save up to 75% off the price of the same On Demand instance.

In addition if you pay up front for the instance you are able to make further savings. As a further example if you commit to a three year lease of the EC2 instance and pay for all three years up front then you will make substantial savings.

The use case for Reserved instances is for applications which will stay in the same state e.g. Databases

There are two other options when it comes to Reserved Instances:

Convertible Reserved Instance where you are able to change the type of EC2 instance. Choosing this instance type will not be as cost effective and will bring savings of up to 54% over and On Demand instance

Scheduled Reserved Instance (Deprecated). An reserved instance which will only be used during a specific timeframe during day / week / month

EC2 Spot Instances

The most cost effective instance with savings of up to 90% over On Demand Instances. However, EC2 Spot Instances can be terminated at any time if another AWS user outbids the price you are willing to pay.

Therefore EC2 Spot Instances are not good for any critical work loads (e.g. Databases) and should only be used for workloads that are resilient to failure e.g. Media processing, Batch Jobs, Distributed Workloads

When bidding for a Spot Instance you bid the max spot price you are willing to pay and you will have a spot instance while you are the maximum bidder.

The price per hour is based on the offer and capacity.

If and when your maximum price is outbid then you have a two minute grace period and you can chose to either stop or terminate your instance.

Where there is a requirement that a spot instance must not be terminated you are able to purchase a Spot Block which is an EC2 instance which can be reserved for a period of between one and six hours without being interrupted.

When requesting an EC2 Spot Instance the following must be specified:

  • The maximum price you are willing to pay for the Spot Instance
  • The number of instances you will require
  • The specification of the instance
  • The type of request e.g. Persistant or one-time
  • The timeframe that you require the instance

One-time Instance Request: As soon as the instance request is fulfilled the instance request will be flagged as being fulfilled and will then go away

Persistent Instance Request: The process will keep instantiating instances for the request number of instances within the given timeframe.

e.g. If you specify that you want four requests and an instance is terminated or stopped then the request will be fulfilled based on the spot price.

A Spot Instance can only be cancelled where the Instance falls into one of the follwing states: Open, Active or Disabled. Additionally, even if a Spot Instance request is cancelled then it is up to the end user to cancel any running Spot Intances which have been instantiaed by the request

Therefore if you wish to cancel a Spot Instance request you must first cancel the Spot Instance Request and then terminate any running EC2 instances which were created by the request

EC2 Dedicated Host

An EC2 Dedicated Host is where you rent a physical server within the AWS Data Center and the server is dedicated to your use only and must be reserved for a three year period.

An EC2 Dedicated Host is more expensive than other EC2 instances.

The use case for a dedicated server is such where compliance requirements must be met.
Additionally, running a dedicated server may be more cost effective as you are able to install your own server bound licences (e.g. You may have an existing licence for Windows Server and MSSQL).

EC2 Dedicated Instances

An EC2 Dedicated Instance is where you rent an instance which is running on hardware which is dedicated to you and you will share the hardware with other instances in the same AWS account.

In addition you have no control over the instance placement and have no access to the underlying hardware of the instance – With a EC2 Dedicated Host you have full control of the server whereas an EC2 Dedicated Instance is more of a Software version.