Skip to content

Amazon EBS (Elastic Block Store)

Service Overview and Purpose

Amazon EBS provides high-performance block storage volumes for use with EC2 instances. EBS volumes are highly available and reliable storage volumes that can be attached to any running instance that is in the same Availability Zone. EBS volumes persist independently from the running life of an EC2 instance.

Key Characteristics

  • Block-Level Storage: Raw block-level storage for EC2 instances
  • Persistent Storage: Data persists beyond EC2 instance lifecycle
  • High Availability: Replicated within an Availability Zone
  • Elastic: Dynamically increase capacity and change performance
  • Encrypted: Built-in encryption capabilities

Key Features and Capabilities

Volume Types

  1. General Purpose SSD (gp3)
  2. Latest generation general purpose SSD
  3. Baseline: 3,000 IOPS and 125 MiB/s throughput
  4. Configurable IOPS: Up to 16,000 IOPS
  5. Configurable throughput: Up to 1,000 MiB/s
  6. Size: 1 GiB to 16 TiB
  7. Use case: Boot volumes, low-latency interactive apps

  8. General Purpose SSD (gp2)

  9. Previous generation general purpose SSD
  10. Baseline: 3 IOPS per GiB (minimum 100 IOPS)
  11. Burst performance: Up to 3,000 IOPS
  12. Size: 1 GiB to 16 TiB
  13. Use case: Boot volumes, development environments

  14. Provisioned IOPS SSD (io2)

  15. Highest performance SSD
  16. Up to 64,000 IOPS per volume
  17. Up to 1,000 MiB/s throughput
  18. 99.999% durability (100x more than io1)
  19. Size: 4 GiB to 16 TiB
  20. Use case: Critical business applications, databases

  21. Provisioned IOPS SSD (io1)

  22. High performance SSD
  23. Up to 64,000 IOPS per volume
  24. Up to 1,000 MiB/s throughput
  25. Size: 4 GiB to 16 TiB
  26. Use case: I/O intensive workloads

  27. Throughput Optimized HDD (st1)

  28. Low-cost HDD for frequently accessed data
  29. Baseline: 40 MiB/s per TiB
  30. Burst: Up to 250 MiB/s per TiB
  31. Size: 125 GiB to 16 TiB
  32. Use case: Big data, data warehouses, log processing

  33. Cold HDD (sc1)

  34. Lowest cost HDD for less frequently accessed data
  35. Baseline: 12 MiB/s per TiB
  36. Burst: Up to 80 MiB/s per TiB
  37. Size: 125 GiB to 16 TiB
  38. Use case: Infrequent access, cold data

Core Features

Snapshots

  • Point-in-time copies of EBS volumes
  • Incremental backups stored in S3
  • Cross-region copying for disaster recovery
  • Automated via DLM (Data Lifecycle Manager)
  • Fast Snapshot Restore for quick volume creation

Encryption

  • Data at rest encryption using AWS KMS
  • Data in transit encryption between instance and volume
  • Snapshot encryption inherited from volume
  • No performance impact on modern instance types

Multi-Attach

  • Attach single volume to multiple EC2 instances
  • Available for io1 and io2 volume types only
  • Same Availability Zone requirement
  • Cluster-aware file systems required

Elastic Volumes

  • Modify volume size without detaching
  • Change volume type while attached
  • Modify IOPS on io1, io2, and gp3 volumes
  • Live migration with minimal downtime

Use Cases and Scenarios

Primary Use Cases

  1. Database Storage
  2. Database files and logs
  3. High IOPS requirements
  4. Consistent performance
  5. Point-in-time recovery

  6. File Systems

  7. Boot volumes
  8. Application data
  9. Shared storage with Multi-Attach
  10. Content repositories

  11. Backup and Archive

  12. Snapshot-based backups
  13. Cross-region disaster recovery
  14. Compliance requirements
  15. Long-term retention

  16. Big Data Analytics

  17. Data lakes and warehouses
  18. ETL processing
  19. Log analysis
  20. Sequential read/write workloads

Architecture Patterns

  1. Database Tier
  2. io2 for high-performance databases
  3. gp3 for general purpose databases
  4. Snapshot-based backup strategy

  5. Application Tier

  6. gp3 for application servers
  7. st1 for log processing
  8. Auto Scaling with EBS optimization

  9. Backup and DR

  10. Cross-region snapshot copying
  11. Automated lifecycle management
  12. Point-in-time recovery

