AWS cost calculations

From Notes_Wiki

Home > Amazon web services > AWS cost calculations

For different type of AWS services cost calculations are explained below:

EC2 instance cost

To calculate AWS costs for Elastic Compute Cloud (EC2) the steps are:

  1. 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
  2. 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.
  3. After determining instance type, region and OS have a look at on-deman pricing at https://aws.amazon.com/ec2/pricing/on-demand/
  4. 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.


Data transfer cost

There is cost involved in data transfer from AWS. Typically sending data to AWS DC (Uploading to cloud) is free. However while downloading data from cloud there are charges. Also typically data transfer within same AZ is free. However for data transfer from one AZ to another in the same region, there can be some charge. There is definitely charge for data transfer from one region to another.

For data transfer costs on same page https://aws.amazon.com/ec2/pricing/on-demand/ use the left side menu to go to Data transfer cost section.


Elastic IP cost

Note that elastic IPs are free if used. However, there is charge for reserving IP and not using it. For charges of unused elastic IPs on the same page ( https://aws.amazon.com/ec2/pricing/on-demand/ ) go to Elastic IPs section.



EBS storage cost

For most VMs along with EC2 instance there would also be persistent EBS (Elastic Block Store) for which pricing is available at https://aws.amazon.com/ebs/pricing/

Note that EBS pricing is per GB/month. Hence if you create 1GB disk and use it for entire month, then you can multiply it by per GB/month cost mentioned for the type of storage (eg gp2) used.

Example consider use of 300GB disk created only for 10 days (1/3 month). In that we should get monthly cost by: 300 * 0.33 * <GB/month cost of storage>. For example if gp2 is charged at $0.10 GB/month. Then 10 days of 300GB gp2 disk will cost = 300 * 0.33 * 0.10 ~= 9.9$ for that month.


EBS Snapshot cost

EBS Snapshot cost is same irrespective of the original EBS storage type. EBS Snapshot cost is also available on same page as EBS storage cost. Also note that EBS Snapshot cost is only for diff storage / Changed blocks and not for entire disk.



RDS Costs

For RDS cost apart from region, instance type, Database (MySQL, postgreSQL, etc.), also note that there are single A-Z and multi A-Z deployments. Multi A-Z deployments allow for very high availability but at a increased per instance cost. For RDS costs refer https://aws.amazon.com/rds/pricing/

If you go to a particular DB cost page (Eg for postgreSQL visit https://aws.amazon.com/rds/postgresql/pricing/ ) then you can see option to select region, Single A-Z vs. Multi A-Z and then for each instance type per-hour cost is listed.

On the database page at left side there are options to go to cost for:

  • Reserved DB instances
  • DB storage cost
  • DB backup storage - 100% of DB space is available for free for backups. That is if your DB size is 50GB then 50GB of backup space is free with DB storage
    Once DB is removed but the backups are still there, then there is cost for such backups which is listed on the DB backup storage page
  • Data transfer cost for RDS
    In case of data transfer between EC2 and RDS, only incoming data charge for EC2 is applied, outgoing data charge from RDS is not applied.


AWS cost calculator

Once you understand basics of costing as explained above, for quick calculations you can refer to:

Old AWS pricing calculator
https://calculator.s3.amazonaws.com/index.html
New AWS pricing calculator
https://calculator.aws/#/


Home > Amazon web services > AWS cost calculations