AWS AWSEC2 documentation change
Summary
Restructured documentation for modifying DeleteOnTermination attribute, consolidated command line instructions, and added PowerShell examples
Security assessment
Changes improve operational documentation for volume persistence configuration but do not address vulnerabilities or introduce new security features. DeleteOnTermination is an existing data management feature, not a security control
Diff
diff --git a/AWSEC2/latest/UserGuide/preserving-volumes-on-termination.md b/AWSEC2/latest/UserGuide/preserving-volumes-on-termination.md index 08a46e6f2..260bf8c00 100644 --- a//AWSEC2/latest/UserGuide/preserving-volumes-on-termination.md +++ b//AWSEC2/latest/UserGuide/preserving-volumes-on-termination.md @@ -42,3 +42 @@ To verify if an Amazon EBS volume will be deleted on instance termination, view -Using the console, you can change the `DeleteOnTermination` attribute when you launch an instance. To change this attribute for a running instance, you must use the command line. - -Use one of the following methods to change the root volume to persist at launch. +You can change the `DeleteOnTermination` attribute when you launch an instance or for a running instance. @@ -62,10 +60 @@ Console -Command line - - -###### To change the root volume of an instance to persist at launch using the commmand line - -When you launch an EBS-backed instance, you can use one of the following commands to change the root device volume to persist. For more information about these command line interfaces, see [Access Amazon EC2](./concepts.html#access-ec2). - - * [run-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/run-instances.html) (AWS CLI) - - * [New-EC2Instance](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2Instance.html) (AWS Tools for Windows PowerShell) +AWS CLI @@ -73,0 +63 @@ When you launch an EBS-backed instance, you can use one of the following command +###### To change the root volume of an instance to persist at launch @@ -74,0 +65 @@ When you launch an EBS-backed instance, you can use one of the following command +Use the [run-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/run-instances.html) command to change the value of `DeleteOnTermination` in the block device mapping. @@ -76,3 +67 @@ When you launch an EBS-backed instance, you can use one of the following command -In the block device mappings for the volumes that you want to persist, include `--DeleteOnTermination`, and specify `false`. - -For example, to persist a volume add the following option to your `run-instances` command: +For example, to persist a volume, add the `--block-device-mappings` option: @@ -83 +72 @@ For example, to persist a volume add the following option to your `run-instances -In `mapping.json`, specify the device name, for example `/dev/sda1` or `/dev/xvda`, and for `--DeleteOnTermination`, specify `false`. +In `mapping.json`, specify the device name, for example `/dev/sda1` or `/dev/xvda`, and for `DeleteOnTermination`, specify `false`. @@ -95 +84 @@ In `mapping.json`, specify the device name, for example `/dev/sda1` or `/dev/xvd -## Change the root volume of a running instance to persist +PowerShell @@ -97 +85,0 @@ In `mapping.json`, specify the device name, for example `/dev/sda1` or `/dev/xvd -You can use one of the following commands to change the root device volume of a running EBS-backed instance to persist. For more information about these command line interfaces, see [Access Amazon EC2](./concepts.html#access-ec2). @@ -99 +87 @@ You can use one of the following commands to change the root device volume of a - * [modify-instance-attribute](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/modify-instance-attribute.html) (AWS CLI) +###### To change the root volume of an instance to persist at launch @@ -101 +89 @@ You can use one of the following commands to change the root device volume of a - * [Edit-EC2InstanceAttribute](https://docs.aws.amazon.com/powershell/latest/reference/items/Edit-EC2InstanceAttribute.html) (AWS Tools for Windows PowerShell) +Use the [New-EC2Instance](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2Instance.html) cmdlet to change the value of `DeleteOnTermination` in the block device mapping. @@ -102,0 +91 @@ You can use one of the following commands to change the root device volume of a +For example, to persist a volume, add the `-BlockDeviceMapping` option: @@ -104,0 +94 @@ You can use one of the following commands to change the root device volume of a + -BlockDeviceMapping $bdm @@ -106 +96 @@ You can use one of the following commands to change the root device volume of a -For example, use the following command: +In `bdm`, specify the device name, for example `/dev/sda1` or `/dev/xvda`, and for `DeleteOnTermination`, specify `false`. @@ -109 +99,21 @@ For example, use the following command: - aws ec2 modify-instance-attribute --instance-id i-1234567890abcdef0 --block-device-mappings file://mapping.json + $ebd = New-Object -TypeName Amazon.EC2.Model.EbsBlockDevice + $ebd.DeleteOnTermination = false + $bdm = New-Object -TypeName Amazon.EC2.Model.BlockDeviceMapping + $bdm.DeviceName = "device_name" + $bdm.Ebs = $ebd + +## Change the root volume of a running instance to persist + +You can change the root device volume of a running EBS-backed instance to persist. + +AWS CLI + + +###### To change the root volume to persist + +Use the [modify-instance-attribute](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/modify-instance-attribute.html) command. + + + aws ec2 modify-instance-attribute \ + --instance-id i-1234567890abcdef0 \ + --block-device-mappings file://mapping.json @@ -122,0 +133,7 @@ In `mapping.json`, specify the device name, for example `/dev/sda1` or `/dev/xvd +PowerShell + + +###### To change the root volume to persist + +Use the [Edit-EC2InstanceAttribute](https://docs.aws.amazon.com/powershell/latest/reference/items/Edit-EC2InstanceAttribute.html) cmdlet. +