DEV Community

Elijah
Elijah

Posted on

Mastering AWS Instance Pricing: A Guide to Choosing the Right Plan for Your Needs

This post serves as an essential guide for AWS cloud engineers, technical teams, project managers, executives and decision makers, legal and compliance teams, providing a detailed outline of the foundational knowledge required to set up AWS instances.

I can recollect when I just started out with AWS services; using EC2 instances to facilitate app deployments. I created an instance without understanding the cost implications, and I learnt a lesson from then on which has stucked with me. It led me to getting myself acquainted with the various AWS pricing policies towards EC2 instances.
And I plead, do not create an AWS instance without first understanding what is stated in this guide.

Now, AWS instance pricings are categorized into five

  • 1. On demand instance
  • 2. Reserved instance
  • 3. Spot instance
  • 4. Dedicated hosts
  • 5. Dedicated instance

On DemandΒ Instance
Simply put, on demand instances are instances where you have to pay in usage per seconds while the instance is in use. This is ideal for deployments with no long term commitments, and a defined time usage, as it is used a timely fashion with a fixed prize. With on demand instances, you have full control over the instance entire lifecycle, you can start, stop, reboot, hibernate or reboot it. See in details the pricing for each instance type on hourly bases here

Reserved Instance
Stick with me, as this one is kind of tricky to grasp. But I will explain in simple terms.
Let's assume you needed to use a workspace within a definite timeframe, where you have to pay a fixed price hourly, but the workspace also offers a long term commitment plan which enables you reserve a slot at the workspace for over a period of time.Β 
That's just a simple illustration but keep it in mind. Let's understand this in the right context.
With Reserved instance, you make a reservation for the usage of an instance over a period of time. In return AWS offers a discount on the hourly charge compared to an on-demand instance.
The timeframe for a reservation is either one year or three years.

I would also like to point out some points about RIs πŸ‘‡πŸ‘‡

A reserved instance cannot be cancelled after purchase, but you can either modify, exchange or sell the RI. This also depends on the RI offering class you choose;
Standard RIs offer a bigger discount but cannot be exchanged. Convertible RIs have a smaller discount but can be exchanged for different instance types.

Spot instance
Again, in simplest terms, spot instances are unused EC2 instances that can be purchased with a higher discount (up to 90%) of the on-demand instance prize.
Although this perk comes with its pros and cons.
When you request for a spot instance, a spot instance request is made. This request basically checks if your bid prize matches the spot prize of an unused instance in the AZ and region. When a capacity is available, your request is fulfilled.

Spot prize refers to the prize of the unused EC2 instance which also fluctuates according to the demand and supply of spot instances in that AZ and region.

What are the pros of purchasing a spot instance?
πŸ‘‰ It is very cost-effective than on-demand prizing allowing you to save more money on your computing resources.
πŸ‘‰ Very suitable for fault tolerant deployments that are stateless and can easily be restarted.
The cons?
πŸ‘‰ Spot instances can be terminated after a two minutes interruption notice if the spot prize for that instance exceeds your bid prize.
πŸ‘‰ The prize spot of an instance is unpredictable making it a challenge to budget your computing costs
πŸ‘‰ Spot instances requires additional planning and management to ensure that your deployment can handle interruptions. Which involves plugging into the EC2 instance rebalance recommendation feature. This feature can be accessed from the instance metadata service or amazon eventbridge notification. With this feature, your application is notified if it's at an elevated risk of being terminated, an interruption notice is sent sooner than 2 minutes before it is terminated.

Dedicated hosts
According to the aws guide, "An Amazon EC2 Dedicated Host is a physical server that is fully dedicated for your use."
To illustrate this, its like renting out a whole restaurant for just your party.Β 
With dedicated hosts, you have full control over the entire physical server.
You may ask "why will I need a dedicated host if I can also achieve the same isolation using dedicated vpc tenants". Unlike dedicated vpc tenants, dedicated hosts allows you toΒ 
πŸ‘‰ Use your software licenses (Bring Your Own License (BYOL)), ensuring compliance
πŸ‘‰ Share your instance capacity with other accounts and more

But before you consider using dedicated hosts, here is a list of restrictions associated with dedicated hosts

Dedicated instances
Basically, a dedicated Instance is an EC2 instance that runs on a hardware that's dedicated to a single AWS account. Using dedicated Instance, you loose the benefits of launching your EC2 instances on the same host.Β 


Now we understand the various instance pricing options, lets quickly recap the use cases of these pricing options to help you make better decisions when launching your next instance.


On-demand instance πŸ‘Œ Suitable for unpredictable workloads that will be used within a short timeframeΒ 
Reserved instances πŸ‘Œ Suitable for workloads with steady and predictable traffic over a long period
Spot instances πŸ‘Œ Suitable for fault-tolerant workloads or batch processing jobs that can be stopped without loss of state or data
Dedicated hosts πŸ‘Œ Suitable for compliance requirements that mandates physical isolation of instances, full control over instance placement and visibility of sockets, cores, and host ID
Dedicated instancesπŸ‘Œ Suitable for compliance requirements where visibility and control over instance placement is not required.


We draw the curtain here. I hope you found this post informative and helpful, thank you for staying till the end.
What instance pricing option are you choosing for your next EC2 deployment and why? Let me know in the comments.

Top comments (0)