An Overview & Hands-On for AWS Storage Types.
Focus:
- Tailored for SRE, DevOps, Cloud, and DevSecOps Engineers
Breakdown:
- Intro,
- Amazon Elastic Block Store (EBS),
- Instance Store,
- Amazon Elastic File System (EFS),
- EC2 instance storage types and use-cases,
- Things to keep in mind,
- Insights,
- How to configures & terminate EC2 instance but retains the EBS root volume with its data still intact,
- Project: Hands-On.
Intro:
- AWS offers several storage types for EC2 instances.
- AWS storage types are categorized primarily into block storage, ephemeral local storage, and shared file storage options that can attach to instances.
- EBS provides durable, persistent block-level storage volumes that can be attached to a running EC2 instance.
- The data on an EBS volume persists independently from the life of the instance, even after the instance is stopped or terminated.
- EBS volumes are highly available and support snapshots and backups, making them suitable for primary storage for databases, enterprise applications, and the root volumes of most instances.
- EBS offers various volume types, including General Purpose SSD (gp3/gp2), Provisioned IOPS SSD (io2/io1), Throughput Optimized HDD (st1), and Cold HDD (sc1), each optimized for specific performance and cost requirements.
- Instance store provides temporary block storage that is physically located on the host server to which the EC2 instance is attached.
- This storage delivers very high random I/O performance and low latency, as it is local to the host.
- However, the data stored on an instance store volume is ephemeral; it is lost if the instance stops, terminates, or if the underlying host hardware fails.
- It is ideal for use cases like temporary cache, scratch data, buffer layers, or any data that can be easily regenerated.
- EFS provides a scalable, fully managed network file system that can be shared across multiple EC2 instanc66.
- It is suitable for scenarios where multiple instances need concurrent access to the same data, such as content management systems, web serving, and shared development environments.
- While not physically "attached" to a single instance in the same way as EBS or instance store, it is a primary storage option used with EC2.
- The key difference lies in durability and performance:
- use EBS for persistent, critical data, instance store for high-performance temporary data.
- Use EFS for data that needs to be shared across instances.
EC2 instance storage types and use-cases.
1. Instance Store (ephemeral storage)
- Temporary, local storage physically attached to the EC2 host.
- Data is lost
if the instance stops or is terminated.
- Use case:
Temporary storage needs like caching or scratch data.
2. Amazon EBS (Elastic Block Store)
- Durable, persistent storage that attaches to EC2 instances.
- Can store OS, databases, or application data.
- Data remains
even after stopping or terminating the instance (if not deleted).
- Use case: Boot volumes, databases, critical app storage.
3. Amazon EFS/NFS (Elastic File System/Network file system)
- Shared file system
that can be accessed by multiple EC2 instances.
- Scales automatically
as files grow.
- Use case: Shared access for web servers, CMS, or analytics pipelines.
- Know the difference between temporary (Instance Store) and persistent (EBS/EFS) storage.
- Know when to use block storage (EBS) vs. file storage (EFS).
- Recognize that Instance Store is not durable and is not used for critical data.
- know that EBS volumes are bound to a specific availability zone.
- twtech EBS Volume in us-east-2a cannot be attached to us-east-1b.
- Thererfore, twtech considers an ebs volume as a “network USB stick”.
- twtech can have Free tier for up to 30 GB of free EBS storage of type General Purpose (SSD) or Magnetic per month.
- EBS is a network drive (it is not a physical drive).
- The ebs volume uses the network to communicate between instances, and that accounts for the reasons behind latency.
- twtech may detached its ebs volume from an EC2 instance and attached to another in the same AZ.
- twtech uses snapshots to move a volume across.
- The ebs volume has a provisioned capacity of size in GBs, or IOPS.
A. GBs (Gigabytes per second)
- Meaning:A measure of data trangfer speed—how fast data can be read from or written to a storage device.
- Example: If a drive has a speed of 2 GB/s, it can transfer 2 gigabytes of data every second.
- Use case: Important for tasks like copying large files, streaming high-resolution video, or loading big databases quickly.
B. IOPS (Input/Output Operations Per Second)
- Meaning: A measure of how many individual read/write operations a storage system can handle per second.
- Example: A drive with 10,000 IOPS can process 10,000 read or write commands each second.
- Use case: Crucial for workloads with lots of small, random reads/writes, like databases or high-traffic web servers.
- twtech is billed for its provisioned ebs volumes.
- twtech may decide to increase ( Scale up/out) or decrease (Scale down/in) the capacity of the drive over time
- twtech may apply vertically Scaling (same volume) or horizontally Scaling (different volumes).
- Instance Volume can be manage under Advance-Settings.
- By default, Instance storage is deletes on termination of EC2 instance.
NB
- Other volumes created (custom volumes) and attached to an instance is not deleted on termination of instance (No).
- Custom volumes must be manually released via AWS console and CLI.
Insights:
1. Instance Store (Ephemeral Storage)
Key Traits:
- Physically
attached to the host computer.
- High
IOPS, low latency.
- Data
is lost when the instance stops, hibernates, or
terminates.
- Cannot be
detached or moved between instances.
Use Cases:
- Temporary
data like cache, buffers,
scratch data, or temporary
logs.
- Applications
with high-speed, short-term storage needs
(e.g., video processing, batch jobs).
- High-performance NoSQL databases where persistence is handled elsewhere.
Key Traits:
- Network-attached,
persistent block storage.
- Survives
instance stop/start/termination (if not explicitly deleted).
- Can be snapshotted,
resized, and attached/detached
from instances.
- Supports encryption
and backup.
Types of EBS volumes:
|
Type |
Key Feature |
Use Case |
|
gp3 / gp2 |
General Purpose SSD |
Boot volumes, dev/test workloads |
|
io2 / io1 |
Provisioned IOPS SSD |
Databases like MySQL, PostgreSQL, Oracle |
|
st1 |
Throughput Optimized HDD |
Big data, data warehouses, log processing |
|
sc1 |
Cold HDD |
Infrequently accessed, low-cost storage |
Use Cases:
- Boot
volumes, application storage.
- Databases,
transactional systems, persistent
volumes.
- Systems
that need durability and reliability.
3. Amazon EFS (Elastic File System) – Not EC2-specific, but often used with EC2
Key Traits:
- Fully
managed, elastic NFS file system.
- Accessible
by multiple EC2 instances across AZs.
- Scales
automatically.
Use Cases:
- Shared
file storage across EC2 instances.
- CMS
systems, web servers, data
science pipelines.
- Applications needing a common file system.
|
Storage Type |
Persistent |
Performance |
Use Cases |
|
Instance Store |
❌
No |
Very high |
Cache, temp files, scratch data |
|
EBS (gp3/io1/st1) |
✅
Yes |
Medium to high |
Boot, databases, general workloads |
|
EFS |
✅
Yes |
Shared, scalable |
Shared file systems, multi-AZ access |
|
FSx |
✅
Yes |
Specialized |
Windows apps, HPC, Lustre file systems |
- How twtech configures and terminate its EC2 instance but retains the EBS root volume with its data still intact.
Step-by-Step
in the AWS Console:
- Go to the EC2 Dashboard.
- Select the instance
you want to terminate.
- Click the "Actions" dropdown, then go to:
- Instance settings → Change Termination Protection →
Make sure it's disabled (select: NO).
- Now go to:
- Actions
→ Instance settings → Change
root volume delete behavior.
- Uncheck
the box “Delete on termination” for the root volume (usually
/dev/xvda or /dev/sda1).
- Or go to Volumes, find the root volume attached to the instance, and:
- Select it → Actions → Modify Volume Attachment → Uncheck "Delete on termination".
- Click Save.
- Now terminate the instance:
- Actions
→ Instance State → Terminate
instance.
Notes:
- After termination, the root EBS volume will remain
in twtech account, and twtech can later:
- Attach it to another EC2 instance.
- Create a snapshot or AMI from it.
- Mount it as a secondary volume to inspect or recover
data.
CLI Equivalent:
twtech can also use the AWS CLI Configure Termination Protection:
# bash
aws ec2 modify-instance-attribute
\
--instance-id i-xxxxxxxxxxxxxxxxx \
--block-device-mappings
"[{\"DeviceName\":\"/dev/xvda\",\"Ebs\":{\"DeleteOnTermination\":false}}]"
# bash
aws ec2 terminate-instances --instance-ids i-xxxxxxxxxxxxxxxxx
Project: Hands-On
How twtech creates an ebs volume and attach it to an instance.
Step-1:
Go EC2 console and navigate to elastic block store, then:
volumes
- us-east-2 is selected because it corresponds to zone where the instance is located. ( same AZ)
- Add tags
- Create volume:
- Attach volume to instance in the same AZ. Make sure the state is: available.
- Select the instance and device name to attach volume to:
Step-3:
Verify that the volume has been attached to the instance:
Successfully, twtech-web-server storage
has been horizontally
scaled (another volume added)
- How twtech detaches and delete unwanted ebs volumes that is attached to an instance:
- First: Detach volume from instance
- Confirm to detach:
Step-5:
- Next. Delete the detached volume: refresh the page if need be.
- Confirm and detete volume:
Step-5:
- If twtech terminates an instance, the root volume is destroyed because by default delete on termination is set: YES.
- This can also be set to, (if need be) to : No (root-volume will not be deleted on termination of instance)
- But the default ebs volume remains available.
- Verify that the instance (twtech-webserver) has only the root volume still attached:
- Yes,
No comments:
Post a Comment