Day 07 – Amazon EBS & EFS – The Ultimate Guide to AWS Storage Types

The CyberSec Guru

Amazon EBS & EFS

If you like this post, then please share it:

Buy me A Coffee!

Support The CyberSec Guru’s Mission

🔐 Fuel the cybersecurity crusade by buying me a coffee! Why your support matters: Zero paywalls: Keep the content 100% free for learners worldwide, Writeup Access: Get complete writeup access within 12 hours of machine drop along with scripts and commands.

“Your coffee keeps the servers running and the knowledge flowing in our fight against cybercrime.”☕ Support My Work

Buy Me a Coffee Button

Welcome to Day 7 of your AWS 30-Day Roadmap.

We have covered a lot in the first week. We launched servers (EC2), secured them (IAM), and stored files in buckets (S3).

But there is a gap in our knowledge.

  • S3 is for “Objects” (Files, Images).
  • EC2 has a hard drive, but what if we need more space?
  • What if we want to run a high-performance database?
  • What if we have 10 servers that all need to share the same folder?

Today, we answer those questions. We are going to explore Block Storage (EBS) and File Storage (EFS).

These are the “heavy lifters” of the cloud. If S3 is the warehouse, EBS is the high-speed engine inside your car. In this ultimate guide, we will dissect the different volume types, understand IOPS, and build a shared file system that grows automatically.

The “Hard Drive” Problem (Ephemeral vs. Persistent)

To understand EBS, we first need to understand a hidden danger of EC2: Instance Store.

The Old Way: Instance Store (Ephemeral)

Some EC2 instances come with storage physically attached to the host computer. This is called Instance Store.

  • Speed: Blazing fast. It is physically connected.
  • The Catch: It is Ephemeral (Temporary). If you “Stop” your instance, the data on the Instance Store is wiped instantly. It is gone forever.
  • Use Case: Cache buffers, scratch data, temporary processing.

The New Way: EBS (Persistent)

AWS realized we needed data to survive a reboot. So they invented Elastic Block Store (EBS).

  • Concept: It is a network drive. It is not physically attached to the CPU. It is connected via a high-speed fiber cable.
  • Benefit: If your EC2 instance dies, the EBS volume survives. You can detach it and attach it to a new server.
  • Analogy: It is like a USB External Hard Drive. You can plug it into Laptop A, save files, unplug it, and plug it into Laptop B. The files are still there.
Instance Store vs EBS
Instance Store vs EBS

Amazon EBS (Elastic Block Store) Deep Dive

EBS is the bread and butter of AWS storage. Every time you launch an EC2 instance, you are using EBS for the root volume (C: Drive).

1. Availability Zone (AZ) Locking

This is the most critical concept for the exam and real life.

  • Rule: An EBS Volume is locked to a specific Availability Zone.
  • Scenario: If you create a Volume in us-east-1a, you cannot attach it to a server in us-east-1b.
  • Why? Because the latency would be too high. The cable needs to be short.
  • Workaround: If you need to move data, you take a Snapshot, and then restore that snapshot in the new AZ.

2. Volume Types (The Menu)

Not all hard drives are equal. AWS gives you choices based on Speed (IOPS) and Cost.

A. General Purpose SSD (gp2 & gp3) – The Default

  • Use Case: Boot volumes, low-latency apps, dev/test environments.
  • Performance: Balanced.
  • gp3 vs gp2: Always choose gp3. It is 20% cheaper and allows you to increase speed without increasing size.

B. Provisioned IOPS SSD (io1 & io2) – The Ferrari

  • Use Case: Mission-critical databases (Cassandra, MongoDB, SQL Server) that need sub-millisecond latency.
  • Performance: Extreme. You pay for “Provisioned IOPS” (Speed).
  • Cost: Very Expensive. Do not use this for a simple blog.

C. Hard Disk Drives (st1 & sc1) – The Old School

  • Use Case: Big Data, Log processing, Data Warehouses.
  • Technology: Spinning magnetic disks.
  • Throughput Optimized (st1): Good for streaming data.
  • Cold HDD (sc1): Cheapest block storage. Good for infrequent access.
  • Note: You cannot use HDD as a Boot Volume (Operating System).

3. Snapshots (The Backup)

  • An EBS Snapshot is a point-in-time backup of your disk.
  • Incremental: If you have a 100GB drive and change 1GB of data, the snapshot only backs up the 1GB change. This saves money.
  • Stored in S3: Snapshots are stored in S3 (hidden from you), so they are highly durable.
EBS Volume Types
EBS Volume Types

Amazon EFS (Elastic File System) Deep Dive

EBS has one limitation: You can (usually) only attach it to one server at a time. But what if you have a WordPress website running on 3 servers, and they all need access to the same wp-content/uploads folder?

Enter EFS.

The Concept: Network Attached Storage (NAS)

  • What is it? A shared file system that grows and shrinks automatically.
  • Protocol: It speaks NFS (Network File System), a standard Linux protocol.
  • Multi-AZ: Unlike EBS, EFS is Regional. It stores data across multiple Availability Zones. If AZ-A goes down, your data is still accessible in AZ-B.

