AWS AWSEC2 documentation change
Summary
Updated troubleshooting guide with expanded force-stop instructions, added PowerShell examples, and clarified alternate instance recovery procedures
Security assessment
Changes focus on improving operational procedures for stopping/stuck instances and adding PowerShell support. No security vulnerabilities, mitigations, or security features are mentioned. The --force/--enforce parameters are existing features for instance management rather than security controls.
Diff
diff --git a/AWSEC2/latest/UserGuide/TroubleshootingInstancesStopping.md b/AWSEC2/latest/UserGuide/TroubleshootingInstancesStopping.md index 10b4b1c41..c3ab21645 100644 --- a//AWSEC2/latest/UserGuide/TroubleshootingInstancesStopping.md +++ b//AWSEC2/latest/UserGuide/TroubleshootingInstancesStopping.md @@ -53 +53 @@ There is no cost for instance usage while an instance is in the `stopping` state -Force the instance to stop using either the console or the AWS CLI. +You can force an instance to stop. If, after 10 minutes, the instance has not stopped, post a request for help on [AWS re:Post](https://repost.aws/). To help expedite a resolution, include the instance ID, and describe the steps that you've already taken. Alternatively, if you have a support plan, create a technical support case in the [Support Center](https://console.aws.amazon.com/support/home#/). @@ -62 +62 @@ Console -###### To force stop the instance using the console +###### To force stop the instance @@ -78 +78 @@ AWS CLI -###### To force stop the instance using the AWS CLI +###### To force stop the instance @@ -80 +80 @@ AWS CLI -Use the [stop-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/stop-instances.html) command and the `--force` option as follows: +Use the [stop-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/stop-instances.html) command with the `--force` option. @@ -83 +83,3 @@ Use the [stop-instances](https://awscli.amazonaws.com/v2/documentation/api/lates - aws ec2 stop-instances --instance-ids i-0123ab456c789d01e --force + aws ec2 stop-instances \ + --instance-ids i-1234567890abcdef0 \ + --force @@ -85 +87,11 @@ Use the [stop-instances](https://awscli.amazonaws.com/v2/documentation/api/lates -If, after 10 minutes, the instance has not stopped, post a request for help on [AWS re:Post](https://repost.aws/). To help expedite a resolution, include the instance ID, and describe the steps that you've already taken. Alternatively, if you have a support plan, create a technical support case in the [Support Center](https://console.aws.amazon.com/support/home#/). +PowerShell + + +###### To force stop the instance + +Use the [Stop-EC2Instance](https://docs.aws.amazon.com/powershell/latest/reference/items/Stop-EC2Instance.html) cmdlet and set `-Enforce` to `true`. + + + Stop-EC2Instance ` + -InstanceId i-1234567890abcdef0 ` + -Enforce $true @@ -122,0 +135,25 @@ For more information, see [Create an AMI from an instance](./creating-an-ami-ebs +If you are unable to create an AMI from the instance as described in the previous procedure, you can set up a replacement instance as follows: + +###### (Alternate) To create a replacement instance using the console + + 1. Select the instance and choose **Description** , **Block devices**. Select each volume and make note of its volume ID. Be sure to note which volume is the root volume. + + 2. In the navigation pane, choose **Volumes**. Select each volume for the instance, and choose **Actions** , **Create Snapshot**. + + 3. In the navigation pane, choose **Snapshots**. Select the snapshot that you just created, and choose **Actions** , **Create Volume**. + + 4. Launch an instance with the same operating system as the stuck instance. Note the volume ID and device name of its root volume. + + 5. In the navigation pane, choose **Instances** , select the instance that you just launched, and choose **Instance state** , **Stop instance**. + + 6. In the navigation pane, choose **Volumes** , select the root volume of the stopped instance, and choose **Actions** , **Detach Volume**. + + 7. Select the root volume that you created from the stuck instance, choose **Actions** , **Attach Volume** , and attach it to the new instance as its root volume (using the device name that you made note of). Attach any additional non-root volumes to the instance. + + 8. In the navigation pane, choose **Instances** and select the replacement instance. Choose **Instance state** , **Start instance**. Verify that the instance is working. + + 9. Select the stuck instance, choose **Instance state** , **Terminate (delete) instance**. If the instance also gets stuck terminating, Amazon EC2 automatically forces it to terminate within a few hours. + + + + @@ -128,3 +165 @@ AWS CLI - 1. Create an AMI from the stuck instance using the [create-image](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/create-image.html) command and the `--no-reboot` option as follows. - - aws ec2 create-image --instance-id i-0123ab456c789d01e --name "AMI" --description "AMI for replacement instance" --no-reboot + 1. Create an AMI from the stuck instance using the [create-image](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/create-image.html) command with the `--no-reboot` option. @@ -132 +167,5 @@ AWS CLI - 2. Launch a new instance from the AMI using the [run-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/run-instances.html) command as follows. + aws ec2 create-image \ + --instance-id i-1234567890abcdef0 \ + --name "my-replacement-ami" \ + --description ""AMI for replacement instance" \ + --no-reboot @@ -134 +173 @@ AWS CLI - aws ec2 run-instances --image-id ami-1a2b3c4d --count 1 --instance-type c3.large --key-name MyKeyPair --security-groups MySecurityGroup + 2. Launch a new instance from the AMI that you just created, using the [run-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/run-instances.html) command. @@ -138 +177 @@ AWS CLI - 4. Terminate the stuck instance using the [terminate-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/terminate-instances.html) command as follows. + 4. (Optional) Terminate the stuck instance using the [terminate-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/terminate-instances.html) command. @@ -145,3 +184 @@ AWS CLI -If you are unable to create an AMI from the instance as described in the previous procedure, you can set up a replacement instance as follows: - -###### (Alternate) To create a replacement instance using the console +PowerShell @@ -149 +185,0 @@ If you are unable to create an AMI from the instance as described in the previou - 1. Select the instance and choose **Description** , **Block devices**. Select each volume and make note of its volume ID. Be sure to note which volume is the root volume. @@ -151 +187 @@ If you are unable to create an AMI from the instance as described in the previou - 2. In the navigation pane, choose **Volumes**. Select each volume for the instance, and choose **Actions** , **Create Snapshot**. +###### To create a replacement instance using the AWS CLI @@ -153 +189 @@ If you are unable to create an AMI from the instance as described in the previou - 3. In the navigation pane, choose **Snapshots**. Select the snapshot that you just created, and choose **Actions** , **Create Volume**. + 1. Create an AMI from the stuck instance using the [New-EC2Image](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2Image.html) cmdlet and set `-NoReboot` to `true`. @@ -155 +191,5 @@ If you are unable to create an AMI from the instance as described in the previou - 4. Launch an instance with the same operating system as the stuck instance. Note the volume ID and device name of its root volume. + New-EC2Image ` + -InstanceId i-1234567890abcdef0 ` + -Name "my-replacement-ami" ` + -Description "AMI for replacement instance" ` + -NoReboot $true @@ -157 +197 @@ If you are unable to create an AMI from the instance as described in the previou - 5. In the navigation pane, choose **Instances** , select the instance that you just launched, and choose **Instance state** , **Stop instance**. + 2. Launch a new instance from the AMI that you just created, using the [New-EC2Instance](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2Instance.html) cmdlet. @@ -159 +199 @@ If you are unable to create an AMI from the instance as described in the previou - 6. In the navigation pane, choose **Volumes** , select the root volume of the stopped instance, and choose **Actions** , **Detach Volume**. + 3. Verify that the new instance is working. @@ -161 +201 @@ If you are unable to create an AMI from the instance as described in the previou - 7. Select the root volume that you created from the stuck instance, choose **Actions** , **Attach Volume** , and attach it to the new instance as its root volume (using the device name that you made note of). Attach any additional non-root volumes to the instance. + 4. (Optional) Terminate the stuck instance using the [Remove-EC2Instance](https://docs.aws.amazon.com/powershell/latest/reference/items/Remove-EC2Instance.html) cmdlet. @@ -163,3 +203 @@ If you are unable to create an AMI from the instance as described in the previou - 8. In the navigation pane, choose **Instances** and select the replacement instance. Choose **Instance state** , **Start instance**. Verify that the instance is working. - - 9. Select the stuck instance, choose **Instance state** , **Terminate (delete) instance**. If the instance also gets stuck terminating, Amazon EC2 automatically forces it to terminate within a few hours. + Remove-EC2Instance -InstanceId i-1234567890abcdef0