AWS ec2 documentation change
Summary
Added PowerShell V5 examples for starting instances, including DryRun permission validation
Security assessment
DryRun example demonstrates security validation but does not address a specific vulnerability.
Diff
diff --git a/ec2/latest/devguide/example_ec2_StartInstances_section.md b/ec2/latest/devguide/example_ec2_StartInstances_section.md index c4dba39db..25f81c90c 100644 --- a//ec2/latest/devguide/example_ec2_StartInstances_section.md +++ b//ec2/latest/devguide/example_ec2_StartInstances_section.md @@ -513,0 +514,49 @@ PowerShell +**Tools for PowerShell V5** + + +**Example 1: This example starts the specified instance.** + + + Start-EC2Instance -InstanceId i-12345678 + + +**Output:** + + + CurrentState InstanceId PreviousState + ------------ ---------- ------------- + Amazon.EC2.Model.InstanceState i-12345678 Amazon.EC2.Model.InstanceState + +**Example 2: This example starts the specified instances.** + + + @("i-12345678", "i-76543210") | Start-EC2Instance + + +**Example 3: This example starts the set of instances that are currently stopped. The Instance objects returned by Get-EC2Instance are piped to Start-EC2Instance. The syntax used by this example requires PowerShell version 3 or higher.** + + + (Get-EC2Instance -Filter @{ Name="instance-state-name"; Values="stopped"}).Instances | Start-EC2Instance + + +**Example 4: With PowerShell version 2, you must use New-Object to create the filter for the Filter parameter.** + + + $filter = New-Object Amazon.EC2.Model.Filter + $filter.Name = "instance-state-name" + $filter.Values = "stopped" + + (Get-EC2Instance -Filter $filter).Instances | Start-EC2Instance + + +**Example 5: This example validates permissions for starting an EC2 instance using the DryRun parameter without actually starting the instance. Note: This throws an exception if succeeded which is the expected behavior.** + + + Start-EC2Instance -InstanceId 'i-0abcdef123456' -Region 'us-west-1' -DryRun $true + + + * For API details, see [StartInstances](https://docs.aws.amazon.com/powershell/v5/reference) in _AWS Tools for PowerShell Cmdlet Reference (V5)_. + + + +