AWS Storage Services - EBS
What is that?
EBS - Elastic Block Store is a service that provides the persistent block storage.
EBS volumes are presented over network and used by EC2 instances.
As always every service in AWS can run separately from each other.
So EBS volumes can be used with EC2 instances or you can keep them after termination of an EC2 instance. That means volumes are persistent and can be attached / detached from EC2 instances.
Durability Concern
- EBS volumes are replicated across multiple servers managed by AWS in a single AZ to prevent data loss.
- In addition to that you can increase the durability of the volume by taking snapshot. The snapshots are stored in S3 Buckets within a region. It allows us to store the data for long-term by storing the snapshots in bucket.
- You can create point-in-time and incremental snapshots from volumes.
The incremental snapshots are quickest method. They are storage friendly because they don't need to store unchanged data again and again. - AWS incremental snapshot is more powerful than traditional snapshot. It doesn't need to all incremental snapshots to recreate volume. If the one snapshot is missed, you will lose the data in the snapshot.
What is the ability of?
- You can format the EBS volume with a filesystem. Therefore, you can mount multiple EBS volumes to instance.
But be noticed that you can mount the EBS volume to only one instance.
If you want to mount single filesystem to multiple instances then you should utilize the EFS - Elastic File System service. - EBS also provides to create new volumes from the snapshots. It provides us to create the volume in another AZ for disaster recovery purposes or launching the same instance.
The Important Note: While creating a new EBS volume from the snapshot, it needs to copy all content from the S3 to the EBS volume where in the AZ.
The copy process keeps working in background, while showing the volume is created. Please be noticed to do that in production.
Make sure the all content is present in EBS volume, to avoid the performance issues. To speed up the process, try to access mount points in filesystem. By doing that EBS gives priority to get data from S3.
EBS Volume Types
The size of EBS volumes can be range from 1 GiB to 16 TiB. It depends to the volume type. Each volume type has dominant performance attribute.
Dominant performance attribute of SSD is IOPS and HDD is Throughput.
Storage Performance Measurement
IOPS: Number of input/output operations in a second
Throughput: Data rate, expressed in megabytes per second
[Block size of operation] multiple [Number of operations]
256 KB * 400 = 100 MB per second throughput
You should select the appropriate volume type according to your workload.
Does your workload demand IOPS or throughput?
gp2 - General Purpose
- It offers general purpose SSD volumes. Default type. Also there is a new version of volume types that is gp3. Details in below
- Recommended for most workloads
- 1 Gib - 16 TiB Size
- It has the balance of IOPS and throughput.
- Generally fast in terms of their throughput. Max throughput 250 mib/s
Exceptionally fast in terms of the number of IOPS. Range; 100 - 16,000 IOPS
There is a important point in gp2 types. It gains IOPS per gigabyte. Performance is linked to its size. You get 3 IOPS per GiB.
If you have 100 GiB volume, then you will have 300 IOPS.
But it can burst up to 3000 IOPS.
500 GiB * 3 = 1500 IOPS min. Burstable up to 3000 IOPS
1024 GIB * 3 = 3072 IOPS min. Not burstable
While provisioning the volume, you should consider IOPS.
The smaller sizes can hit performance ceilings. Anytime you need to go above the baseline, you can burst up to 3000 IOPS.
io1 - Provisioned IOPS
- It offers highest performance SSD volumes.
- Suit for Critical business applications
- 4 Gib - 16 TiB Size
- You can adjust size and IOPS separately.
- Max: 64,000 IOPS / Max: 1000 mib/s throughput
- EBS has some limitations per instance. You can have up to;
1750 mib/s throughput
80,000 IOPS
Do you think it is a limit?
Then that is the solution. Use instance store volumes :)
st1 - Throughput Optimized
- Offers low cost HDD volumes.
- 500 GiB - 16 TiB Size
- Throughput up to 500 mib/s
- HDD volumes can't be boot volume
- Suit for throughput intensive workloads such as Streaming, BigData, Data Warehouse, Log processing
sc1 - Cold HDD
- Offers lowest cost HDD volumes
- Suit for infrequently accessed but requires throughput workloads
- 500 GiB - 16 TiB Size
- Throughput up to 250 mib/s
- HDD volumes can't be boot volume
gp3 - General Purpose
- The next generation general purpose SSD volume type released on December, 2020. New gp3 volumes provides to provision IOPS and size separately like io1.
- It offers lower price up to %20 per GiB than gp2.
- You can scale IOPS and throughput without needing to provision new volume types. Pay only for your usage.
- Min IOPS: 3,000 - Max IOPS: 16,000
- Min throughput: 125 mib/s - Max throughput: 1,000 mib/s
- Suits for transaction-intensive, low-latency workloads. Database clusters and web applications
- You can easily migrate from gp2 to gp3 without interrupting the EC2 instances by using elastic volumes feature.