DEV Community

Animesh Bhadra 🎯
Animesh Bhadra 🎯

Posted on • Originally published at archerimagine.com on

Save 72% of AWS EC2 cost with these pricing and tenancy options.

AWS Made Easy | AWS EC2 | Pricing and Tenancy

Introduction

AWS as we know is pay as you go model. We pay for the amount of computing services we use. It is very good when we have limited requirement to compute. In a production environment, we need ways to reduce this cost. Pay as you go model does not always work in a production system. AWS provides 5 different pricing options for AWS EC2.

  • On-Demand
  • Savings Plans
  • Reserved Instance
  • Spot Instance.

You might be thinking where is the 5th? The 5th is called a Dedicated Host. You can run your above instance except Spot instance on these dedicated host. Dedicated Host is not actually a pricing model, but more of a Tenancy option.

You might already be getting confused. You had come to read this blog for saving some cost on your EC2 bills, but the different pricing and tenancy option is making it more confusing.

Do not worry, we will peel each layer of this pricing onion and figure out the best pricing solution for your requirement. Just to know a rough hierarchy if you are not interested in reading the whole blog.

  1. On Demand pricing is the default and the costliest option.
  2. Spot Instance is the cheapest option, almost 90% cheaper, but not suitable for production, dedicated instance requirement.
  3. Reserved Instance and Savings Plans provide the maximum costing benefits if you commit to a certain period of usage.
  4. Dedicated host is mostly used when you have existing licenses which you want to use on the cloud.

If you the above 4 lines have solved your initial pricing problem than thanks for reading. If you still have the patience to read more about the different pricing options and how it can save your cost by 72% compared to an on demand pricing read along.

AWS EC2 Pricing

You are already aware of the 5 different pricing options of AWS. There is also a free tier, which gives 750 hours of t2.micro on Linux or windows. This is a great way to test the water in the cloud world.

AWS EC2 pricing is also impacted by the amount of use an individual has on the cloud. There is no meaning of 72% reduced cost if you are learning AWS, and free tier will full fill your requirement. Let us first divide the type of user who will need these different options to save cost.

  • Hobby User.
    • These users are like us, learning or trying AWS to see the services. These users should be happy with the free tier.
  • Amateur User
    • These users are the intermediate user, who have graduated from the free tier. These users can use a lot of the services on AWS and can also have little complicated requirements.
    • These users can mostly run On Demand EC2 instance.
  • Professional
    • The professional is the real users of AWS, which includes companies, small start-up etc.
    • These are people whose business rely on AWS.
    • These people often need 2-3 types of AWS environment.
    • Development - This is the AWS account which developer uses to develop the application.
    • Staging - This is the AWS account which is almost similar to production environment, but lower scale.
    • Production - The real user facing application runs on Production system.

You can understand with the above classification that AWS EC2 pricing impacts the 3rd type of user. If you fall into the first two categories the choice is pretty simple.

Now let's solve the pricing problem of the Professionals and also give insight to the Amateur User on On Demand pricing.

AWS EC2 On Demand Pricing

On-demand pricing is the default pricing model in AWS. This is the most easiest pricing model. You pay for the duration you use the EC2 instance. This is just like paying our electricity bills every month. The usage is broken into seconds.

On Demand pricing includes the cost of running AMIs on the EC2 instance. The lowest priced EC2 instance is t4g.nano with 1 vCPU, with On-Demand hourly rate at $0.0042. The max priced Ec2 instance is u-6tb1.112xlarge with 448 vCPUs, and On-Demand hourly rate of $54.60.

The usage duration is calculated between the time of termination or Stopping the instance. The partial hours are charged on per second basis, else charge on the full hourly basis.

Kindly remember the data transfer in and out of the AWS EC2 instance is also charged.

You might be thinking that there is no choice in AWS On-Demand pricing. There is no way to reduce the cost. There is one way. Generally the AWS Graviton is cheaper than the Intel Based EC2 and even the AMD based EC2 is cheaper than them. Pair a Linux AMI on these AWS Graviton or AMD based EC2 instance and you get you a significant cost savings.

