A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.aws.amazon.com/powershell/latest/reference/items/Grant-EC2SecurityGroupEgress.html below:

EC2: Grant-EC2SecurityGroupEgress Cmdlet | AWS Tools for PowerShell

Example 1

$ip = @{ IpProtocol="tcp"; FromPort="80"; ToPort="80"; IpRanges="203.0.113.0/24" }
Grant-EC2SecurityGroupEgress -GroupId sg-12345678 -IpPermission $ip

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.

Example 2

$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

With PowerShell version 2, you must use New-Object to create the IpPermission object.

Example 3

$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 } )

This example grants access to the specified source security group on TCP port 80.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4