Overview
Amazon EC2 provides you with flexible, cost effective, and easy-to-use data storage options for your instances.
These storage options include the following:
-
Amazon EBS
-
Amazon EC2 instance store
-
Amazon EFS file system
-
Amazon S3
The following figure shows the relationship between these storage options and your instance.
- Every time you launch an instance from an AMI, a root storage device is created for that instance. The root storage device contains all the information necessary to boot the instance.
Amazon EBS
- Amazon EBS provides durable, block-level storage volumes that you can attach to a running instance.
- You can use Amazon EBS as a primary storage device for data that requires frequent and granular updates.
- The volume persists independently from the running life of an instance.
- As illustrated in the previous figure, multiple volumes can be attached to an instance. You can also detach an EBS volume from one instance and attach it to another instance.
- You can dynamically change the configuration of a volume attached to an instance.
- EBS volumes can also be created as encrypted volumes using the Amazon EBS encryption feature.
- To keep a backup copy of your data, you can create a snapshot of an EBS volume, which is stored in Amazon S3.
- You can create an EBS volume from a snapshot, and attach it to another instance.
Amazon EBS–optimized instances
- An Amazon EBS–optimized instance uses an optimized configuration stack and provides additional, dedicated capacity for Amazon EBS I/O.
- This optimization provides the best performance for your EBS volumes by minimizing contention between Amazon EBS I/O and other traffic from your instance.
- EBS–optimized instances deliver dedicated bandwidth to Amazon EBS
Amazon EC2 instance store
- Many instances can access storage from disks that are physically attached to the host computer. This disk storage is referred to as instance store.
- Instance store provides temporary block-level storage for instances.
- Instance store is ideal for temporary storage of information that changes frequently, such as buffers, caches, scratch data, and other temporary content, or for data that is replicated across a fleet of instances, such as a load-balanced pool of web servers.
- An instance store consists of one or more instance store volumes exposed as block devices.
- After you launch an instance, the instance store volumes are available to the instance, but you can't access them until they are mounted.
Instance store lifetime
- You can specify instance store volumes for an instance only when you launch it.
- You can't detach an instance store volume from one instance and attach it to a different instance.
- The data on an instance store volume persists only during the life of the associated instance; if you stop, hibernate, or terminate an instance, any data on instance store volumes is lost.
- If an instance reboots (intentionally or unintentionally), data in the instance store persists.
- If you change the instance type, an instance store will not be attached to the new instance type If the number of instance store volumes in a block device mapping exceeds the number of instance store volumes available to an instance, the additional volumes are ignored.
Amazon EFS file system
- Amazon EFS provides scalable file storage for use with Amazon EC2.
- You can create an EFS file system and configure your instances to mount the file system.
- You can use an EFS file system as a common data source for workloads and applications running on multiple instances.
Amazon S3
- Amazon S3 provides access to reliable, fast, and inexpensive data storage infrastructure.
- It is designed to make web-scale computing easier by enabling you to store and retrieve any amount of data, at any time, from within Amazon EC2 or anywhere on the web.
- Amazon EC2 uses Amazon S3 to store EBS snapshots and instance store-backed AMIs
- Amazon S3 stores data objects redundantly on multiple devices across multiple facilities and allows concurrent read or write access to these data objects by many separate clients or application threads.
- Amazon EFS enables you to create a file system that multiple instances can mount and access at the same time.
Block Device Mappings
- You specify the EBS volumes and instance store volumes for your instance using a block device mapping.
- Each entry in a block device mapping includes a device name and the volume that it maps to.
- The default block device mapping is specified by the AMI you use. Alternatively, you can specify a block device mapping for the instance when you launch it.
- A block device mapping always specifies the root volume for the instance. The root volume is either an Amazon EBS volume or an instance store volume.
- You can use a block device mapping to specify additional EBS volumes when you launch your instance, or you can attach additional EBS volumes after your instance is running.
- The only way to attach instance store volumes to an instance is to use block device mapping to attach the volumes as the instance is launched.
- Each AMI has a block device mapping that specifies the block devices to attach to an instance when it is launched from the AMI. An AMI that Amazon provides includes a root device only.
Reference
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Storage.html