AWS code-library documentation change
Summary
Added PowerShell V5 examples for Grant-EC2SecurityGroupEgress with IP ranges and security group references
Security assessment
The change adds documentation about configuring egress rules which are security controls, but there's no evidence of addressing a specific vulnerability
Diff
diff --git a/code-library/latest/ug/ec2_example_ec2_AuthorizeSecurityGroupEgress_section.md b/code-library/latest/ug/ec2_example_ec2_AuthorizeSecurityGroupEgress_section.md index b816a1b94..e10119bcd 100644 --- a//code-library/latest/ug/ec2_example_ec2_AuthorizeSecurityGroupEgress_section.md +++ b//code-library/latest/ug/ec2_example_ec2_AuthorizeSecurityGroupEgress_section.md @@ -124,0 +125,37 @@ PowerShell +**Tools for PowerShell V5** + + +**Example 1: This example defines an egress rule for the specified security group for EC2-VPC. The rule grants access to the specified IP address range on TCP port 80. The syntax used by this example requires PowerShell version 3 or higher.** + + + $ip = @{ IpProtocol="tcp"; FromPort="80"; ToPort="80"; IpRanges="203.0.113.0/24" } + Grant-EC2SecurityGroupEgress -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 = 80 + $ip.ToPort = 80 + $ip.IpRanges.Add("203.0.113.0/24") + + Grant-EC2SecurityGroupEgress -GroupId sg-12345678 -IpPermission $ip + + +**Example 3: This example grants access to the specified source security group on TCP port 80.** + + + $ug = New-Object Amazon.EC2.Model.UserIdGroupPair + $ug.GroupId = "sg-1a2b3c4d" + $ug.UserId = "123456789012" + + Grant-EC2SecurityGroupEgress -GroupId sg-12345678 -IpPermission @( @{ IpProtocol="tcp"; FromPort="80"; ToPort="80"; UserIdGroupPairs=$ug } ) + + + * For API details, see [AuthorizeSecurityGroupEgress](https://docs.aws.amazon.com/powershell/v5/reference) in _AWS Tools for PowerShell Cmdlet Reference (V5)_. + + + +