AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Container for the parameters to the AuthorizeSecurityGroupEgress operation. [VPC only] Adds the specified outbound (egress) rules to a security group for use with a VPC.

An outbound rule permits instances to send traffic to the specified IPv4 or IPv6 CIDR address ranges, or to the instances that are associated with the specified source security groups. When specifying an outbound rule for your security group in a VPC, the IpPermissions must include a destination for the traffic.

You specify a protocol for each rule (for example, TCP). For the TCP and UDP protocols, you must also specify the destination port or port range. For the ICMP protocol, you must also specify the ICMP type and code. You can use -1 for the type or code to mean all types or all codes.

Rule changes are propagated to affected instances as quickly as possible. However, a small delay might occur.

For information about VPC security group quotas, see Amazon VPC quotas.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.EC2.AmazonEC2Request
      Amazon.EC2.Model.AuthorizeSecurityGroupEgressRequest

Namespace: Amazon.EC2.Model
Assembly: AWSSDK.EC2.dll
Version: 3.x.y.z

Syntax

C#
public class AuthorizeSecurityGroupEgressRequest : AmazonEC2Request
         IAmazonWebServiceRequest

The AuthorizeSecurityGroupEgressRequest type exposes the following members

Constructors

Properties

NameTypeDescription
Public Property GroupId System.String

Gets and sets the property GroupId.

The ID of the security group.

Public Property IpPermissions System.Collections.Generic.List<Amazon.EC2.Model.IpPermission>

Gets and sets the property IpPermissions.

The sets of IP permissions. You can't specify a destination security group and a CIDR IP address range in the same set of permissions.

Public Property TagSpecifications System.Collections.Generic.List<Amazon.EC2.Model.TagSpecification>

Gets and sets the property TagSpecifications.

The tags applied to the security group rule.

Examples

This example adds a rule that grants access to the specified address ranges on TCP port 80.

To add a rule that allows outbound traffic to a specific address range


var client = new AmazonEC2Client();
var response = client.AuthorizeSecurityGroupEgress(new AuthorizeSecurityGroupEgressRequest 
{
    GroupId = "sg-1a2b3c4d",
    IpPermissions = new List<IpPermission> {
        new IpPermission {
            FromPort = 80,
            IpProtocol = "tcp",
            ToPort = 80
        }
    }
});


            

This example adds a rule that grants access to the specified security group on TCP port 80.

To add a rule that allows outbound traffic to a specific security group


var client = new AmazonEC2Client();
var response = client.AuthorizeSecurityGroupEgress(new AuthorizeSecurityGroupEgressRequest 
{
    GroupId = "sg-1a2b3c4d",
    IpPermissions = new List<IpPermission> {
        new IpPermission {
            FromPort = 80,
            IpProtocol = "tcp",
            ToPort = 80,
            UserIdGroupPairs = new List<UserIdGroupPair> {
                new UserIdGroupPair { GroupId = "sg-4b51a32f" }
            }
        }
    }
});


            

Version Information

.NET Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5, 4.0, 3.5