If you use a m6g.large, which is an AWS Graviton based EC2 instance, you are charged $0.077. If you use a m6i.large in its place which is charged $0.096 per hour. This is 24% more.

What is an advantage of using the aws on-demand pricing model?

The major advantage of using AWS On-Demand pricing are these.

  • Off the shelf pricing, you do not have to use a lot of brain to figure out which is best for you.
  • Highly flexible, it ranges from $0.0042 to $54.60 hourly.
  • On-Demand pricing is the reason we have cloud computing today.

AWS EC2 Spot instance Pricing

You have seen the default pricing option on AWS. The AWS EC2 spot instance is another pricing model which will suit an individual developer the most. These Instances are available at 90% discount to On Demand pricing.

You might be already thinking, what is the gotcha for this drastically reduced pricing. There is no gotcha for this pricing. AWS has already dedicated data centers with huge computing power siting idle if not used. It is using EC2 Spot pricing to get some revenue of from idle instance.

Think of AWS EC2 Spot instance, as an End of Season Sale. You can use all the instances, with all the configurations of On demand, but at a 90 % lower price.

Little things might be bothering you right now, let's try to answer those questions.

What is the disadvantage of using an EC2 Spot instance?

There is no disadvantage, just remember that when AWS needs this capacity back, it will give a 2 minutes notice to wind up the current work being performed on the instances.

When would you use Spot Instances?

If you have a highly containerized application which can handle the 2 minutes notice for taking away the compute capacity, then you can use AWS EC2 Spot instance for production grade application.

Generally AWS EC2 Spot instance is used when you need more compute capacity, but at a lower price. These instances are very good for non mission critical application.

How can we save data for use once we lose the current pool of AWS EC2 spot instance?

We can just hibernate the AWS EC2 Spot instance and it will save the local data on the EC2 instance. Once the pricing or the capacity for AWS EC2 Spot instance is available, we can reactivate these hibernated instances.

How do you tell if an instance is a spot instance?

We can find the type of instance by selecting the Show/Hide Column on the AWS EC2 instance dashboard. Then we need to select the lifestyle option.

AWS Made Easy | AWS EC2 | Enable EC2 Spot instance

You should note that, once an AWS EC2 spot instance is available, there is not difference between it and an On demand instance. We can have all the ASG (Auto Scaling Groups) for these instances.

We can create an AWS EC2 instance, in two ways, the first is by selecting the below step AWS EC2 instance creation process.

  • Select the check box for requesting Spot instance.
  • Provide the maximum price you are willing to pay for a Spot Instance.
  • Lastly, mention if the request is persistent or not, if it is a persistent request, it will keep on trying to create the spot instance even after the request is full filled.

AWS Made Easy | AWS EC2 | Pricing and Tenancy

You can also check the current pricing of the AWS EC2 Spot instance here. As shown in the screen shot below.

AWS Made Easy | AWS EC2 | Spot Pricing

You have now understood of two pricing mode, OnDemand and Spot instance, the issue is OnDemand is the instance you can rely on but Spot instance is something where you can run your non mission critical workloads. These workloads can survive a termination of the instance.

Though you can save 90% of the cost by using AWS EC2 Spot Instance, it may not be a perfect solution for mission critical jobs. Lets show you other pricing option which will save you cost for mission critical application.

AWS EC2 Savings Plans Pricing

You have learned about 2 flexible AWS pricing option, On demand and Spot. AWS provides deep discounts if you commit to a regular usage of compute power for a predefined usage period. There are two pricing options in this.

  • Savings Plans
  • Reserved Instance

Savings Plans is a newer edition of Reserved Instance so first learn this. We won't have any additional baggage of learning reserved instance. We can just learn what is the use of Reserved Instance. Saving Plans provide almost the same savings as reserved instance with an additional benefit of flexibility.

