There’s lots of different instance types available from AWS, all of which excel for certain workloads. There are also different ways of paying for your instances which can save you a lot of money. With all the different combinations available, it’s essential that you pick the right instance types to avoid paying more than you need to.

Instance pricing

There’s 3 different ways of paying for your instances:

Pricing typeHow it worksIdeal for
On-demand instancesPay for only what you use.Temporary and short running workloads that can’t be interrupted (i.e. video rendering)
Reserved instancesReserve capacity, pay a lower rate. Save up to 70% compared with on-demand.Long running workloads that need to be available all the time for a period over 12 months (i.e. web servers).
Spot instancesAn auction of unused compute capacity on AWS. The max you pay is the current on-demand price. Can potentially be interrupted.Temporary and short running workloads that can be interrupted (i.e. non-critical data processing).

Instance types

There are a lot of general and speciality instance types available from AWS; picking the right one for your workload is crucial for optimising performance and cost.

Common applications and recommended instance types

Web and application servers

Regular web servers need to be running all the time, so you should reserve your instance to save on running costs. You probably want to choose a general purpose instance type such as T2/T3. This is ideal for running a regular web application such as NodeJS, Python, PHP, Go etc. A reserved T2/T3 would be a good choice for this kind of server.

Database/caching servers

Database servers need to be running all the time, so reserving your instance makes sense. Depending on the type of database your are running you can choose between memory or storage optimised instances. If you’re running a NoSQL database that persists to disk such as MongoDB, you’ll need an I series instance such as an I3. If you’re running an in-memory database such as Redis you’ll need an R series instance such as R4/R5.

Video encoding servers

Servers performing video encoding tasks only need to be running when there is work to do. When encoding tasks are running they can last hours and usually can’t be resumed if interrupted. On-demand instances are best for this kind of workload. As video encoding is CPU intensive, a CPU optimised instance type such as C4/C5 would be a good choice.

I’ve included a more detailed list below if you have a less common scenario:

Common Instance types

SpecialityInstance typeIdeal for
General purposeT (i.e. T2, T3, T3a)General workloads that don’t fit into any other speciality types, such as general web application servers.
General purpose (extra memory)M (i.e. M4, M5, M5a, M5n, M6gGeneral workloads that require additional memory, such as data processing.
Compute optimizedC (i.e. C4, C5, C5n)CPU intensive tasks as video encoding, high-performance servers and analytics.
Memory optimizedR (i.e. R4, R5, R5a, R5n)Memory intensive tasks such a in-memory caches and databases.
Storage optimizedI (i.e. I3, I3en)Storage intensive tasks such as databases (i.e. Cassandra, MongoDB).

Speciality instance types

SpecialityInstance typeIdeal for
General purpose ArmA1General workloads that don’t fit into any other speciality types and benefit from Arm.
Accelerated computing (GPU)P (i.e. P2, P3)Extremely high performance computing such as deep learning.

I’ve left off some instance types as they are only useful in very unique situations, the full list can be found here: https://aws.amazon.com/ec2/instance-types/

Tagged in:
,