Defining the most accurate storage options for your EC2 instance is one of the most crucial issues you will face when provisioning applications in AWS cloud. Successful cloud deployment depends upon choosing the correct instance type and defining proper storage. In this two-blog series, we will review the ins and outs of block storage on AWS. These tips are designed to prevent you from experiencing space shortage and poor performance from your applications.
EBS vs Ephemeral Storage
AWS offers two types of block storage – Instance storage and Elastic Block Store (EBS). Instance storage is directly connected to the host where your EC2 instance is created. This storage is temporary block-level storage, meaning that the data will “survive” as long as your instance is active. Reboots, whether initiated by the user or forced by an application or OS crash, will not harm the data. However, stopping or terminating the instance will simultaneously delete the data making this storage type a poor choice for important data.
Because the cost of instance storage is included in the price of the EC2 instance type you select, it remains an interesting choice for storing non-essential data. Your EC2 instance type also determines the size of the storage you are allotted—the more powerful the instance, the more designated storage—so consider this information when selecting the instance itself. Elastic Block Store volumes persist separately from EC2 instances and can be attached and detached at any time. When mounted, EBS can be used as any other raw block storage; you can use it to boot operating systems or as a secondary drive to store your data.
The possibility of creating automated EBS snapshots and cloning volumes, as well as Amazon’s promise of 99.999% availability makes EBS the perfect solution in any scenario. Redundancy is achieved by keeping synced copies of your EBS volumes in the same Availability Zone where you launch your EC2 instance. EBS volumes also support encryption of data at rest using keys you create/import through Amazon Key Management Service (KMS), or you can let Amazon create and store keys for you.
EBS volume types
EBS volumes are divided into two main categories: SSD-backed volumes and HDD-backed volumes. SSD-backed volumes are designed to perform many small read/write operations. The main criteria associated with this volume type is IOPS (input/output operations per second). Throughput (measured with MiB/s) is more important with HDD-backed volumes, which are perfect for large sequential workloads.
Solid State Drives
SSD-backed volumes are further divided into two subsets, General Purpose SSD (gp2) and Provisioned IOPS SSD (io1) General Purpose SSD (gp2) is the golden mean between price and performance. Baseline performance is tied to volume size: with every GB of gp2 volume you provision, you will “receive” 3 IOPS. Burstable performance of gp2 SSD volumes is available and achieved through credits, which you accumulate over the running time of your EC2 instance, up to the maximum of 3000 IOPS. When the credits are depleted, the gp2 volume will revert to its initial baseline performance.
You can provision gp2 volumes up to 16 TiB in size, but they cannot be smaller than 1 GiB. Provisioned IOPS SSD (io1) volumes support high-performance requirements, with a maximum of 20,000 IOPS. Besides size, when you provision io1 volumes, you choose the desired IOPS value, with a maximum of 50:1 IOPS to size ratio (at least 2:1 is recommended). The minimum size of an io1 volume is 4 GiB, while the maximum is the same as with gp2 volumes. This volume type also comes with SLA of 99.9% for performance throughout the year, and AWS guarantees that the maximum performance drop will not be higher than 10%.
Hard Disk Drives
HDD-backed volumes also have two subgroups, which are Throughput Optimized HDD (st1) and Cold HDD (sc1) volumes. Cold HDD (sc1) is cheap magnetic storage, with sizes starting at 500 GiB and going up to 16 TB, with throughput capped at 250 MiB/s. For increased performance, sc1 uses a similar credit model as SSD gp2, but sc1 accumulates MiB/s over time instead of IOPS. Throughput Optimized HDD (st1) volumes support maximum throughput that can go up to 500 MiB/s. Size range is the same as with sc1 volumes, and these two HDD-backed types share the same model for burstable performance. However, this more expensive volume offers increased performance. While a sc1 volume will accumulate credits at 12 MiB/s, st1 will achieve this more than three times faster, at 40 MiB/s, and up to a maximum of 1 TiB/s in credits, which is more than 30 minutes of the workload with the highest throughput.
AWS’s EBS block storage does seem like the perfect choice for all of your EC2 instances. But when should you use SSD, and when should you opt for HDD-backed volumes? Stay tuned for the second part of this blog, when we will go into detail and describe real life scenarios for both EBS types.