The flexibility offered by Savings plans is based on

  • Instance Family
  • Instance Size
  • Tenancy
  • or Region.

In savings plans you have to commit to a usage of predefined compute power, calculated on $/per hour basis for a fixed duration of 1 or 3 years.

Savings plans also offer you the option of paying in 3 modes.

  • All Upfront
  • Partial Upfront
  • No Upfront.

There are three AWS Savings Plan type.

  • Compute pricing plans
    • This plan provides the best flexibility in terms of the variation of instance, size, tenancy and movement of the region.
    • As it provides such flexibility the saving on this pricing plan is less, just 66% in place of the 72% promised.
    • You can also migrate between fargate and lambda.
    • This the best plan if you need all the flexibility.
  • EC2 Instance saving Plans
    • If you are sure to restrict yourself to a type of instance, say M5 or C4 in a particular region.
    • These provide the best savings of 72% in the savings plans.
    • We can change the size of the instance from .xlarge to .2xlarge.
    • We can even choose the different OS on these EC2 instance.
    • We can change the tenancy from Host to, dedicated to, default.
  • SageMaker saving plans
    • This plan offers 64% savings.
    • This plan is applicable to all SageMaker Instance and provide all the flexibility of the Compute Pricing Plans.

Irrespective of which savings plans, you take, a few things you should always keep in mind.

  • Saving Plans do not provide capacity reservation.
  • Saving Plans provide discounted pricing based on the On Demand pricing, so we cannot cancel the request.

You can choose a savings plan by searching for "Saving Plans" in AWS console, and you will get a screen like below. Choose the type of plan you want as described earlier. You also need to select the term of 1 year or 3 years.

AWS Made Easy | AWS EC2 | Saving Plan 01

Once you select the Type of plan and the term, next is to choose the hourly pricing. You can take help of the AWS Cost Explorer. The AWS Cost Explorer will check for your existing usage and suggest an appropriate plan to purchase.

Next just select the payment option mentioned earlier. Choose a start date and done.

AWS Made Easy | AWS EC2 | Saving Plan 01

Can you sell AWS savings plans?

You cannot resell the AWS Savings plans like the Reserved Instance had a marketplace.

Can you cancel AWS savings plan?

Once purchased, you cannot cancel the AWS Savings plans.

You are now aware of AWS Savings Plans, which is also called Reserved Instance 2.0 or (RI 2.0). Now let take a step back and learn about the Reserved Instance.

AWS EC2 Reserved Instance Pricing

You have already learned about Savings Plans which is an improvement over Reserved Instances. You might be wondering what was in reserve instance, that led to creating savings plans. Reserved Instance and Savings plans looks almost the same.

You might still be wondering, will reserved instance exists down the like as savings plans are flexible. Let's try to find some of those answers and in the process learn about reserving instance.

The first thing to note is when you say reserved instance, it does not mean a physical instance reserved for you in AWS. It's just a terminology for a billing discount. This discount is applied to the On Demand prices.

The reserved pricing also based on 3 factors.

The first one and the very obvious one being instance type. You have to choose the same 4 attributes for an instance you chose in the savings plan.

  • Instance Type - m4.large, You have to select both instance family type and the size of the instance.
  • Region - Obviously, you have to tell the region where the instance would be needed, as EC2 is a regional service.
  • Tenancy - If you want to run it on the shared tenancy model or already have any dedicated instance.
  • Platform - Unix or Window.

The above choice is almost similar to the EC2 Instance saving Plans, the difference being, we selected the family of instance there, and the size of instances could be changed.

Once you are ready with your instance type, the next selection you have to do is for the Term commitment. There are same 2 choice like EC2 Instance saving Plans. The bigger the commitment you give, the bigger is the savings.

  • One - year
  • Three - year

The thing to note here is, the term does not get renewed automatically, we have to renew it else it will be charged on the on-demand rates once the term ends.

There are similar payment option like EC2 Instance saving Plans, and the names are self explanatory, The more you pay upfront the more you save.

  • All Upfront
  • Partial Upfront
  • No Upfront - You are required to have a billing history before you opt for this option.

The reserved instance also provides some flexibility depending on something called an offering class.

  • Standard
    • It allows some attributes of the instance to be modified.
    • These instances can't be exchanged.
    • It can be bought and sold in a Reserved instance marketplace.
  • Convertible
    • It also allows some instance attributes to be modified.
    • These instances can be exchanged.
    • It cannot be bought and sold in the marketplace.

You cannot cancel your purchase of Reserved Instances. Though depending on the type of offering class you have chosen, you can modify, exchange or sell the reserved instance.

There are also two different types of Reserved instance, you can purchase.

  • Regional Reserved Instance
    • This does not provide capacity reservation.
  • Zonal Reserved Instance
    • These provide capacity reservation on an Availability Zone.

Here is a snapshot to depict the type of savings you can get based on the reserved instance.

AWS Made Easy | AWS EC2 | Reserved Instance

Can I cancel AWS Reserved Instance?

You cannot cancel your AWS Reserved Instance once you have purchased it. You can modify the instance, or trade them in the reserved instance market place.

You have learned about the Reserved Instance, and also learned that there is a capacity reservation in case of Zonal Reserved Instances, let us see how this capacity reservation helps us.

Can we reserve capacity when using Regional reserved instance, or AWS EC2 Savings Plans. These 2 does not offer any capacity reservation.

AWS EC2 Capacity Reservation

You have Zonal Capacity Reservation, which reserves capacity in a particular Availability Zone. This reservation provides a type of peace of mind, knowing that you can launch an EC2 instance at any given moment during high traffic as there is reservation.

AWS EC2 Savings plans and Regional Reserved Instance do not have this option, we can enable this by creating an independent capacity reservation. When you create a capacity reservation, you have to specify,

  • The Availability Zone (AZs) in which the capacity will be reserved.
  • The Number of instance
  • Instance attributes, like tenancy, instance type etc.

Please note that the capacity reservation will only be applicable only when you have the above matching instance running. If there is a mismatch the above capacity reservation will not be applied.

You have learned about all the pricing options available for an AWS instance, be it the default On Demand pricing, or highly discounted Spot instance used for non productive work, and immensely save cost using reserved instance or savings plans (RI 2.0).

There is also another factor for AWS instance, i.e. the tenancy, the physical host on which you run the AWS EC2 instance.

You cannot run an AWS EC2 instance, in a shared mode, which is the default because of compliance with laws in any case and in some case because of efficiency. Let's dive into the world of AWS EC2 tenancy.

AWS EC2 Tenancy

You can see in the below snapshot, that there are 3 types of tenancy available.

AWS Made Easy | AWS EC2 | Pricing and Tenancy

  • Shared Tenancy
  • Dedicated Instance
  • Dedicated Host

Tenancy is just like we rent a house when we move to a new city. How we move between houses is what is called tenancy.

AWS EC2 Shared Host

Share Host or Tenancy, it is more like few friend rents 2 or more houses in the city. The rent of the house is being paid, but which individual stays in which house is not predictable.

You can live in one house, but for a party, you can to the other house, if you sleep there, you will wake up in the same house, but if you leave the house there is an option you can land it either of the two houses.

The same is the case with AWS EC2 instance, when in the shared tenancy mode, the AWS EC2 instance can be launched on any physical machine. In case of reboot only the host will remain same else when you start or stop the instance can switch to a new host or physical machine.

AWS EC2 Dedicated Instance

The next one is a dedicated instance, it is more like a township of a big factory in a remote place. The township is created by the factory as people who work in the factory has to live.

You can live in one house in the township created by the factory and then in few years move to a bigger or a better house in the same township as you may seem suitable.

AWS EC2 dedicated instance is also a lot similar, when an instance is launched in this mode, AWS makes sure that it launches this instance, in the same physical host which has another instance of the same AWS Account.

