AWS AWSEC2 documentation change
Summary
Updated documentation for configuring instance storage volumes, including revised console instructions, CLI/PowerShell examples, and added guidance for modifying block device mappings on running instances
Security assessment
Changes focus on operational procedures for managing storage configurations (resizing volumes, suppressing attachments, ephemeral storage). No explicit references to security vulnerabilities, encryption, access controls, or security best practices are present in the diff.
Diff
diff --git a/AWSEC2/latest/UserGuide/instance-block-device-mapping.md b/AWSEC2/latest/UserGuide/instance-block-device-mapping.md index d71bc94a6..778125fb2 100644 --- a//AWSEC2/latest/UserGuide/instance-block-device-mapping.md +++ b//AWSEC2/latest/UserGuide/instance-block-device-mapping.md @@ -20 +20 @@ By default, an instance that you launch includes any storage devices specified i -###### Contents +###### Tasks @@ -40 +40 @@ Console -###### To add volumes to an instance using the console +###### To update the volumes for an instance at launch @@ -42,5 +42 @@ Console - 1. Open the Amazon EC2 console. - - 2. From the dashboard, choose **Launch Instance**. - - 3. On the **Choose an Amazon Machine Image (AMI)** page, select the AMI to use and choose **Select**. + 1. Follow the procedure to [launch an instance](./ec2-launch-instance-wizard.html), but don't launch the instance until you've completed the following steps to update the volumes. @@ -48 +44 @@ Console - 4. Follow the wizard to complete the **Choose an Instance Type** and **Configure Instance Details** pages. + 2. (Optional) To add a volume, choose **Configure storage** , **Add new volume**. Select the volume size and volume type. @@ -50 +46 @@ Console - 5. On the **Add Storage** page, you can modify the root volume, EBS volumes, and instance store volumes as follows: + 3. (Optional) To suppress a volume that was specified by the block device mapping of the AMI, choose **Configure storage** , **Remove**. @@ -52 +48 @@ Console - * To change the size of the root volume, locate the **Root** volume under the **Type** column, and change its **Size** field. + 4. (Optional) To modify the configuration of an EBS volume, on the **Configure storage** pane, choose **Advanced**. Expand the information for the volume, and make whatever changes you need. @@ -54 +50 @@ Console - * To suppress an EBS volume specified by the block device mapping of the AMI used to launch the instance, locate the volume and click its **Delete** icon. + 5. In the **Summary** panel, review your instance configuration, and then choose **Launch instance**. For more information, see [Launch an EC2 instance using the launch instance wizard in the console](./ec2-launch-instance-wizard.html). @@ -56 +51,0 @@ Console - * To add an EBS volume, choose **Add New Volume** , choose **EBS** from the **Type** list, and fill in the fields (**Device** , **Snapshot** , and so on). @@ -58 +52,0 @@ Console - * To suppress an instance store volume specified by the block device mapping of the AMI used to launch the instance, locate the volume, and choose its **Delete** icon. @@ -60 +53,0 @@ Console - * To add an instance store volume, choose **Add New Volume** , select **Instance Store** from the **Type** list, and select a device name from **Device**. @@ -62 +55 @@ Console - 6. Complete the remaining wizard pages, and choose **Launch**. +AWS CLI @@ -64,0 +58 @@ Console +###### To update the volumes for an instance at launch @@ -65,0 +60 @@ Console +Use the [run-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/run-instances.html) command with the `--block-device-mappings` option. @@ -67 +61,0 @@ Console -Command line @@ -68,0 +63 @@ Command line + --block-device-mappings file://mapping.json @@ -70 +65 @@ Command line -###### To add volumes to an instance using the AWS CLI +For example, suppose that an AMI block device mapping specifies the following: @@ -72 +67 @@ Command line -Use the [run-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/run-instances.html) command with the `--block-device-mappings` option to specify a block device mapping for an instance at launch. + * `/dev/xvda` \- EBS root volume @@ -74 +69 @@ Use the [run-instances](https://awscli.amazonaws.com/v2/documentation/api/latest -For example, suppose that an EBS-backed AMI specifies the following block device mapping for a Linux instance: + * `/dev/sdh` \- EBS volume created from `snap-1234567890abcdef0` @@ -76 +71 @@ For example, suppose that an EBS-backed AMI specifies the following block device - * `/dev/sdb` = `ephemeral0` + * `/dev/sdj` \- Empty EBS volume with a size of `100` @@ -78 +73 @@ For example, suppose that an EBS-backed AMI specifies the following block device - * `/dev/sdh` = `snap-1234567890abcdef0` + * `/dev/sdb` \- Instance store volume `ephemeral0` @@ -80 +74,0 @@ For example, suppose that an EBS-backed AMI specifies the following block device - * `/dev/sdj` = `100` @@ -84,2 +78 @@ For example, suppose that an EBS-backed AMI specifies the following block device - -To prevent `/dev/sdj` from attaching to an instance launched from this AMI, use the following mapping. +Suppose that the following is the instance block device mapping in `mapping.json`. @@ -87,0 +81,7 @@ To prevent `/dev/sdj` from attaching to an instance launched from this AMI, use + [ + { + "DeviceName": "/dev/xvda", + "Ebs": { + "VolumeSize": 100 + } + }, @@ -91,5 +91 @@ To prevent `/dev/sdj` from attaching to an instance launched from this AMI, use - } - -To increase the size of `/dev/sdh` to `300 GiB`, specify the following mapping. Notice that you don't need to specify the snapshot ID for `/dev/sdh`, because specifying the device name is enough to identify the volume. - - + }, @@ -100,0 +97,4 @@ To increase the size of `/dev/sdh` to `300 GiB`, specify the following mapping. + }, + { + "DeviceName": "/dev/sdc", + "VirtualName": "ephemeral1" @@ -101,0 +102 @@ To increase the size of `/dev/sdh` to `300 GiB`, specify the following mapping. + ] @@ -103 +104 @@ To increase the size of `/dev/sdh` to `300 GiB`, specify the following mapping. -To increase the size of the root volume at instance launch, first call [describe-images](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-images.html) with the ID of the AMI to verify the device name of the root volume. For example, `"RootDeviceName": "/dev/xvda"`. To override the size of the root volume, specify the device name of the root device used by the AMI and the new volume size. +The instance block device mapping does the following: @@ -104,0 +106 @@ To increase the size of the root volume at instance launch, first call [describe + * Overrides the size of the root volume, `/dev/xvda`, increasing it to 100 GiB. @@ -106,6 +108 @@ To increase the size of the root volume at instance launch, first call [describe - { - "DeviceName": "/dev/xvda", - "Ebs": { - "VolumeSize": 100 - } - } + * Prevents `/dev/sdj` from attaching to the instance. @@ -113 +110 @@ To increase the size of the root volume at instance launch, first call [describe -To attach an additional instance store volume, `/dev/sdc`, specify the following mapping. If the instance type doesn't support multiple instance store volumes, this mapping has no effect. If the instance supports NVMe instance store volumes, they are automatically enumerated and assigned an NVMe device name. + * Overrides the size of `/dev/sdh`, increasing it to 300 GiB. Notice that you don't need to specify the snapshot ID again. @@ -114,0 +112,53 @@ To attach an additional instance store volume, `/dev/sdc`, specify the following + * Adds an ephemeral volume, `/dev/sdc`. If the instance type doesn't support multiple instance store volumes, this has no effect. If the instance type supports NVMe instance store volumes, they are automatically enumerated and included in the instance block device mapping and can't be overridden. + + + + +PowerShell + + +###### To update the volumes for an instance at launch + +Use the `-BlockDeviceMapping` parameter with the [New-EC2Instance](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2Instance.html) cmdlet with the `-BlockDeviceMapping` parameter. + + + -BlockDeviceMapping $bdm + +Suppose that the following is the instance block device mapping in `$bdm`. + + + $bdm = @() + + $root = New-Object -TypeName Amazon.EC2.Model.BlockDeviceMapping + $root.DeviceName = "/dev/xvda" + $ebs1 = New-Object -TypeName Amazon.EC2.Model.EbsBlockDevice + $ebs1.VolumeSize = 100 + $root.Ebs = $ebs1 + $bdm += $root + + $sdj = New-Object -TypeName Amazon.EC2.Model.BlockDeviceMapping + $sdj.DeviceName = "/dev/sdj" + $sdj.NoDevice = "" + $bdm += $sdj + + $sdh = New-Object -TypeName Amazon.EC2.Model.BlockDeviceMapping + $sdh.DeviceName = "/dev/sdh" + $ebs2 = New-Object -TypeName Amazon.EC2.Model.EbsBlockDevice + $ebs2.VolumeSize = 300 + $sdh.Ebs = $ebs2 + $bdm += $sdh + + $sdc = New-Object -TypeName Amazon.EC2.Model.BlockDeviceMapping + $sdc.DeviceName = "/dev/sdc" + $sdc.VirtualName = "ephemeral1" + $bdm += $sdc + +The instance block device mapping does the following: + + * Overrides the size of the root volume, `/dev/xvda`, increasing it to 100 GiB. + + * Prevents `/dev/sdj` from attaching to the instance. + + * Overrides the size of `/dev/sdh`, increasing it to 300 GiB. Notice that you don't need to specify the snapshot ID again. + + * Adds an ephemeral volume, `/dev/sdc`. If the instance type doesn't support multiple instance store volumes, this has no effect. If the instance type supports NVMe instance store volumes, they are automatically enumerated and included in the instance block device mapping and can't be overridden. @@ -116,4 +165,0 @@ To attach an additional instance store volume, `/dev/sdc`, specify the following - { - "DeviceName": "/dev/sdc", - "VirtualName": "ephemeral1" - } @@ -121 +166,0 @@ To attach an additional instance store volume, `/dev/sdc`, specify the following -###### To add volumes to an instance using the AWS Tools for Windows PowerShell @@ -123 +167,0 @@ To attach an additional instance store volume, `/dev/sdc`, specify the following -Use the `-BlockDeviceMapping` parameter with the [New-EC2Instance](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2Instance.html) command (AWS Tools for Windows PowerShell). @@ -127 +171,6 @@ Use the `-BlockDeviceMapping` parameter with the [New-EC2Instance](https://docs. -You can use the [modify-instance-attribute](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/modify-instance-attribute.html) command to update the block device mapping of a running instance. You do not need to stop the instance before changing this attribute. +You do not need to stop the instance before changing this attribute. + +AWS CLI + + +###### To update the block device mapping of a running instance @@ -128,0 +178 @@ You can use the [modify-instance-attribute](https://awscli.amazonaws.com/v2/docu +Use the [modify-instance-attribute](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/modify-instance-attribute.html) command. @@ -130 +180 @@ You can use the [modify-instance-attribute](https://awscli.amazonaws.com/v2/docu - aws ec2 modify-instance-attribute --instance-id i-1a2b3c4d --block-device-mappings file://mapping.json +Add the `--block-device-mappings` option: @@ -132 +182,4 @@ You can use the [modify-instance-attribute](https://awscli.amazonaws.com/v2/docu -For example, to preserve the root volume at instance termination, specify the following in `mapping.json`. + + --block-device-mappings file://mapping.json + +In `mapping.json`, specify the updates. For example, the following update changes the root device volume to persist. @@ -144 +197 @@ For example, to preserve the root volume at instance termination, specify the fo -Alternatively, you can use the `-BlockDeviceMapping` parameter with the [Edit-EC2InstanceAttribute](https://docs.aws.amazon.com/powershell/latest/reference/items/Edit-EC2InstanceAttribute.html) command (AWS Tools for Windows PowerShell). +PowerShell @@ -146 +198,0 @@ Alternatively, you can use the `-BlockDeviceMapping` parameter with the [Edit-EC -## View the EBS volumes in an instance block device mapping @@ -148 +200 @@ Alternatively, you can use the `-BlockDeviceMapping` parameter with the [Edit-EC -You can easily enumerate the EBS volumes mapped to an instance. +###### To update the block device mapping of a running instance @@ -150 +202 @@ You can easily enumerate the EBS volumes mapped to an instance. -###### Note +Use the [Edit-EC2InstanceAttribute](https://docs.aws.amazon.com/powershell/latest/reference/items/Edit-EC2InstanceAttribute.html) cmdlet. @@ -152 +204,17 @@ You can easily enumerate the EBS volumes mapped to an instance. -For instances launched before the release of the 2009-10-31 API, AWS can't display the block device mapping. You must detach and reattach the volumes so that AWS can display the block device mapping.