What is EBS in AWS?
EBS (Elastic Block Store) is a block storage service in AWS that acts like a hard disk for your EC2 instance (your cloud computer).
- Elastic → You can resize it anytime (from 20 GB to 200 GB, without losing data).
- Block Store → Data is stored in blocks, like your laptop’s SSD/HDD.
Why Do We Need EBS?
When you launch an EC2 instance:
- The EC2 is just a CPU + RAM.
- It has no persistent storage unless you attach EBS.
- Without EBS, all your data would vanish when you stop the server.
EBS ensures your data (OS, apps, files, DB) survives restarts.
Characteristics of EBS
-
Persistent storage
- Data stays even after you stop or restart EC2.
- (Unlike instance store, which is temporary).
1. Instance Store (Temporary Storage)
- Think of instance store as a temporary built-in hard disk that comes physically with the EC2 machine.
- It is fast, but:
- Data is lost if you stop, terminate, or the machine crashes.
- Not designed for backups.
- It is good only for temporary data (like cache, temp files).
2. EBS (Persistent Storage)
- EBS is a separate network-attached hard disk for your EC2.
- It lives outside the EC2 instance.
- Data remains safe even if you stop or restart the EC2.
- You can detach and attach it to another EC2.
- You can back it up with snapshots.
-
Attachable
- You can attach/detach EBS volumes from EC2.
- But one EBS volume can be attached to only one EC2 at a time.
What does "Attachable" mean?
- EBS volumes are like external hard drives.
- You can attach (plug in) a volume to an EC2 instance.
- You can detach (unplug) it and move it to another EC2.
- BUT one EBS volume can only be actively attached to one EC2 instance at a time (except for a special case called multi-attach io1/io2, but let’s ignore that for now since you’re a beginner).
Why only one EC2 at a time?
Reason:
- EBS is block storage.
- Block storage means the EC2 thinks it is the only owner of that disk.
- If two EC2s write to the same disk at the same time, it could cause data corruption (like two people writing into the same notebook at the same time with different pens).
-
Flexible size
- Can start with 20 GB and later resize to 100 GB.
-
Durability
- Data is automatically replicated in the same Availability Zone.
What does “Durability” mean for EBS?
Durability = How safe your data is against failures.
- When AWS says EBS is durable, it means:
- Your data is automatically replicated (copied) across multiple physical storage devices in the same Availability Zone (AZ).
- If one physical disk fails, your data is not lost, because another copy exists.
Think of it as having a backup copy automatically, without you doing anything.
Why is this important?
- In a cloud environment, hardware failures can happen anytime (disk crashes, server issues).
- If EBS didn’t replicate your data:
- A disk failure → your data would be gone.
- With durability, AWS ensures your data is safe and highly available, even if one disk fails.
-
Snapshots
- You can back up an EBS volume into S3 as a snapshot.
- Later, restore from snapshot to create a new volume.
What is an EBS Snapshot?
Snapshot = a backup of your EBS volume
- Think of it as taking a photograph of your entire hard disk at a certain point in time.
- Snapshots are stored in Amazon S3, which is highly durable and multi-AZ, so your backup is safe even if the whole AZ fails.