Key Features

  1. Elastic: You don’t provision size (e.g., 100GB). You just dump files. If you store 1GB, you pay for 1GB. If you delete it, you pay for 0.
  2. Shared Access: Thousands of EC2 instances can read/write to the same EFS file system simultaneously.
  3. Linux Only: Currently, EFS works natively with Linux. For Windows, you would use a different service called FSx.

Storage Classes

Just like S3, EFS has tiers to save money.

  • EFS Standard: Frequently accessed files.
  • EFS Infrequent Access (IA): Files you haven’t touched in a while. 92% cheaper than Standard.
AWS EFS
AWS EFS
FeatureS3 (Simple Storage Service)EBS (Elastic Block Store)EFS (Elastic File System)
TypeObject StorageBlock StorageFile Storage
AnalogyWarehouse / Google DriveHard Drive / USB StickShared Network Drive
Attached ToAccessible via Internet (URL)One EC2 InstanceMultiple EC2 Instances
AccessibilityGlobal (Public or Private)Single AZ (Private)Multi-AZ (Private)
Bootable?NoYes (OS lives here)No
PricingCheapestExpensive (Provisioned)Expensive (Pay for usage)
Best ForImages, Videos, BackupsDatabases, OS DrivesCMS, Shared Code, Home Dir
Comparison Between AWS Storage Types
Comparison Between AWS Storage Types

Hands-On Lab (The “Hard Drive” Swap)

Let’s do something cool. We will launch a server, create a 1GB extra drive, write a secret message to it, detach it, and attach it to a new server to prove the data persists.

Step 1: Launch an Instance

  1. Launch an EC2 Instance (Amazon Linux 2023).
  2. Name it Server-A.
  3. Zone: Select us-east-1a explicitly in Network Settings.
  4. Launch it.

Step 2: Create a Volume

  1. Go to EC2 Dashboard -> Volumes (left menu).
  2. Click Create volume.
  3. Type: General Purpose SSD (gp3).
  4. Size: 1 GiB.
  5. Availability Zone: us-east-1a (Must match Server-A!).
  6. Click Create volume.

Step 3: Attach the Volume

  1. Select the new 1GB volume (It will say Available).
  2. Actions -> Attach volume.
  3. Instance: Select Server-A.
  4. Device name: /dev/sdf.
  5. Click Attach.

Step 4: The Linux Part (Mounting)

  1. Connect to Server-A via EC2 Instance Connect.
  2. Run lsblk. You will see xvdf (your 1GB drive).
  3. Check if it has data: sudo file -s /dev/xvdf. (It says “data”, meaning it is raw).
  4. Format it: sudo mkfs -t xfs /dev/xvdf.
  5. Create a folder: sudo mkdir /data.
  6. Mount it: sudo mount /dev/xvdf /data.
  7. Write a secret: echo "AWS Storage is Cool" | sudo tee /data/secret.txt.

Step 5: The Swap

  1. Terminate Server-A. (Wait… what? Yes, kill it).
  2. Go to Volumes. Your 1GB volume is now Available again! (Because we created it separately).
  3. Launch Server-B in us-east-1a.
  4. Attach the volume to Server-B.
  5. Connect to Server-B.
  6. Mount it: sudo mkdir /recovery, sudo mount /dev/xvdf /recovery.
  7. Read the file: cat /recovery/secret.txt.
  8. Result: You see “AWS Storage is Cool”. You just survived a server failure!
AWS EBS Drive Swap
AWS EBS Drive Swap

Part 6: Cleanup (Don’t pay for idle disks)

EBS Volumes cost money even if they are not attached to a server.

  1. Go to Volumes.
  2. Select the 1GB volume.
  3. Actions -> Delete volume.
  4. Also Terminate Server-B.

Part 7: Conclusion & Summary

You now understand the “Physical” layer of cloud storage.

Key Takeaways:

  1. EBS is your C: Drive. Locked to an AZ. High performance.
  2. EFS is your Network Drive. Shared across AZs. Elastic.
  3. Instance Store is fast but temporary (Ephemeral).
  4. Always Delete unattached volumes to save money.

Tomorrow, on Day 8, we zoom out. Way out. We are going to explore the AWS Global Infrastructure in detail—Regions, Edge Locations, and the massive physical network that connects it all.

Storage secured. System powering down.

Want the Next Part Sooner?

Can’t stand the suspense? Skip the wait! Members unlock the next chapter instantly and get exclusive early access to every future update.

Become a Member

Buy me A Coffee!

Support The CyberSec Guru’s Mission

🔐 Fuel the cybersecurity crusade by buying me a coffee! Your contribution powers free tutorials, hands-on labs, and security resources.

Why your support matters:
  • Writeup Access: Get complete writeup access within 24 hours
  • Zero paywalls: Keep the content 100% free for learners worldwide

Perks for one-time supporters:
☕️ $5: Shoutout in Buy Me a Coffee
🛡️ $8: Fast-track Access to Live Webinars
💻 $10: Vote on future tutorial topics + exclusive AMA access

“Your coffee keeps the servers running and the knowledge flowing in our fight against cybercrime.”☕ Support My Work

Buy Me a Coffee Button

If you like this post, then please share it:

AWS 101

Discover more from The CyberSec Guru

Subscribe to get the latest posts sent to your email!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from The CyberSec Guru

Subscribe now to keep reading and get access to the full archive.

Continue reading