Introduction to EC2 Storage-
Amazon EC2 provides you with flexible, cost-effective, and easy-to-use data storage options for your instances. EC2 basically provides two types of block-level storage. Instances can either be launched with Elastic block storage volume (EBS volume) or Instance store-backed volumes as to their root volumes. Each option has a unique combination of performance and durability. But Aws recommends using EBS storage-backed AMIS as they get launched faster and provide persistent storage.
EBS volume is a persistent block storage volume. The word ‘persistent’ here simply means if you reboot your instance the data will be there. It is like a virtual hard disk on the cloud.
Instance store instance provides ephemeral block-level storage. This storage is best suited for information that changes frequently like buffer, caches, etc.
Amazon Elastic block store (EBS)
Storage – Amazon EBS volume behaves like a raw, unformatted, and external block device that can be attached to a single EC2 instance at a time. Amazon EBS provides highly available, reliable, durable, block-level storage volumes that can be attached to a running instance. But not directly attached to an instance host computer it is more of network-attached storage.
Encrypted Volumes– Amazon EBS volumes provide the benefit of creating encrypted volumes by using the AWS EBS encryption feature. All the data stored at rest and snapshots created from volumes are encrypted.
Snapshots- Amazon EBS provides an additional advantage that EBS volumes can be backed by creating a snapshot of a volume that is stored in Amazon S3. So whenever you want to retrieve your data, you can create a volume from that snapshot. This feature is not present with the instance store.
High Availability – Amazon EBS volume snapshots can be copied to another region and restored to new volumes that make it easier to leverage multiple AWS regions for disaster recovery.
Persistency- EBS volumes persist independently from the running life of an EC2 instance.
Key Features of EBS backed instance-
- The most important feature we get when we use EBS backed instances is data availability. Whenever we create an EBS volume it automatically gets replicated with its availability zone to prevent data loss in case of hardware failure.
2. EBS backed instances provide us the flexibility of doing live configuration changes in the production environment. We can modify volume size without service interruptions.
3. When EBS backed instances are in a stopped state, various instance-related tasks can be done for eg- you can modify the size of the instance, you can update the kernel which it is using, or you can attach your root volume to a different running instance for debugging or any other purpose.
4. Whenever we stop or restart the EBS backed instance, it launches quickly because the state is stored in EBS volume.
5. EBS backed Instances can be of a maximum 16TB volume size depending upon the operating system.
Storage- An instance store provides temporary block-level storage to your instance. It is located on disks that are physically attached to the host computer.
Data Persistency– When we talk about data persistency with respect to instance store then data is persistent until it is associated with an instance. If an instance is stopped or terminated, any data on instance store volumes is lost.
Volumes– In the instance store, the volume can only be specified to an instance during its launch. Later we can not add a new storage volume to that ec2.
Stopped State– In the case of instance store if the host device that provided the ec2 instance fails due to internal errors. All the data on the Ec2 instance store is lost.
Root Volume– Instance store-backed instance is an EC2 instance using an Instance store as root device volume created from a template stored in S3.
Key features of Instance store Backed Instances-
- Instance store-backed Instances can be of maximum 10GiB volume size.
2. Instance store-backed instances cannot be stopped, hence once stopped, AWS does not guarantee that instances would be launched in the same host and data can be lost.
3. When we talk about data transfer rate with respect to instance store-backed instance, it provides an extremely high I/O speed as storage volumes physically reside on the same host as the EC2 server.
4. In the case of instance, store-backed instance, we cannot upgrade its configuration once made for eg- instance type.
5. Boot time is slower than EBS backed volumes and usually less than 5 min.
When we talk about storage in terms of EC2 instances then two things come to our mind- one is EBS volume, and the other is instance store. Both have their benefits. If we talk about Instance stores, it has massive IOPS at low latency, and we talk about creating a snapshot from volume then EBS volume comes in handy. So, decide the level of acceptable Risk and ‘Design for Failure’ accordingly, regardless of the technology.
Opstree is an End to End DevOps solution provider