AWS cost calculations
<yambe:breadcrumb self="AWS cost calculations">Amazon web services|Amazon web services</yambe:breadcrumb>
AWS cost calculations
EC2 instance cost
To calculate AWS costs for EC2 the steps are:
- Have a look at instance types at https://aws.amazon.com/ec2/instance-types/ and decide which instance makes sense based on nature of workload (Eg Continuous CPU usage / Intermittent CPU usage)
- Note that various M5A / T3A might be cheaper than similar configuration M5/T3 instance due to use of AMD processor
- Do not use T (Burstable) instances when the average CPU requirement is expected to be greater than 20%.
- Have a look at Compute Optimized / Memory optimized options below on the same page for machine with higher ratio of CPU / Memory compared to M/T series instances
- After determining instance vCPU and Memory, determine following things for each instance
- Region where the instance is desired
- Eg Mumbai (ap-south-1) or Oregon (us-west-2).
- Operating system for Instance
- Linux / Windows
- Note that Linux here means CentOS / Ubuntu etc. for RHEL / SLES there are separate options. There are also options for Linux with SQL, Windows with SQL, etc.
- After determining instance type, region and OS have a look at on-deman pricing at https://aws.amazon.com/ec2/pricing/on-demand/
- Once you have on-demand hourly rate the cost for instance can be determined by multipying based on usage. For example for 24x7 usage multiple at least by 24x30 (720) or 24x31 (~745) to get monthly cost for instance.
Reservations
It is possible to optimize on on-demand costs by going for 1-year and 3-year reservations. For that pricing is available at https://aws.amazon.com/ec2/pricing/reserved-instances/pricing/
Here choose:
- Term
- 1 year or 3 year
- Payment
- No upfront, partial upfront or full upfront and get the costing
For cost add have a look at "RI effective hourly rate" column and multiply it by 720 for monthly costs and then further by 12 for approximate yearly costs. The on-demand pricing for comparison and savings over on-demand are listed clearly in the additional columns.
Note that reservation includes instance type, region, duration and OS. We cannot reserve instance in one region (Eg mumbai) and later try to use the reservation in another region (Eg oregon). Similarly reservation of a1.medium for Linux cannot be used for a1.medium windows instances etc.
AWS Savings Plan
If there is issue in choosing reservation as workload characterstics are not known or are too dynamic, then there is option of AWS Savings Plan - https://aws.amazon.com/savingsplans/
In this case the commitment for 1 year or 3 year is not for instance type / region etc. but of minimum amount that would be spent on AWS for the duration (1 year / 3 year). This offers discounts similar to reservation with flexibility of being able to change region, instance type, etc. as long as commitment of minimum monthly spent is met.