Ebs in AWS
Sure! Here's a comprehensive overview of Amazon EBS (Elastic Block Store) in AWS:
? Amazon EBS (Elastic Block Store) – Introduction
Amazon EBS is a block-level storage service designed to work with Amazon EC2 instances. It provides durable, high-performance, and persistent storage volumes that can be attached to EC2 instances and used just like a physical hard drive.
? Key Features of Amazon EBS
| Feature | Description |
|---|---|
| Block Storage | Like a virtual hard drive, useful for operating systems, databases, and apps. |
| Durable & Persistent | Data is stored redundantly and persists even after an instance is stopped or terminated (unless deleted manually). |
| High Performance | Offers SSD-backed and HDD-backed volume types for varying workloads. |
| Scalable | Volumes can be resized up to 64 TiB. |
| Backup & Restore | Create EBS snapshots stored in Amazon S3 for disaster recovery. |
| Encrypted by Default | Uses AWS KMS for encryption at rest and during transit. |
| Availability | Automatically replicated within its Availability Zone (AZ). |
? EBS Volume Types
| Volume Type | Description | Best For |
|---|---|---|
| gp3 (General Purpose SSD) | Balanced performance and cost. | Most workloads (default). |
| io2/io2 Block Express (Provisioned IOPS SSD) | High-performance SSDs with up to 256,000 IOPS. | High-performance DBs like SQL, Oracle. |
| st1 (Throughput Optimized HDD) | Low-cost HDD with good throughput. | Big data, logs, data warehouse. |
| sc1 (Cold HDD) | Lowest-cost HDD for infrequent access. | Archiving, rarely accessed data. |
| gp2 | Previous-gen SSD, replaced by gp3. | Still widely used but gp3 is preferred. |
?? Common Use Cases
Boot volumes for EC2 instances
Databases (e.g., MySQL, PostgreSQL, Oracle)
Enterprise apps like SAP
NoSQL stores like MongoDB or Cassandra
Big data workloads
Backup & recovery with Snapshots
? Snapshots
EBS Snapshots are incremental backups of volumes.
Stored in Amazon S3 (you don’t see them directly in S3).
You can create new EBS volumes from snapshots.
Use for disaster recovery, cloning, and migration.
?? Security in EBS
Encryption at rest with AWS KMS.
Encryption in transit using TLS.
IAM-based access control to manage who can create/delete/attach volumes or snapshots.
? EBS vs Instance Store
| Feature | EBS | Instance Store |
|---|---|---|
| Durability | Persistent | Ephemeral (lost on stop/terminate) |
| Use Case | Boot volumes, DBs, apps | Temporary cache, buffers, scratch |
| Scalability | Resizable volumes | Fixed size |
| Snapshot Support | ? Yes | ? No |
? Pricing Factors
EBS pricing depends on:
Volume type (gp3, io2, etc.)
Size of the volume (in GiB)
Provisioned IOPS (for io2/gp3)
Snapshot storage (charged separately)
Data transfer between AZs
? Tip: gp3 is often cheaper and more performant than gp2 for general workloads.
? Example: Create an EBS Volume (AWS CLI)
aws ec2 create-volume \ --availability-zone us-east-1a \ --size 20 \ --volume-type gp3
To attach it to an EC2 instance:
aws ec2 attach-volume \ --volume-id vol-xxxxxxxx \ --instance-id i-xxxxxxxx \ --device /dev/sdf
? Summary
| Feature | Benefit |
|---|---|
| Durable storage | Keeps your data safe and persistent |
| Scalable | Resize and scale IOPS as needed |
| Flexible types | Choose the right volume for your workload |
| Integrated | Works seamlessly with EC2, KMS, IAM, CloudWatch |