Menu
Amazon Elastic Compute Cloud
API Reference (API Version 2016-11-15)

RevokeSecurityGroupEgress

[EC2-VPC only] Removes one or more egress rules from a security group for EC2-VPC. This action doesn't apply to security groups for use in EC2-Classic. To remove a rule, the values that you specify (for example, ports) must match the existing rule's values exactly.

Each rule consists of the protocol and the IPv4 or IPv6 CIDR range or source security group. For the TCP and UDP protocols, you must also specify the destination port or range of ports. For the ICMP protocol, you must also specify the ICMP type and code. If the security group rule has a description, you do not have to specify the description to revoke the rule.

Rule changes are propagated to instances within the security group as quickly as possible. However, a small delay might occur.

Request Parameters

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see Common Query Parameters.

CidrIp

Not supported. Use a set of IP permissions to specify the CIDR.

Type: String

Required: No

DryRun

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Type: Boolean

Required: No

FromPort

Not supported. Use a set of IP permissions to specify the port.

Type: Integer

Required: No

GroupId

The ID of the security group.

Type: String

Required: Yes

IpPermissions.N

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

Type: Array of IpPermission objects

Required: No

IpProtocol

Not supported. Use a set of IP permissions to specify the protocol name or number.

Type: String

Required: No

SourceSecurityGroupName

Not supported. Use a set of IP permissions to specify a destination security group.

Type: String

Required: No

SourceSecurityGroupOwnerId

Not supported. Use a set of IP permissions to specify a destination security group.

Type: String

Required: No

ToPort

Not supported. Use a set of IP permissions to specify the port.

Type: Integer

Required: No

Response Elements

The following elements are returned by the service.

requestId

The ID of the request.

Type: String

return

Is true if the request succeeds, and an error otherwise.

Type: Boolean

Errors

For information about the errors that are common to all actions, see Common Client Errors.

Examples

Example 1

This example revokes the access that the specified security group has to the 205.192.0.0/16 and 205.159.0.0/16 IPv4 address ranges on TCP port 80.

Sample Request

https://ec2.amazonaws.com/?Action=RevokeSecurityGroupEgress
&GroupId=sg-1a2b3c4d
&IpPermissions.1.IpProtocol=tcp
&IpPermissions.1.FromPort=80
&IpPermissions.1.ToPort=80
&IpPermissions.1.IpRanges.1.CidrIp=205.192.0.0/16
&IpPermissions.1.IpRanges.2.CidrIp=205.159.0.0/16
&AUTHPARAMS

Example 2

This example revokes the access that the specified security group has to the security group with the ID sg-9a8d7f5c on TCP port 1433.

Sample Request

https://ec2.amazonaws.com/?Action=RevokeSecurityGroupEgress
&GroupId=sg-1a2b3c4d
&IpPermissions.1.IpProtocol=tcp
&IpPermissions.1.FromPort=1433
&IpPermissions.1.ToPort=1433
&IpPermissions.1.Groups.1.GroupId=sg-9a8d7f5c
&AUTHPARAMS

Example 3

This example revokes TCP port 22 access to the 203.0.113.4/32 address range for the security group sg-112233. The security group rule includes the description 'Access to office CT12'. Specifying the description to revoke the rule is optional, but if you do specify the description, it must match the existing rule's value exactly.

Sample Request

https://ec2.amazonaws.com/?Action=RevokeSecurityGroupEgress
&GroupId=sg-112233
&IpPermissions.1.IpProtocol=tcp
&IpPermissions.1.FromPort=22
&IpPermissions.1.ToPort=22
&IpPermissions.1.IpRanges.1.CidrIp=203.0.113.4/32
&IpPermissions.1.IpRanges.1.Description=Access to office CT12
&AUTHPARAMS

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: