Cost saving techniques(Basic) - AWS
Tags: ec2, aws, costsavings, instances
Published: 2023-04-11 16:46:14

Hi all,
These are some of the cost savings techniques that I know and want to share with you all. Some of you already know about these. This article will help some of you save some bucks on EC2 instances. 

**Factors we need to consider before selecting an EC2 instance:**

**Instance families:**
In EC2 instances we have different families like

- General purpose
- Compute-optimized
- Memory-optimized
- Storage optimized
- GPU optimized

First, we need to think about what type of task we need to do.

Does the task requires fast computing we'll pick the instance from compute optimized family. 

If the task needs to process a large amount of data quickly then we'll pick an instance from the memory-optimized family.

If the task needs to write high and simultaneous read and write operations to local storage(Basic requires more IOPS) then we can go for storage-optimized family

Like this, based on the use case, we need to pick the instance from the respective family. So that we can put our money to good use.

**Instance Processor:**
We decided from which family we need to pick the instance. Now which processor do we need to use? AWS charges differently based on what type of processor we are using. 

We have **Intel**, **AMD**, and **Graviton** processors available in AWS. AWS owns Graviton. Due to this AWS charges less if you use a Graviton processor. Architecture is different for Graviton but whatever the programs we are running using Intel and AMD processor, Graviton supports those but we need to install some additional dependencies. That's it. We can find those additional dependencies with just a quick internet search

**Instance pricing:**
We have different pricing models available in AWS.

**On-demand instances** which we regularly use. These on-demand instances will come under one pricing model

**Reserved Instances** will be available at some discount  if you give a commitment for 1 or 3 years. If you know about your workload, if it is consistent across all the time, you can request some instances under the reserved pricing model for 1 or 3 years of use. AWS will give some discount on these reserved instances

**Spot instances** will be available at up to a 90% discount on the on-demand prices. Remember up to 90%. It can go anywhere between 0% to 90%. These are instances that are free and not doing any work in the data center. I mean these are the spare instances that are not under use. You have to bid for these instances. If you are the highest bidder you will get the instance. If any person will bid higher than yours it will be allocated to him. But you will have around 2 mins of time to save your ongoing work on the instance. These spot instances will be useful if you have a job that doesn't requires high availability. You can use spot instances for containers, doing jobs, etc.

By using these techniques we can reduce some costs and AWS provides varieties of cost optimization tools to monitor and optimize our costs. Some of them are 

- Cost explorer
- Budgets
- Cloud watch alarms
- Cost and Usage Reports
- Trusted Advisor
- Cost anomaly detection 

By using the above tools you can further reduce costs. 
That's all I have now with me. 

I'll be back with more cost-effective techniques on different AWS services in the future. 

If this article has any issues or requires an edit, please feel free to contact me. Thanks.