Pricing Models and Cost Optimization

Pricing Components

  1. Volume Storage
  2. Per GB per month
  3. Varies by volume type
  4. Provisioned capacity (not used capacity)

  5. IOPS Charges

  6. io1/io2: Provisioned IOPS
  7. gp3: IOPS above baseline
  8. No additional charges for gp2

  9. Throughput Charges

  10. gp3: Throughput above baseline
  11. No charges for other volume types

  12. Snapshot Storage

  13. Per GB per month in S3
  14. Incremental storage only
  15. Cross-region transfer charges

Cost Optimization Strategies

  1. Right-Size Volumes

    # Monitor volume utilization
    aws cloudwatch get-metric-statistics \
      --namespace AWS/EBS \
      --metric-name VolumeReadOps \
      --dimensions Name=VolumeId,Value=vol-12345678 \
      --start-time 2023-01-01T00:00:00Z \
      --end-time 2023-01-02T00:00:00Z \
      --period 3600 \
      --statistics Average
    

  2. Optimize Volume Types

  3. Use gp3 instead of gp2 for cost savings
  4. Migrate from io1 to io2 for better durability
  5. Use st1/sc1 for appropriate workloads

  6. Snapshot Management

  7. Implement lifecycle policies
  8. Delete unnecessary snapshots
  9. Use cross-region replication wisely

  10. Instance Optimization

  11. Use EBS-optimized instances
  12. Match instance and volume performance
  13. Consider placement groups

Configuration Details and Best Practices

Volume Creation and Management

# Create gp3 volume
aws ec2 create-volume \
  --size 100 \
  --volume-type gp3 \
  --iops 4000 \
  --throughput 250 \
  --availability-zone us-west-2a \
  --encrypted \
  --kms-key-id alias/aws/ebs

# Attach volume to instance
aws ec2 attach-volume \
  --volume-id vol-12345678 \
  --instance-id i-87654321 \
  --device /dev/sdf

# Modify volume (size and performance)
aws ec2 modify-volume \
  --volume-id vol-12345678 \
  --size 200 \
  --iops 6000 \
  --throughput 500

Snapshot Management

# Create snapshot
aws ec2 create-snapshot \
  --volume-id vol-12345678 \
  --description "Database backup before upgrade"

# Copy snapshot to another region
aws ec2 copy-snapshot \
  --source-region us-west-2 \
  --source-snapshot-id snap-12345678 \
  --destination-region us-east-1 \
  --description "DR backup"

# Create volume from snapshot
aws ec2 create-volume \
  --snapshot-id snap-12345678 \
  --availability-zone us-west-2a \
  --volume-type gp3

Best Practices

  1. Performance Optimization
  2. Use EBS-optimized instances
  3. Choose appropriate volume type for workload
  4. Monitor IOPS and throughput utilization
  5. Consider instance store for temporary data

  6. Security

  7. Enable encryption for sensitive data
  8. Use customer-managed KMS keys
  9. Implement proper IAM policies
  10. Encrypt snapshots

  11. Availability and Durability

  12. Regular snapshot backups
  13. Cross-region snapshot copying
  14. Monitor volume health
  15. Use CloudWatch alarms

  16. Cost Management

  17. Right-size volumes based on actual usage
  18. Use appropriate volume types
  19. Implement snapshot lifecycle policies
  20. Monitor and optimize regularly

File System Configuration

# Format new volume (Linux)
sudo mkfs -t ext4 /dev/xvdf

# Create mount point
sudo mkdir /data

# Mount volume
sudo mount /dev/xvdf /data

# Add to fstab for persistent mounting
echo '/dev/xvdf /data ext4 defaults,nofail 0 2' | sudo tee -a /etc/fstab

# Verify mount
df -h

Integration with Other AWS Services

Direct Integrations

  1. EC2 Integration
  2. Root and additional volumes
  3. EBS-optimized instances
  4. Placement groups
  5. Auto Scaling integration

  6. Backup Integration

  7. AWS Backup service
  8. DLM (Data Lifecycle Manager)
  9. Cross-region replication
  10. Point-in-time recovery

  11. Monitoring Integration

  12. CloudWatch metrics
  13. Systems Manager
  14. AWS Config
  15. CloudTrail logging

Data Lifecycle Manager (DLM)

