Each AWS EC2 instance that you provision requires storage to serve as the primary drive. Like everything else in AWS, your usage of it is measured and can dramatically change the cost of EC2.
Storage costs money
The size of your initial volume varies depending on the type of your server, but you can provision from a few GB to 16 TB per volume. You can provision multiple volumes to attach to a single instance, and you can swap volumes between instances. There is also AWS Elastic File System (EFS), which is a volume that you can share among multiple instances, although it is a separate service from EBS.
Your use of this storage is measured based on the amount you provision (not the amount actually stored), and you will be billed per second of use. This cost is in addition to the cost of the EC2 server itself and can be quite confusing when your bill comes back higher than expected.
The rate in effect for general purpose SSD storage (gp2) is $ 0.10 per GB per month. If you rented a terabyte of storage, you will be charged $ 100 each month. It is measured to the nearest second, so if you only rent the volume for one day, you will be billed $ 3.20 for that day.
For this reason, you should not use EBS to store huge amounts of data; S3 is much cheaper for this use case. EBS is intended to be fast storage positioned very close to the EC2 instance (and even on the device with Instance storage) and is used as the boot volume for EC2 instances.
The different types of EBS volumes
The general purpose SSD (gp2) is the default for new instances. It costs $ 0.10 per GB per month, which is more than four times the price of S3 storage. But, it is a bootable SSD designed for use with EC2, and is much faster than S3 storage.
Provisioned IOPS SSDs (io1) are AWS high performance SSDs. They are designed to reach speeds of up to 1024 MB / s and are offered at an adapted price. The base cost for storage is $ 0.125 per GB per month, which is a 25% increase over gp2. But, you are also billed based on the speed at which you want to access it. If you have to use the entire 1024 MB / s channel, you will have to pay more.
You may not need a provisioned IOPS SSD. You can easily switch a volume between the two levels, so you should first test your application with gp2 to see if it meets your needs. You can use AWS CloudWatch for this test, which will monitor your instance and provide statistics on which to base your purchasing decisions.
The metric you are looking for, in this case, is VolumeQueueLength EBS volume. This measures the number of pending operations that the volume is waiting to perform. If this graph skyrockets, you are probably maximizing your EBS volume and you should consider switching to provisioned IOPS storage.
You can also consult the IOWait of your EC2, which measures the number of processor cycles spent waiting for read or write operations.
If you don’t need speed, you can also use hard disk-based EBS volumes for your instances. You cannot boot from these drives, so you will still need a small gp2 player to serve as the boot drive. There are two volume levels based on the hard drive:
Optimized hard drive (st1): A general purpose hard drive volume, optimized for throughput rather than fast reads and writes. This level costs $ 0.045 per GB per month, less than half the price of gp2.
Cold hard drive (sc1): slower than st1, but cheaper at only $ 0.025 per GB per month.
Whichever type of volume you choose, if you decide to back up the volume using S3 snapshots, you will be charged $ 0.05 per GB per month for S3 data. These are incremental snapshots, which means that each change you make will be stored and no data will be duplicated. But if you change the data on the disk often, over time, the size of the snapshot may become larger than your original volume.
Use the AWS calculator
AWS provides a calculator to determine the amount of your monthly bill based on your usage. You should always use it before provisioning anything to avoid unexpected charges.
Load the calculatorand enter the services you want to provide. The calculator supports most AWS services and totals everything together on a single monthly invoice.
Another useful feature is AWS Cost Explorer. This management panel breaks down your past charges by type and shows you how much AWS really costs you.
You can access this panel hereor from your billing dashboard in the AWS console. In the explorer, you can break down your past costs by service, instance type and region, and see how much everything costs you per month.
AWS provides a simple breakdown of your actual bill each month, but it’s easier to view costs using the Explorer, especially if you use many AWS services.