Amazon EBS - Primer
Tags: ebs, blockstorage, ebsvolume, ebssnapshot
Published: 2022-11-18 17:10:40

### Amazon Elastic Block Storage:
This is raw storage in storage devices such as Hard disk drives (HDDs), Solid state drives (SSDs) and Non-Volatile Memory Express (NVMe) that uses disk or volume.

_HDD_: Legacy technology. Data stored in spinning disks. Read/write speed of 80MB/s to 160 MB/s. 
_SSD_: Data stored in integrated circuits. Read/write speed of 600 MB/s.
_NVMe_: Data stored in integrated circuits. Read/write speed of 3.5 GB/s.

### Blocks and Volumes:
Disk or volume to be formatted as continuous blocks. _Block_ - Fixed storage unit to store data. _Volume_ - Block storage devices can be combined into larger logical units called volumes.

### Components of Block storage:
Contains 3 components: Block storage, compute system and operating system (OS). Block storage attached to compute system. OS identifies the block storage and formats to make it ready for use.

### AWS block storage:
_Instance storage:_ Ephemeral (temporary) storage that is non-persistent and terminated when associated EC2 instance is terminated. Use for buffers, caches or other temporary content.

_Amazon EBS storage:_ Persistent store. If an EC2 instance goes down, volume and data on volume remain available to attach to different EC2 instance.

Block storage service designed for use with Amazon EC2. EBS volumes suited for file systems, databases or any application that requires access to raw, block- level storage. Best for random reads/writes (DBs) and long, sequential, reads/writes as well.

### Snapshots:
Point-in-time copies of data in EBS volumes. Backup from EBS to S3. Incremental copies (only blocks on EBS volumes that changed after most recent snapshot are saved).
Delete snapshot-only data unique to that snapshot removed.
Snapshot of encrypted volumes auto encrypted. Copy snapshots across Regions.

### Snapshot Use Cases:
Host Microsoft Sharepoint, SAP, Exchange server etc. Bring your relational/non-relational DB into EBS attached to EC2. Bring your file system.

### Amazon Data Lifecycle Manager (DLM):
DLM used to automate creation, retention and deletion of snapshots to backup your EBS volumes.

### EBS Availability:
AWS auto replicates EBS volume within the AZ to prevent failure of single hardware component. But what if that AZ itself down? It is recommended to create snapshots of EBS volumes frequently. Snapshot replicated across all AZs within a Region. Snapshots can also be copied to other Regions.

### EBS Types:
_SSD_: (gp2, gp1, io1, io2) and _HDD_: (st1, sc1). 
_iops_: Input Output per second.
_gp_: general purpose; 
_io_: Provisioned IOPS.
_st1_: Throughput Optimized HDD. 
_sc1_: Cold HDD.

### EBS Pricing: 
Pay for Provisioned volume size, IOPS and throughput performance. 
_Snapshot Pricing:_ Actual amount of storage space consumed (not provisioned).

### Basic Architecture:
An EC2 instance can have multiple EBS volumes (and different EBS volume types as well) attached. EC2 & EBS must reside in same AZ. Each EBS volume --> snapshots stored in S3 within same Region where EBS volume resides.

### Advanced Architecture - Multi Attach:
Multiple EC2 instances connected to a single EBS volume. Data consistency to be managed by your application or OS environment. Multi-Attach supported only with Provisioned IOPS SSD (io1, io2) EBS volume types. EC2 & EBS must reside in same AZ. EC2 & EBS must reside in same AZ. Each EBS volume --> snapshots stored in S3 within same region where EBS volume resides.

### Advanced Architecture-Striped volumes:
Multiple EBS volumes operate as single EBS volume attached to a single EC2 instance. EC2 & EBS must reside in same AZ. Each EBS volume--> snapshots stored in S3 within same Region where EBS volume resides.

### Security:
#### IAM:
Policy created to allow users, groups, roles to access EC2 and EBS resources.

#### Encryption:
Occurs on servers that host EC2 instances, both data at rest and data in transit between EC2 and EBS are encrypted. Both encrypted/unencrypted volumes can be attached to an EC2 instance.
Data inside EBS volume, Data moving between EBS and EC2 instance. Snapshots created out of EBS volume and EBS volumes created out of snapshots-all can be encrypted.

### AWS Backup:
Deploy backup policy across AWS accounts in Organization for services like EC2, EBS, RDS etc. Like snapshots AWS Backup also stores data backups of EBS in S3 bucket.
AWS Backup backups many services including EBS... whereas snapshot is to backup only EBS volume data. AWS Backup offers more features compared to snapshots.

### AWS Compute Optimizer:
EBS sends data points (metrics) to Amazon CloudWatch. 1-minute metrics. Compute Optimizer uses Amazon CloudWatch metrics to analyze your EBS volumes and provide recommendations to assist you in optimizing your Amazon EBS costs.
(CloudWatch notifies events based on EBS changes like creation of volumes or snapshot etc.)

Image by <a href="https://pixabay.com/users/greyerbaby-2323/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=447703">lisa runnels</a> from <a href="https://pixabay.com//?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=447703">Pixabay</a>