While assembling a PC from scratch, we connect various components to build a working machine. One of the components we add for storage is SSD/HDD. AWS Elastic Block Store is the same for virtual machines/EC2 instances. Think of this as a removable hard disk for VMs.
AWS EBS provides a way to add additional storage to existing EC2 instances. EBS is a block store and they come in various forms and shapes. By default, they are unformatted block stores that can be attached to any EC2 instance as additional and persistent storage.
EC2 instances have their storage available, however, the instance storage is not persistent. When an instance is terminated, the storage is lost as well. The lifecycle of EBS is not dependent on the EC2 instance they are attached to. Data stored in EBS can still be reused with another EC2 instance.
It is possible to take a snapshot of EBS volumes. EBS snapshots are point-in-time backups of EBS volumes. In situations where new EC2 instances are to be created based on existing EBS, these snapshots are used. Decoupling EC2 instances like this can prove to be of great importance as data is not lost.
EC2 instances can use EBS volumes to store data like files, logs, and databases. Incremental snapshots enable the backing up of data incrementally. When an incremental snapshot is enabled, the first snapshot takes the backup of the entire database. Following the snapshot, events add the additional data created in the EBS volumes instead of creating a backup of the entire file.
We can also enable encryption on the EBS volume. When an encrypted volume is created, the encryption is handled by AWS in the backend. However, to support encryption we can either use the default key or we need to use AWS KMS (Key Management Service) to create encrypted volumes.
Any new volume which will be created using a snapshot of encrypted EBS volume will automatically create a new encrypted volume. This is true for unencrypted snapshots as well. We also have options to encrypt the volumes while creating copies of EBS volumes.
EBS are evaluated based on below performance metrics, which also affect the pricing aspect:
- Volume size
The main characteristics are IOPS and throughput which depend on the type of EBS volume selected. IOPS is input-output operations performed per second and throughput is the amount of data read/written per second. These measurements look similar but the way they are measured is different. Every IOPS transaction does not exceed more than 16 KB of data. Whereas throughput calculates the amount of data in the given time (second).
Broadly, EBS volumes can be classified into 3 types – SSD, HDD, and previous generations. Previous generation volumes represent the magnetic storage type with lower performance metrics and are generally discouraged from use. The below list represents the main types we may deal with when working with EBS.
- General Purpose SSD (gp2 and gp3)
- Provisioned IOPS SSD (io1 and io2)
- Throughput Optimized HDD (st1)
- Cold HDD (sc1)
Which type of volume to use depends on what is the purpose. The selection of volumes is a really good question to ask. In general, SSDs are used for the transactional processing of data. Cases where there are a lot of input-output operations happening, low latency is required and throughput demand is high – form good examples of using SSD. HDDs on the other hand are a good candidate for streaming data for data warehousing purposes.