AWS AWSEC2 documentation change
Summary
Updated console workflow steps for stopping/starting instances, separated CLI/PowerShell commands for stop/start operations, added instance query examples, and expanded launch time documentation
Security assessment
Changes focus on improving operational documentation clarity and command examples. No security vulnerabilities, mitigations, or security features are mentioned.
Diff
diff --git a/AWSEC2/latest/UserGuide/Stop_Start.md b/AWSEC2/latest/UserGuide/Stop_Start.md index 68d482d24..9a40cc766 100644 --- a//AWSEC2/latest/UserGuide/Stop_Start.md +++ b//AWSEC2/latest/UserGuide/Stop_Start.md @@ -57 +57 @@ Console - 3. On the **Storage** tab, verify that **Root device type** is **EBS**. Otherwise, you can't stop the instance. + 3. Choose **Instance state** , **Stop instance**. If this option is disabled, either the instance is already stopped or its root device is an instance store volume. @@ -59 +59 @@ Console - 4. Choose **Instance state** , **Stop instance**. If this option is disabled, either the instance is already stopped or its root device is an instance store volume. + 4. When prompted for confirmation, choose **Stop**. It can take a few minutes for the instance to stop. @@ -61 +61 @@ Console - 5. When prompted for confirmation, choose **Stop**. It can take a few minutes for the instance to stop. + 5. To start a stopped instance, select the instance, and choose **Instance state** , **Start instance**. @@ -63 +63 @@ Console - 6. To start a stopped instance, select the instance, and choose **Instance state** , **Start instance**. + 6. It can take a few minutes for the instance to enter the `running` state. @@ -65,3 +65 @@ Console - 7. It can take a few minutes for the instance to enter the `running` state. - - 8. If you stopped an Amazon EBS-backed instance and it appears "stuck" in the `stopping` state, you can forcibly stop it. For more information, see [Troubleshoot Amazon EC2 instance stop issues](./TroubleshootingInstancesStopping.html). + 7. If you stopped an Amazon EBS-backed instance and it appears "stuck" in the `stopping` state, you can forcibly stop it. For more information, see [Troubleshoot Amazon EC2 instance stop issues](./TroubleshootingInstancesStopping.html). @@ -75 +73,10 @@ AWS CLI -###### To stop and start an instance +###### To stop an instance + +Use the [stop-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/stop-instances.html) command. + + + aws ec2 stop-instances --instance-ids i-1234567890abcdef0 + +###### To start an instance + +Use the [start-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/start-instances.html) command. @@ -77 +84,2 @@ AWS CLI -Use the [stop-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/stop-instances.html) and [start-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/start-instances.html) commands. + + aws ec2 start-instances --instance-ids i-1234567890abcdef0 @@ -82 +90,8 @@ PowerShell -###### To stop and start an instance +###### To stop an instance + +Use the [Stop-EC2Instance](https://docs.aws.amazon.com/powershell/latest/reference/items/Stop-EC2Instance.html) cmdlet. + + + Stop-EC2Instance -InstanceId i-1234567890abcdef0 + +###### To start an instance @@ -84 +99,4 @@ PowerShell -Use the [Stop-EC2Instance](https://docs.aws.amazon.com/powershell/latest/reference/items/Stop-EC2Instance.html) and [Start-EC2Instance](https://docs.aws.amazon.com/powershell/latest/reference/items/Start-EC2Instance.html) cmdlets. +Use the [Start-EC2Instance](https://docs.aws.amazon.com/powershell/latest/reference/items/Start-EC2Instance.html) cmdlet. + + + Start-EC2Instance -InstanceId i-1234567890abcdef0 @@ -108,0 +127,71 @@ You can find all of your running and stopped instances across all AWS Regions on +Alternatively, you can run a command or cmdlet in each Region where you have instances. + +AWS CLI + + +###### To get the number of EC2 instances in a Region + +Use the following [describe-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-instances.html) command to count the instances in the current Region. You must run this command in each Region where you have instances. + + + aws ec2 describe-instances \ + --region us-east-2 \ + --query "length(Reservations[].Instances[])" + +The following is example output. + + + 27 + +###### To get summary info about your EC2 instances in a Region + +Use the following [describe-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-instances.html) command. You must run this command in each Region where you have instances. + + + >aws ec2 describe-instances \ + --region us-east-2 \ + --query "Reservations[].Instances[].[InstanceId,InstanceType,PrivateIpAddress]" \ + --output table + +The following is example output. + + + --------------------------------------------------------- + | DescribeInstances | + +---------------------+---------------+-----------------+ + | i-0e3e777f4362f1bf7| t2.micro | 10.0.12.9 | + | i-09453945dcf1529e9| t2.micro | 10.0.143.213 | + | i-08fd74f3f1595fdbd| m7i.4xlarge | 10.0.1.103 | + +---------------------+---------------+-----------------+ + +PowerShell + + +###### To get the number of EC2 instances in a Region + +Use the following [Get-EC2Instance](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2Instance.html) cmdlet. + + + (Get-EC2Instance -Region us-east-2).Instances.Length + +The following is example output. + + + 27 + +###### To get summary info about your EC2 instances in a Region + +Use the following [Get-EC2Instance](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2Instance.html) cmdlet. You must run this command in each Region where you have instances. + + + (Get-EC2Instance).Instances | Select InstanceId, InstanceType, PrivateIpAddress + +The following is example output. + + + InstanceId InstanceType PrivateIpAddress + ---------- ------------ ---------------- + i-0e3e777f4362f1bf7 t2.micro 10.0.12.9 + i-09453945dcf1529e9 t2.micro 10.0.143.213 + i-08fd74f3f1595fdbd m7i.4xlarge 10.0.1.103 + @@ -113 +202,13 @@ When you describe an instance, the launch time for the instance is its most rece -To find the most recent launch time using the console, select the instance and look under **Instance details** on the **Details** tab. To find the attachment time for the primary network interface, look under **Network interfaces** on the **Networking** tab. +Console + + +###### To find the most recent launch time + +Select the instance and find **Launch time** under **Instance details** on the **Details** tab. + +###### To find the initial launch time + +Select the instance and find the primary network interface (device index is 0) under **Network interfaces** on the **Networking** tab. + +AWS CLI + @@ -115 +216 @@ To find the most recent launch time using the console, select the instance and l -Using the AWS CLI, run the following [describe-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-instances.html) command to display both the initial launch time and the most recent launch time for the specified instance. +###### To find the initial and most recent launch times @@ -116,0 +218 @@ Using the AWS CLI, run the following [describe-instances](https://awscli.amazona +Use the following [describe-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-instances.html) command to display both the initial launch time and the most recent launch time for the specified instance. @@ -118 +220,4 @@ Using the AWS CLI, run the following [describe-instances](https://awscli.amazona - aws ec2 describe-instances --instance-id i-09453945dcf1529e9 --query 'Reservations[*].Instances[*].{InstanceID:InstanceId,InitialLaunch:NetworkInterfaces[0].Attachment.AttachTime,LastLaunch:LaunchTime}' + + aws ec2 describe-instances \ + --instance-id i-09453945dcf1529e9 \ + --query 'Reservations[].Instances[].{InstanceID:InstanceId,InitialLaunch:NetworkInterfaces[0].Attachment.AttachTime,LastLaunch:LaunchTime}' @@ -122,0 +228 @@ The following is example output. + [ @@ -125,2 +231,2 @@ The following is example output. - "InitialLaunch": "2024-03-31T00:47:08+00:00", - "LastLaunch": "2024-06-30T00:24:06+00:00" + "InitialLaunch": "2024-04-19T00:47:08+00:00", + "LastLaunch": "2024-05-27T06:24:06+00:00" @@ -127,0 +234,28 @@ The following is example output. + ] + +PowerShell + + +###### To find the most recent launch time + +Use the following [Get-EC2Instance](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2Instance.html) cmdlet. + + + (Get-EC2Instance -InstanceId i-09453945dcf1529e9).Instances.LaunchTime + +The following is example output. + + + Monday, May 27, 2024 6:24:06 AM + +###### To find the initial launch time + +Use the following [Get-EC2Instance](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2Instance.html) cmdlet. + + + (Get-EC2Instance -InstanceId i-09453945dcf1529e9).Instances.NetworkInterfaces.Attachment.AttachTime + +The following is example output. + + + Friday, April 19, 2024 12:47:08 AM