☁️ CloudProjectHub

EBS

What is Amazon EBS?

Amazon EBS (Elastic Block Store) provides block level storage volumes for use with EC2 instances. It is designed for application workloads that require high performance, low latency, and persistent storage. EBS volumes are highly available and reliable, with options for different performance characteristics including SSD and HDD volumes.

Key Features

  • Persistent Storage: Data persists independently of EC2 instances
  • Scalability: Dynamically increase size and change volume type
  • Performance: Multiple volume types for different workloads
  • Snapshots: Point-in-time backups of volumes
  • Encryption: Data encryption at rest and in transit
  • Multi-Attach: Attach single volume to multiple instances

Prerequisites

  • AWS Account
  • Running EC2 instance
  • Understanding of block storage concepts
  • IAM permissions for EBS operations
  • Knowledge of volume types and their use cases

Step-by-Step: Creating an EBS Volume

  1. Sign in to AWS Management Console: Go to console.aws.amazon.com
  2. Navigate to EC2: Go to EC2 dashboard
  3. Volumes: Click "Volumes" in the left sidebar
  4. Create Volume: Click "Create volume" button
  5. Volume Configuration:
    • Volume type: Choose based on needs:
      • gp3/gp2: General purpose SSD
      • io2/io1: Provisioned IOPS SSD
      • st1: Throughput optimized HDD
      • sc1: Cold HDD
    • Size: Enter volume size in GiB
    • IOPS: For io1/io2 volumes
    • Throughput: For gp3 volumes
  6. Availability Zone: Must match EC2 instance AZ
  7. Encryption: Enable encryption (recommended)
  8. Tags: Add key-value pairs for organization
  9. Create Volume: Review and create the volume

Attaching EBS Volume to EC2 Instance

  1. Select Volume: Choose the created volume
  2. Attach Volume: Click "Actions" → "Attach volume"
  3. Select Instance: Choose the target EC2 instance
  4. Device Name: Specify device name (e.g., /dev/sdf)
  5. Attach: Confirm attachment
  6. Mount Volume (Linux):
    • SSH into instance
    • Check device: lsblk
    • Create filesystem: mkfs -t ext4 /dev/xvdf
    • Create mount point: mkdir /data
    • Mount: mount /dev/xvdf /data
    • Add to fstab for persistence

Creating EBS Snapshots

  1. Select Volume: Choose the volume to snapshot
  2. Create Snapshot: Click "Actions" → "Create snapshot"
  3. Snapshot Details:
    • Name: Enter snapshot name
    • Description: Optional description
    • Tags: Add tags for organization
  4. Create Snapshot: Start the snapshot process
  5. Monitor Progress: Check snapshot state in console

Best Practices

  • Choose appropriate volume type for your workload
  • Use EBS snapshots for backup and disaster recovery
  • Enable encryption for sensitive data
  • Monitor IOPS and throughput usage
  • Use multiple volumes for high-performance applications
  • Implement proper tagging for cost tracking
  • Consider volume placement in cluster for performance
  • Use Amazon Data Lifecycle Manager for automated snapshots

EBS Volume Types

  • General Purpose SSD (gp3/gp2): Balanced performance for most workloads
  • Provisioned IOPS SSD (io2/io1): High-performance for I/O intensive applications
  • Throughput Optimized HDD (st1): High throughput for big data workloads
  • Cold HDD (sc1): Lowest cost for infrequently accessed data
  • Magnetic (standard): Previous generation, lowest performance

Common Use Cases

  • Database storage for relational databases
  • Application data storage
  • Boot volumes for EC2 instances
  • Big data processing and analytics
  • Content management systems
  • Development and testing environments
  • Backup and archival storage
  • High-performance computing