Lab6 : Create an Amazon EBS volume
You can create an Amazon EBS volume and then attach it to any EC2 instance in the same Availability Zone. If you create an encrypted EBS volume, you can only attach it to supported instance types. For more information, see Supported instance types.
If you are creating a volume for a high-performance storage scenario, you should make sure to use a Provisioned IOPS SSD volume (io1
or io2
) and attach it to an instance with enough bandwidth to support your application, such as an EBS-optimized instance. The same advice holds for Throughput Optimized HDD (st1
) and Cold HDD (sc1
) volumes.
Note
If you create a volume for use with a Windows instance, and it’s larger than 2048 GiB (or is a volume that’s smaller than 2048 GiB but might be increased later), ensure that you configure the volume to use GPT partition tables. For more information, see Windows support for hard disks that are larger than 2 TB..
Empty EBS volumes receive their maximum performance the moment that they are available and do not require initialization (formerly known as pre-warming). However, storage blocks on volumes that were created from snapshots must be initialized (pulled down from Amazon S3 and written to the volume) before you can access the block. This preliminary action takes time and can cause a significant increase in the latency of an I/O operation the first time each block is accessed. Volume performance is achieved after all blocks have been downloaded and written to the volume. For most applications, amortizing this cost over the lifetime of the volume is acceptable. To avoid this initial performance hit in a production environment, you can force immediate initialization of the entire volume or enable fast snapshot restore. For more information, see Initialize Amazon EBS volumes.
Methods of creating a volume
- Create and attach EBS volumes when you launch instances by specifying a block device mapping. For more information, see Launch an instance using the new launch instance wizard and Block device mappings.
- Create an empty EBS volume and attach it to a running instance. For more information, see Create an empty volume below.
- Create an EBS volume from a previously created snapshot and attach it to a running instance. For more information, see Create a volume from a snapshot below.
Create an empty volume
You can create an empty EBS volume using one of the following methods.
To create an empty EBS volume using the console
- Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
- In the navigation pane, choose Volumes.
- Choose Create volume.
- For Volume type, choose the type of volume to create. For more information, see Amazon EBS volume types.General Purpose SSD
gp3
is the default selection. - For Size, enter the size of the volume, in GiB. For more information, see Constraints on the size and configuration of an EBS volume.
- (
io1
,io2
, andgp3
only) For IOPS, enter the maximum number of input/output operations per second (IOPS) that the volume should provide. - (
gp3
only) For Throughput, enter the throughput that the volume should provide, in MiB/s. - For Availability Zone, choose the Availability Zone in which to create the volume. A volume can be attached only to an instance that is in the same Availability Zone.
- For Snapshot ID, keep the default value (Don’t create volume from a snapshot).
- (
io1
andio2
only) To enable the volume for Amazon EBS Multi-Attach, select Enable Multi-Attach. For more information, see Attach a volume to multiple instances with Amazon EBS Multi-Attach. - Set the encryption status for the volume.If your account is enabled for encryption by default, then encryption is automatically enabled and you can’t disable it. You can choose the KMS key to use to encrypt the volume.If your account is not enabled for encryption by default, encryption is optional. To encrypt the volume, for Encryption, choose Encrypt this volume and then select the KMS key to use to encrypt the volume.
Note
Encrypted volumes can be attached only to instances that support Amazon EBS encryption. For more information, see Amazon EBS encryption.
- (Optional) To assign custom tags to the volume, in the Tags section, choose Add tag, and then enter a tag key and value pair. .
- Choose Create volume.
Note
The volume is ready for use when the Volume state is available.
- To use the volume, attach it to an instance. For more information, see Attach an Amazon EBS volume to an instance.
Create a volume from a snapshot
Volumes created from snapshots load lazily in the background. This means that there is no need to wait for all of the data to transfer from Amazon S3 to your EBS volume before the instance can start accessing an attached volume and all its data. If your instance accesses data that hasn’t yet been loaded, the volume immediately downloads the requested data from Amazon S3, and then continues loading the rest of the volume data in the background. Volume performance is achieved after all blocks are downloaded and written to the volume. To avoid the initial performance hit in a production environment, see Initialize Amazon EBS volumes.
New EBS volumes that are created from encrypted snapshots are automatically encrypted. You can also encrypt a volume on-the-fly while restoring it from an unencrypted snapshot. Encrypted volumes can only be attached to instance types that support EBS encryption. For more information, see Supported instance types.
You can create a volume from a snapshot using one of the following methods.
To create an EBS volume from a snapshot using the console
- Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
- In the navigation pane, choose Volumes.
- Choose Create volume.
- For Volume type, choose the type of volume to create. For more information, see Amazon EBS volume types.General Purpose SSD
gp3
is the default selection. - For Size, enter the size of the volume, in GiB. For more information, see Constraints on the size and configuration of an EBS volume.
- (
io1
,io2
, andgp3
only) For IOPS, enter the maximum number of input/output operations per second (IOPS) that the volume should provide. - (
gp3
only) For Throughput, enter the throughput that the volume should provide, in MiB/s. - For Availability Zone, choose the Availability Zone in which to create the volume. A volume can be attached only to instances that are in the same Availability Zone.
- For Snapshot ID, select the snapshot from which to create the volume.
- Set the encryption status for the volume.If the selected snapshot is encrypted, or if your account is enabled for encryption by default, then encryption is automatically enabled and you can’t disable it. You can choose the KMS key to use to encrypt the volume.If the selected snapshot is unencrypted and your account is not enabled for encryption by default, encryption is optional. To encrypt the volume, for Encryption, choose Encrypt this volume and then select the KMS key to use to encrypt the volume.
Note
Encrypted volumes can be attached only to instances that support Amazon EBS encryption. For more information, see Amazon EBS encryption.
- (Optional) To assign custom tags to the volume, in the Tags section, choose Add tag, and then enter a tag key and value pair. .
- Choose Create Volume.
Note
The volume is ready for use when the Volume state is available.