Elastic Block Storage

Solution Architect Associate

Developer Associate

Security Specialty

  • Allows you to create storage volumes and attach them to EC2 instances. Once attached you create a file system on them and use it just like you would any other volume
  • Placed in specific availability zone and are automatically replicated in that AZ to protect from failure from a single physical component
  • You can only mount an EBS volume to an EC2 instance in the same availability zone (likely on exam!!)
  • When you create a snapshot of an EBS volume, that snapshot is actually stored in S3, although you cannot see them there
  • Snapshots are incremental, i.e. only changes are saved from the previous snapshot. Saves storage costs this way.
  • You can change EBS volume size and storage types on the fly without worry for downtime of your application/instance.
  • Snapshots of encrypted volumes will automatically be encrypted
    • Volumes restored from encrypted volumes will automatically be encrypted
  • You can share non-encrypted snapshots, including across AWS accounts. But you cannot share encypted volumes

Volume Types

  • General Purpose SSD (GP2)
    • Ratio of 3 IOPS per GB with up to 10,000 IOPS and the abiulity to burst up to 3000 IOPS for extended periods of time for volumes
    • There is a new generation of General Purpose SSD (GP3). 3000 IOPs and 125 MiB/s regardless of volume size. Can scale up to 16000 IPOs.
    • Use this top install operating systems/etc. on. It’s the default option.
  • Provisioned IOPS SSD (IO1 and IO2)
    • Designed for I/O intensive applications such as large relational or NoSQL databases
    • Used if you need more than 16,000 IOPS
    • Can provision up to 20,000 IOPS per volume
    • IO2 is the same price as IO1, but the latest generation. Up to 64000 IOPs
  • Throughput Optimized HDD (ST1)
    • Low cost, hard disk (magnetic storage)
    • Used for big data, data warehouses, log processing, etc.
    • Cannot be a boot volume
  • Cold HDD (SC1)
    • Lowest cost storage
    • Cannot be a boot volume
    • Infrequently accessed data is good here (file storage, etc.)
  • Magnetic (Standard)
    • Legacy
    • Lowest cost per gigabyte of EBS
    • Not even advertised anymore
    • You cannot modify standard magnetic volumes.
  • By default, if you delete an EC2 instance, the EBS root volume will also be deleted. You can disable this when creating an instance (Likely on the exam!!)
  • You can encrypt new volumes, but not the default Amazon provided root device volumes. You can encrypt the root volume, but you have to create your own AMI to do so. You can also do this using third party software.

Modifying

  • You can create a snapshot of a volume, which will then allow you to create additional volumes from the snapshot
    • This is how you can create a copy, or move a volume from one availability zone to another. (likely on the exam!!!)
  • You can also create a copy of a snapshot from one region to another, as well as create an image from a snapshot
    • This is how you can create a copy of an instance or an AMI from one region to another (likely on the exam!!)

Encryption

  • You can encrypt your EBS volumes using an AES-256 encryption key.
  • You can use KMS or Customer Managed Keys for encryption
  • When you encrypt a volume, the data within the volume is encrypted at rest. All snapshots and volumes created from the snapshots are encrypted.
  • Copying an unencrypted snapshot allows encryption (KNOW THIS!!!)
  • You can now encrypt root device volumes upon creation, but you can also do this later by creating a snapshot of the unencrypted volume, then create an encrypted snapshot as a copy, then create an AMI off the new encrypted root volume

EC2 Hibernation

  • When you terminate an EC2 instance, the root volume associated with the instance is also terminated by default.
  • When you hibernate an EC2 instance, the operating system is told to suspend to disk.
  • Hibernation saves the contents from the instance memory (RAM) to your EBS root volume.
  • The root volume and any other attached volumes are then persisted.
  • When you restore the instance from hibernation, the root instance is restored to its previous state. Then the RAM contents are reloaded, and processes that were previously running are resumed.
  • With EC2 hibernation, the instance boots much faster than starting up from scratch.

Monitoring

  • Basic monitoring pings the instance every five minutes
  • Detailed monitoring pings every one minute, costs more

RAID, Volumes and Snapshots

  • Volumes exist on EBS, Snapshots exist in S3
  • Snapshots are incremental, meaning they only capture changes since the last snapshot
  • You can only share snapshots in the region they’re created. To share to another region, you have to create a copy of the snapshot in another region.
  • Volumes will always exist within the same Availability Zone as the instance it is attached to
  • RAID = Redundant Array of Independent Disks
    • RAID 0 - Striped, No Redundancy, Good Performance
    • RAID 1 - Mirrored, Redundancy
    • RAID 5 - Good for reads, bad for writes. AWS does not ever recommend using RAID 5 on EBS (likely exam question!!!)
    • RAID 10 - Striped and Mirrored, Good Redundancy and Good Performance
  • Where do you use RAID arrays on AWS? When you aren’t getting the disk IO required. Create multiple volumes and use a RAID array to give you more IO. Typically will use RAID 1 or RAID 10
  • How do you take a snapshot of a RAID Array? (likely exam question!!)
    • Take an application consistant snapshot.
    • You have to stop the application from writing to the disk, and flush all caches to the disk
    • You can do this in 3 ways
      • Freeze File System
      • Unmount RAID Array
      • Shut down the existing EC2 instance and take a snapshot while its shut down (Easiest!)

Instance Store vs EBS Volume

  • With an instance store, you cannot stop an instance. (may be on exam)
  • Instance Store is kind of referrred to as “ephemereal storage”. If you have a host failure, you lose the VM. (know this for exam!!)
  • Instance Store existed prior to EBS
  • The root device for an instance launched from an instance store AMI is an instance store volume created from a template stored in S3
  • Can take longer to provision Instance Store than EBS