Amazon Elastic Block Store (EBS)
Overview
Amazon Elastic Block Store (Amazon EBS) provides block-level 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.
Key Features
- Block-Level Storage: Raw, unformatted block devices
- High Availability: Automatically replicated within AZ
- Snapshot Support: Point-in-time backups
- Multiple Volume Types: Optimized for different workloads
- Encryption: AES-256 encryption at rest
- Performance Optimization: Provisioned IOPS and throughput
- Lifecycle Management: Automated snapshot management
- Multi-Attach: Share volumes across instances
Interview Topics
1. EBS Volume Types
- General Purpose SSD (gp2/gp3): Balanced price and performance
- Provisioned IOPS SSD (io1/io2): High-performance workloads
- Throughput Optimized HDD (st1): Big data and data warehousing
- Cold HDD (sc1): Infrequently accessed data
- Magnetic (standard): Legacy volumes
2. EBS Volume Characteristics
- Size: 1 GiB to 16 TiB per volume
- Performance: IOPS and throughput specifications
- Durability: 99.8-99.9% availability
- Encryption: AES-256 encryption
- Snapshots: Point-in-time backups
- Multi-Attach: io1/io2 volumes only
3. EBS Snapshots
- Incremental Backups: Only changed blocks are stored
- Cross-Region Copy: Replicate snapshots across regions
- Cross-Account Sharing: Share snapshots with other accounts
- Lifecycle Management: Automated snapshot policies
- Encryption: Encrypted snapshots
4. Performance Optimization
- IOPS: Input/output operations per second
- Throughput: Data transfer rate
- Burst Performance: Temporary performance boost
- Volume Types: Choose based on workload requirements
- Monitoring: CloudWatch metrics
5. Advanced Features
- Multi-Attach: Share volumes across instances
- Fast Snapshot Restore: Instant volume creation
- EBS Optimized Instances: Dedicated bandwidth
- Volume Modifications: Resize and change volume types
- Data Lifecycle Manager: Automated snapshot management
Common Interview Questions
Basic Questions
-
What is Amazon EBS and when would you use it?
- Block-level storage for EC2 instances
- Persistent storage that survives instance termination
- Use for operating systems, applications, and data
- High availability and reliability requirements
-
What are the different EBS volume types?
- gp2/gp3: General purpose SSD
- io1/io2: Provisioned IOPS SSD
- st1: Throughput optimized HDD
- sc1: Cold HDD
- Standard: Magnetic (legacy)
-
How do you create an EBS volume?
aws ec2 create-volume \ --availability-zone us-east-1a \ --size 100 \ --volume-type gp3 \ --encrypted
Advanced Questions
-
How do you optimize EBS performance for a database?
Resources: DatabaseVolume: Type: AWS::EC2::Volume Properties: AvailabilityZone: !Select [0, !GetAZs ''] Size: 500 VolumeType: io2 Iops: 20000 Encrypted: true Tags: - Key: Name Value: DatabaseVolume -
How do you implement EBS snapshots for backup?
- Create snapshots manually or automatically
- Use Data Lifecycle Manager for automation
- Copy snapshots across regions
- Share snapshots across accounts
- Monitor snapshot costs
-
What is the difference between gp2 and gp3 volumes?
- gp3: Baseline 3,000 IOPS, 125 MiB/s throughput
- gp2: IOPS scales with volume size
- gp3: More cost-effective for most workloads
- gp3: Independent IOPS and throughput scaling
Troubleshooting Questions
-
What if an EBS volume is running out of space?
- Increase volume size
- Create new volume and migrate data
- Use CloudWatch monitoring
- Implement automated scaling
-
How do you troubleshoot EBS performance issues?
- Monitor CloudWatch metrics
- Check volume type and size
- Verify instance type compatibility
- Review workload patterns
Best Practices
1. Volume Selection
- Choose appropriate volume type for workload
- Use gp3 for most general-purpose workloads
- Use io1/io2 for high-performance databases
- Use st1 for big data workloads
- Use sc1 for infrequently accessed data
2. Performance Optimization
- Monitor CloudWatch metrics
- Use EBS-optimized instances
- Implement proper volume sizing
- Use multi-attach for shared storage
- Optimize I/O patterns
3. Backup and Recovery
- Implement automated snapshots
- Use cross-region snapshot copying
- Test restore procedures
- Monitor snapshot costs
- Implement lifecycle policies
4. Security
- Enable encryption for all volumes
- Use IAM roles for access control
- Implement proper snapshot policies
- Monitor volume access
- Regular security assessments
5. Cost Optimization
- Choose appropriate volume types
- Implement snapshot lifecycle policies
- Monitor unused volumes
- Use reserved capacity where appropriate
- Optimize volume sizing
Use Cases
1. Database Storage
- High-performance databases
- Transaction processing systems
- Data warehousing
- Analytics workloads
2. Application Storage
- Operating system storage
- Application data storage
- Log file storage
- Configuration storage
3. Big Data and Analytics
- Data processing workloads
- ETL operations
- Analytics processing
- Machine learning workloads
4. Development and Testing
- Development environments
- Testing environments
- Staging environments
- Backup and recovery testing
Integration Patterns
1. EC2 Integration
- Instance storage
- Boot volumes
- Data volumes
- Multi-attach volumes
2. Backup Integration
- Snapshot management
- Cross-region replication
- Automated backup policies
- Disaster recovery
3. Monitoring Integration
- CloudWatch metrics
- Performance monitoring
- Capacity planning
- Alerting and notification
4. Security Integration
- KMS encryption
- IAM access control
- VPC security groups
- Compliance monitoring
Security Considerations
1. Data Protection
- Enable encryption at rest
- Use customer-managed keys
- Implement access controls
- Monitor data access
2. Access Control
- Use IAM roles and policies
- Implement least privilege
- Regular access reviews
- Monitor access patterns
3. Network Security
- Use VPC for isolation
- Implement security groups
- Monitor network access
- Secure communication channels
4. Compliance
- Maintain audit trails
- Implement encryption
- Regular security assessments
- Compliance monitoring
Cost Optimization
1. Volume Optimization
- Choose appropriate volume types
- Right-size volumes
- Monitor unused volumes
- Use reserved capacity
2. Snapshot Optimization
- Implement lifecycle policies
- Monitor snapshot costs
- Optimize snapshot frequency
- Use cross-region copying efficiently
3. Performance Optimization
- Use appropriate volume types
- Optimize I/O patterns
- Monitor performance metrics
- Implement auto-scaling
4. Storage Optimization
- Monitor storage usage
- Implement data lifecycle policies
- Use appropriate storage classes
- Optimize data placement
Performance Optimization
1. Volume Performance
- Choose appropriate volume types
- Monitor performance metrics
- Optimize I/O patterns
- Use multi-attach where appropriate
2. Instance Performance
- Use EBS-optimized instances
- Monitor instance performance
- Optimize instance types
- Implement proper sizing
3. Network Performance
- Use appropriate regions
- Optimize network configuration
- Monitor network performance
- Implement bandwidth optimization
4. Application Performance
- Optimize application I/O
- Use appropriate file systems
- Implement caching strategies
- Monitor application performance
Disaster Recovery
1. Backup Strategy
- Automated snapshots
- Cross-region replication
- Point-in-time recovery
- Recovery testing
2. Recovery Procedures
- Document recovery steps
- Test recovery procedures
- Maintain recovery documentation
- Train recovery teams
3. Monitoring and Alerting
- Monitor volume health
- Implement failover procedures
- Maintain operational procedures
- Test recovery processes
4. Business Continuity
- Define RTO and RPO
- Implement recovery procedures
- Test business continuity
- Maintain recovery documentation
Migration Strategies
1. From On-Premises Storage
- Map existing storage requirements
- Create equivalent EBS volumes
- Migrate data gradually
- Test thoroughly
2. From Other Cloud Providers
- Map storage services
- Create equivalent volumes
- Migrate data and applications
- Validate functionality
3. Application Migration
- Plan storage requirements
- Configure EBS volumes
- Migrate applications
- Test storage performance
Common Pitfalls
1. Performance Issues
- Wrong volume type selection
- Inadequate volume sizing
- Poor I/O patterns
- Insufficient monitoring
2. Cost Problems
- Over-provisioned volumes
- Inefficient snapshot management
- Unused volumes
- Poor cost monitoring
3. Security Issues
- Inadequate encryption
- Poor access control
- Insufficient monitoring
- Security misconfigurations
4. Availability Issues
- Single AZ deployment
- Inadequate backup strategy
- Poor recovery procedures
- Insufficient testing
Resources
Interview angle
- “Which volume type?” - gp3 as the default, because throughput and IOPS are configured independently of size, unlike gp2 where you had to over-provision capacity to buy performance. io2 Block Express for databases needing sustained high IOPS and higher durability.
- “EBS or EFS or S3?” - EBS for a block device attached to one instance (a database’s data directory); EFS for a shared POSIX filesystem across many instances; S3 for objects addressed over HTTP. Choosing EFS where S3 would do is a common and expensive mistake.
- “What limits actual throughput?” - often the instance, not the volume. EBS-optimised bandwidth is per instance type, so a large volume behind a small instance is capped well below its provisioned figure.
- “How do snapshots work?” - incremental to S3, and restored volumes are lazily loaded, so the first read of each block is slow until initialised. That surprise latency after a restore is the interview follow-up.
- “What is the cost trap?” - unattached volumes and old snapshots. They keep billing after the instance is gone, and they are the most common item in a cost cleanup.