AWS ec2 documentation change
Summary
Added PowerShell V5 examples for revoking security group ingress rules
Security assessment
The examples show how to remove inbound access rules (including SSH port 22 restrictions), which relates to security hardening. However, there is no indication this addresses a specific security incident.
Diff
diff --git a/ec2/latest/devguide/example_ec2_RevokeSecurityGroupIngress_section.md b/ec2/latest/devguide/example_ec2_RevokeSecurityGroupIngress_section.md index 37be48be0..bc0acd47c 100644 --- a//ec2/latest/devguide/example_ec2_RevokeSecurityGroupIngress_section.md +++ b//ec2/latest/devguide/example_ec2_RevokeSecurityGroupIngress_section.md @@ -99,0 +100,47 @@ PowerShell +**Tools for PowerShell V5** + + +**Example 1: This example revokes access to TCP port 22 from the specified address range for the specified security group for EC2-VPC. Note that you must identify security groups for EC2-VPC using the security group ID not the security group name. The syntax used by this example requires PowerShell version 3 or higher.** + + + $ip = @{ IpProtocol="tcp"; FromPort="22"; ToPort="22"; IpRanges="203.0.113.0/24" } + Revoke-EC2SecurityGroupIngress -GroupId sg-12345678 -IpPermission $ip + + +**Example 2: With PowerShell version 2, you must use New-Object to create the IpPermission object.** + + + $ip = New-Object Amazon.EC2.Model.IpPermission + $ip.IpProtocol = "tcp" + $ip.FromPort = 22 + $ip.ToPort = 22 + $ip.IpRanges.Add("203.0.113.0/24") + + Revoke-EC2SecurityGroupIngress -GroupId sg-12345678 -IpPermission $ip + + +**Example 3: This example revokes access to TCP port 22 from the specified address range for the specified security group for EC2-Classic. The syntax used by this example requires PowerShell version 3 or higher.** + + + $ip = @{ IpProtocol="tcp"; FromPort="22"; ToPort="22"; IpRanges="203.0.113.0/24" } + + Revoke-EC2SecurityGroupIngress -GroupName "my-security-group" -IpPermission $ip + + +**Example 4: With PowerShell version 2, you must use New-Object to create the IpPermission object.** + + + $ip = New-Object Amazon.EC2.Model.IpPermission + $ip.IpProtocol = "tcp" + $ip.FromPort = 22 + $ip.ToPort = 22 + $ip.IpRanges.Add("203.0.113.0/24") + + Revoke-EC2SecurityGroupIngress -GroupName "my-security-group" -IpPermission $ip + + + * For API details, see [RevokeSecurityGroupIngress](https://docs.aws.amazon.com/powershell/v5/reference) in _AWS Tools for PowerShell Cmdlet Reference (V5)_. + + + +