{
  "ExecutionRoleArn": "arn:aws:iam::account:role/AWSDataLifecycleManagerDefaultRole",
  "Description": "Daily snapshots of production volumes",
  "State": "ENABLED",
  "PolicyDetails": {
    "PolicyType": "EBS_SNAPSHOT_MANAGEMENT",
    "ResourceTypes": ["VOLUME"],
    "TargetTags": [{"Key": "Environment", "Value": "Production"}],
    "Schedules": [{
      "Name": "DailySnapshots",
      "CreateRule": {
        "Interval": 24,
        "IntervalUnit": "HOURS",
        "Times": ["03:00"]
      },
      "RetainRule": {
        "Count": 7
      },
      "CopyTags": true
    }]
  }
}

Backup Strategy Integration

# Create backup vault
aws backup create-backup-vault \
  --backup-vault-name ProductionBackups \
  --encryption-key-arn arn:aws:kms:region:account:key/key-id

# Create backup plan
aws backup create-backup-plan \
  --backup-plan '{
    "BackupPlanName": "EBSBackupPlan",
    "Rules": [{
      "RuleName": "DailyBackups",
      "TargetBackupVault": "ProductionBackups",
      "ScheduleExpression": "cron(0 5 ? * * *)",
      "StartWindowMinutes": 480,
      "CompletionWindowMinutes": 10080,
      "Lifecycle": {
        "DeleteAfterDays": 30
      }
    }]
  }'

Security Considerations

Encryption

  1. Encryption at Rest
  2. AWS managed keys (aws/ebs)
  3. Customer managed keys (CMK)
  4. Imported key material
  5. Cross-region key usage

  6. Encryption in Transit

  7. Automatic for supported instances
  8. No additional configuration required
  9. NVMe and Nitro System instances

  10. Key Management

    # Create custom KMS key for EBS
    aws kms create-key \
      --description "EBS encryption key" \
      --key-usage ENCRYPT_DECRYPT \
      --key-spec SYMMETRIC_DEFAULT
    
    # Create alias
    aws kms create-alias \
      --alias-name alias/ebs-encryption \
      --target-key-id key-id
    

Access Control

  1. IAM Policies

    {
      "Version": "2012-10-17",
      "Statement": [{
        "Effect": "Allow",
        "Action": [
          "ec2:CreateVolume",
          "ec2:AttachVolume",
          "ec2:DetachVolume"
        ],
        "Resource": "*",
        "Condition": {
          "StringEquals": {
            "ec2:Encrypted": "true"
          }
        }
      }]
    }
    

  2. Resource-Based Policies

  3. Snapshot sharing permissions
  4. Cross-account access
  5. Conditional access

  6. VPC Endpoints

  7. Private API access
  8. No internet gateway required
  9. Enhanced security posture

Monitoring and Troubleshooting

CloudWatch Metrics

Volume Metrics

  • VolumeReadOps/VolumeWriteOps: IOPS utilization
  • VolumeReadBytes/VolumeWriteBytes: Throughput utilization
  • VolumeTotalReadTime/VolumeTotalWriteTime: Latency
  • VolumeQueueLength: Queue depth
  • VolumeThroughputPercentage: Throughput utilization

Instance Metrics

  • EBSReadOps/EBSWriteOps: Instance-level IOPS
  • EBSReadBytes/EBSWriteBytes: Instance-level throughput
  • EBSIOBalance%: I/O credit balance (gp2)
  • EBSByteBalance%: Throughput credit balance (gp2)

Monitoring Setup

# Create CloudWatch alarm for high IOPS
aws cloudwatch put-metric-alarm \
  --alarm-name "EBS-High-IOPS" \
  --alarm-description "EBS volume high IOPS utilization" \
  --metric-name VolumeReadOps \
  --namespace AWS/EBS \
  --statistic Sum \
  --period 300 \
  --threshold 1000 \
  --comparison-operator GreaterThanThreshold \
  --dimensions Name=VolumeId,Value=vol-12345678

# Enhanced monitoring for instances
aws ec2 monitor-instances --instance-ids i-87654321

Common Issues and Solutions

  1. Performance Issues
  2. Check IOPS/throughput limits
  3. Verify EBS optimization
  4. Monitor queue depth
  5. Consider volume type upgrade

  6. Attachment Issues

  7. Verify same Availability Zone
  8. Check instance limits
  9. Verify device name availability
  10. Check IAM permissions

  11. Snapshot Issues

  12. Monitor snapshot progress
  13. Check S3 permissions
  14. Verify encryption compatibility
  15. Consider Fast Snapshot Restore

Troubleshooting Commands

