DEV Community

[Comment from a deleted post]
Collapse
 
andrewbrown profile image
Andrew Brown 🇨🇦

Calculating Monthly Server Cost

The Most common question I get asked. So there is roughly 730 hours in a month, so you grab the pricing per hour from the On-Demand Pricing Page

So if you want t2.medium than expect to pay

0.0464 * 730 = 33.87 USD

Instances Always Double in Size

When should you upgrade to the next instance size? It easy. t2.large is double the size of t2.medium and t2.xlarge is double the size of t2.large

A good way to save money is to spin up two instance of the smaller type and then use load balancing and auto scaling group (ASG). ASG can spin up the instance only in time of need so you can keep costs low. a load blanacer (ELB) will run you around ~14 USD per month but even if you are running one EC2 instance I consider it a necessary cost for other reasons such as being able to attach WAF, ACM and Guard Duty

Burstable Instances

The T2 line (and probably also T3) has the ability to burst beyond its CPU capacity. So just like a video game where you have a special power where that bar fills up over time, T2 instances accumlate CPU credits over time, so when you go beyond you means with a spike of CPU usage you get more CPU and expend those credits. This allows you to avoid upgrading to a more expensive instance.

Take Spot and RI with a grain of salt

Spot Pricing can save up to 90% and RI (Reserved Instances) can save up to 75% but in practice you don't normally get these rock bottom prices. You do save money but for Spot Pricing its based on the demand of the market and what type of instance you use. You should expect with Spot Pricing more to be around 60-70% than the 90% and RI at 50-60% than 75%.

Collapse
 
karimbk profile image
Karim Belkhiria

Very good explained here :)

Collapse
 
helenanders26 profile image
Helen Anderson • Edited

Thank you Andrew!