When you stop and restart the instance it may not start the instance on the same instance, but it will make sure it starts the instance on a physical host where only your account instance are running.

_When would you use a dedicated instance?_Compliance is a big reason why you would want to launch a dedicated instance.

AWS EC2 Dedicated Host

When you are more stable in your life, with family, you need a house which you do not have to change. This is where you buy your own house.

The AWS EC2 dedicated host is also similar. A lot of time, especially in Banks and other financial organization they need surety that the application is running on a server which is physically separated from the other.

In addition to the compliance issue, there is also the case of software licenses, some costly licenses are per machine basis, if you have a physical server with AWS running only your instance, then you can move your licenses to these servers.

You can create your own dedicated host by selecting the proper option in the below snapshot. This we will discuss in details later.

AWS Made Easy | AWS EC2 | Dedicated Host AWS Made Easy | AWS EC2 | Dedicated Host

  • What are the three main reasons for using a dedicated host?* The main reason for using dedicated host is compliance. Software licenses bought per machine basis is also a reason for this.

_What happens if the physical host we are using goes down?_If failure is detected on the physical host then AWS runs something called a Host recovery, which will basically recreate the same host instance setting. You can also use the AWS licenses Manager to migrate the licenses to this new machine.

Comparison

Regional Vs Zonal Reserved Instance

Regional Reserved Instance Zonal Reserved Instance
Does not provide any capacity reservation. Provides capacity reservation in a specific Availability Zone.
Reserved instance discount applies to any instance running in the region. The discount is only specific to a Availability Zone
It provides flexibility in the same instance class, you can change the size of the instance. It is very specific to the instance type and its corresponding size.
The purchase can be queued. The purchase cannot be queued.
The limit of regional reserved instance to be launched is equal to the limit of the EC2 instance that can be launched in the region. This provides addition limit from the regional limits.
This is just a billing discount. Capacity reservation comes paired withe the discount.
Additional capacity reservation can be taken to make it more flexible. No additional flexibility can be taken.

AWS Made Easy | AWS EC2 | Regional Vs Zonal RIs

Standard Vs Convertible Reserved Instance

Standard Reserved Instance Convertible Reserved Instance
You can modify only the Availability Zone, Scope, Networking Type and instance Size. You can modify the instance family, OS, and tenancy in addition.
It cannot be exchanged. It can be exchanged as long as the new instance is also convertible of higher or same pricing.
It can be bought and sold in the reserved instance marketplace. It cannot be bought and sold in the reserved instance marketplace.
It provides the limited flexibility in configuration changes. It provides the maximum flexibility in configuration changes.
Limited flexibility, hence highest discount. Maximum Flexibility, hence limited discount

AWS Made Easy | AWS EC2 | Standard Vs Convertible

Compute Vs EC2 Savings Plans

Compute Savings Plans EC2 Savings Plans
Provides the maximum flexibility. Provides the minimum flexibility.
Provides the minimum discount. Provides the maximum discount.
Discount can go up to 66%. Discount can go up to 72%
Flexible across Instance family, AWS ECS, EKS using Fargate and even Lambda. Flexible only across the instance size.
Can be compared to Convertible Reserved Instance. Can be compared to Standard Reserved Instance.

AWS Made Easy | AWS EC2 | Compute Vs EC2 Savings Plans

Compute Savings Plans Vs Convertible Reserved Instance

Compute Savings Plans Convertible Savings Plans
66% discount 66% discount
Does not provide capacity reservation. Does not provide capacity reservation.
Same term or 1 or 3 years. Same term or 1 or 3 years.
Applies the pricing discount automatically across instance family, tenancy or OS. The benefits needs to be manually applied. across instance family, tenancy or OS.
Flexible across region. Not flexible across region.

AWS Made Easy | AWS EC2 | Compute Savings Vs Convertible RIs

EC2 Savings Plans Vs Standard Reserved Instance