# Check volume status
aws ec2 describe-volumes --volume-ids vol-12345678

# Check volume attachments
aws ec2 describe-volumes \
  --filters "Name=attachment.instance-id,Values=i-87654321"

# Monitor modification progress
aws ec2 describe-volumes-modifications \
  --volume-ids vol-12345678

# Check snapshot status
aws ec2 describe-snapshots \
  --owner-ids self \
  --filters "Name=volume-id,Values=vol-12345678"

Exam-Specific Tips and Common Scenarios

Key Exam Topics

  1. Volume Type Selection
  2. Performance requirements vs cost
  3. IOPS vs throughput optimization
  4. HDD vs SSD use cases
  5. Migration between volume types

  6. Backup and Recovery

  7. Snapshot strategies
  8. Cross-region disaster recovery
  9. Point-in-time recovery
  10. Automated backup policies

  11. Security and Encryption

  12. Encryption requirements
  13. Key management scenarios
  14. Cross-account sharing
  15. Compliance considerations

Common Exam Scenarios

  1. Database Performance
  2. Choose io2 for high-performance databases
  3. Use gp3 for general purpose databases
  4. Understand IOPS requirements
  5. Consider Multi-Attach for clusters

  6. Backup and DR Strategy

  7. Implement automated snapshots
  8. Cross-region snapshot copying
  9. Lifecycle management policies
  10. Recovery time objectives

  11. Cost Optimization

  12. Right-size volumes based on usage
  13. Choose appropriate volume types
  14. Implement snapshot lifecycle policies
  15. Monitor and optimize regularly

  16. Migration Scenarios

  17. Migrate from gp2 to gp3
  18. Upgrade from io1 to io2
  19. Volume type conversions
  20. Cross-AZ volume migration

Exam Tips

  • Know the performance characteristics of each volume type
  • Understand when to use Multi-Attach vs EFS
  • Remember encryption inheritance from snapshots
  • Know the limits for each volume type and instance
  • Understand cross-region snapshot copying for DR

Hands-on Examples and CLI Commands

Volume Management

# List all volumes
aws ec2 describe-volumes

# Create encrypted gp3 volume with custom performance
aws ec2 create-volume \
  --size 500 \
  --volume-type gp3 \
  --iops 10000 \
  --throughput 500 \
  --availability-zone us-west-2a \
  --encrypted \
  --kms-key-id alias/my-ebs-key \
  --tag-specifications 'ResourceType=volume,Tags=[{Key=Name,Value=ProductionDB},{Key=Environment,Value=Production}]'

# Modify volume size and performance
aws ec2 modify-volume \
  --volume-id vol-12345678 \
  --size 1000 \
  --iops 15000 \
  --throughput 750

# Check modification progress
aws ec2 describe-volumes-modifications \
  --volume-ids vol-12345678

Snapshot Operations

# Create snapshot with description
aws ec2 create-snapshot \
  --volume-id vol-12345678 \
  --description "Pre-upgrade backup $(date)" \
  --tag-specifications 'ResourceType=snapshot,Tags=[{Key=Name,Value=DB-Backup},{Key=Environment,Value=Production}]'

# Enable Fast Snapshot Restore
aws ec2 enable-fast-snapshot-restores \
  --availability-zones us-west-2a us-west-2b \
  --source-snapshot-ids snap-12345678

# Create DLM policy
aws dlm put-lifecycle-policy \
  --execution-role-arn arn:aws:iam::account:role/AWSDataLifecycleManagerDefaultRole \
  --description "Production volume snapshots" \
  --state ENABLED \
  --policy-details file://dlm-policy.json

Performance Testing

# Install and run fio for performance testing
sudo yum install -y fio

# Test random read IOPS
sudo fio --name=random-read \
  --ioengine=libaio \
  --iodepth=32 \
  --rw=randread \
  --bs=4k \
  --direct=1 \
  --size=1G \
  --numjobs=4 \
  --runtime=60 \
  --group_reporting \
  --filename=/dev/xvdf

# Test sequential write throughput
sudo fio --name=sequential-write \
  --ioengine=libaio \
  --iodepth=16 \
  --rw=write \
  --bs=1M \
  --direct=1 \
  --size=1G \
  --numjobs=1 \
  --runtime=60 \
  --group_reporting \
  --filename=/dev/xvdf

This comprehensive EBS documentation provides detailed coverage of all aspects needed for AWS certification exams, including practical examples and real-world scenarios.