EC2 Savings Plans Standard Savings Plans
72% discount 72% discount
Does not provide capacity reservation. Does not provide capacity reservation.
Same term or 1 or 3 years. Same term or 1 or 3 years.
Applies the pricing discount automatically across instance size, tenancy or OS. The benefits needs to be manually applied. across instance size, tenancy or OS.

AWS Made Easy | AWS EC2 | EC2 Savings Vs Standard RIs

AWS Reserved Instances vs Savings Plan

Savings Plans Reserved Instances
66% to 72% discount 66% to 72% discount
Discount is provided on On-Demand price based on the spending commitment. Discount is provided on On-Demand price based on the utilisation commitment.
ECS, Fargate & Lambda are also covered in this discount. None of these services are covered in RIs.
RDS instance are not covered under the Savings plans RDS instance are covered under RIs
There is no marketplace for Savings Plans There is a marketplace for Reserved Instance.
There is no capacity reservation. There is a capacity reservation in Zonal RIs.

AWS Made Easy | AWS EC2 | Savings Plans Vs Reserved Instance

AWS Dedicated Instances vs Dedicated Host

Dedicated Instances Dedicated Host
The Instance is not guaranteed to launch on same host. The complete Host is dedicated.
The instance is always launched on host where same account instance are running. The instance is always running on the same host.
You cannot use license which is per machine basis. You can use license which are per machine basis.
It can be of any instance type. The machine is based on instance type, so different size of same instance type can be launched.
There is no compute power wastage. If the completed compute power of the host is not used, then the wastage is your responsibility.

AWS Made Easy | AWS EC2 | Dedicated Instance Vs Dedicated Host

Conclusion

AWS Pricing and tenancy is little confusing. There are just too many terms to go over. Let's keep it simple, Tenancy mean who owns the actual resources. Pricing means the discount provided for better commitment.

You should understand that in AWS Pricing options, except EC2 on-demand pricing and spot instance, the other two are just discount on the bill over the on-demand price.

On-demand is the default pricing options, and it is the costliest option. This can be used for production environment.

AWS Spot instance, are the unused instance, which AWS sells at a cheap discount. These are good for non productive work. AWS gives a 2 minute window to wind up the current activity on the instance before reclaiming.

Now coming to the discount schemes, both Reserved Instance and Savings Plans provide somewhere up to 66% to 72% discount over on-demand prices. This discount is based on commitment from us, to make use of the compute power for certain predefined duration, or agreeing to pay a certain amount per hour for using the same instance.

Savings plans are the newer version of discount pricing. It gives a better discount when you commit to a pay per hour a certain amount for compute usage. It also extends beyond just EC2 instance to AWS Fargate, ECS and AWS Lambda.

There is a one plan which is very flexible, Compute Savings Plans, this provide lots of choice in instance family, size, tenancy, etc.As this is a flexible option it provides limited savings.

If you are okay with a particular type of EC2 instance in a particular region, then EC2 Savings plans are a great plan, which can save you up to 72% from on-demand prices.

Savings plans are still not applicable to AWS RDS.

The last pricing option to discuss is the AWS Reserved Instances. This pricing option lowers the bill if we commit to a certain type or EC2 instance for a certain duration of time. The Reserved instance comes in 2 form like Savings Plans, Standard and convertible.

The difference between these 2 is that, the provide what degree of flexibility. More flexibility means less discount.

AWS has there type of tenancy. Shared, Dedicated Instance, and dedicated host.

Shared is the default tenancy mode, where an instance can come up on any number of physical hosts, with instance from other account also present on the same server.

Dedicated Instance means that the instance will only be launched in a physical server where it is already running the instance from the same account.

Dedicated hosting, means that the completed physical server is owned by you. You have to just books an instance type. Per software licenses loves such server.

Now the idea of AWS EC2 tenancy and pricing might be clear. If you want to launch an EC2 instance. Checkout, the free tier EC2 instance launch article. see Step by Step guide to create an EC2 instance.

Reference

Top comments (0)