调用RevokeSecurityGroupEgress删除一条或多条出方向安全组规则。

接口说明

安全组的API文档中,流量的发起端为源端(Source),数据传输的接收端为目的端(Dest)。

当前接口存在两种传参方式来删除规则,您可以选择其中一种。

  • 您可以通过指定安全组规则ID参数方式删除规则(推荐)。
    • 如果指定的安全组规则ID不存在,会报异常。
    • 不支持同时设置Permissions.N前缀和标识已废弃的参数。
    • 请求示例:
      
          http(s)://ecs.aliyuncs.com/?Action=RevokeSecurityGroupEgress
          &SecurityGroupId=sg-bp67acfmxazb4p****
          &SecurityGroupRuleId.1=sgr-bpdfmk****
          &SecurityGroupRuleId.2=sgr-bpdfmg****
          &<公共请求参数>
          
  • 您可以通过指定Permissions.N前缀参数来删除规则。
    • 如果匹配的安全组规则不存在,此次调用成功,但不会删除规则。
    • 不支持设置安全组规则ID和其它不带Permissions.N前缀的参数。
    • 以下任意一组参数可以确定一条安全组规则,只指定一个参数无法确定一条安全组规则。
      • 撤销对指定IP地址段的访问权限,如以下请求示例:IpProtocol、PortRange、(可选)SourcePortRange、NicType、Policy、(可选)SourceCidrIp和DestCidrIp。
        
                http(s)://ecs.aliyuncs.com/?Action=RevokeSecurityGroupEgress
                &SecurityGroupId=sg-bp67acfmxazb4ph***
                &Permissions.1.IpProtocol=TCP
                &Permissions.1.DestCidrIp=10.0.0.0/8
                &Permissions.1.PortRange=-22/22
                &Permissions.1.NicType=intranet
                &Permissions.1.Policy=accept
                &<公共请求参数>
                    
      • 撤销其他安全组的访问权限。如以下请求示例:IpProtocol、PortRange、(可选)SourcePortRange、NicType、Policy、(可选)SourceCidrIp和DestGroupId。
        
                http(s)://ecs.aliyuncs.com/?Action=RevokeSecurityGroupEgress
                &SecurityGroupId=sg-bp67acfmxazb4ph***
                &Permissions.1.DestGroupId=sg-bp67acfmxa123b****
                &Permissions.1.IpProtocol=TCP
                &Permissions.1.PortRange=22/22
                &Permissions.1.NicType=intranet
                &Permissions.1.Policy=accept
                &<公共请求参数>
                    
      • 撤销指定前缀列表的访问权限。如以下请求示例:IpProtocol、PortRange、(可选)SourcePortRange、NicType、Policy、(可选)SourceCidrIp和DestPrefixListId。
        
                http(s)://ecs.aliyuncs.com/?Action=RevokeSecurityGroupEgress
                &SecurityGroupId=sg-bp67acfmxazb4ph***
                &Permissions.1.IpProtocol=TCP
                &Permissions.1.DestPrefixListId=pl-x1j1k5ykzqlixdcy****
                &Permissions.1.PortRange=-22/22
                &Permissions.1.NicType=intranet
                &Permissions.1.Policy=accept
                &<公共请求参数>
                    

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Action String RevokeSecurityGroupEgress

系统规定参数。取值:RevokeSecurityGroupEgress

RegionId String cn-hangzhou

安全组所属地域ID。您可以调用DescribeRegions查看最新的阿里云地域列表。

ClientToken String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

保证请求幂等性。从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken只支持ASCII字符,且不能超过64个字符。更多详情,请参见如何保证幂等性

SecurityGroupId String sg-bp67acfmxazb4p****

安全组ID。

SecurityGroupRuleId.N String sgr-bp67acfmxa123b***

安全组规则ID。

通过安全组规则ID删除时,该参数必填。

Permissions.N.Policy String accept

访问权限。取值范围:

  • accept:接受访问。
  • drop:拒绝访问,不返回拒绝信息,表现为发起端请求超时或者无法建立连接的类似信息。

默认值:accept。

N的取值范围:1~100。

Permissions.N.Priority String 1

安全组规则优先级。数字越小,代表优先级越高。取值范围:1~100。

默认值:1。

N的取值范围:1~100。

Permissions.N.IpProtocol String TCP

传输层协议。取值不区分大小写。取值范围:

  • TCP。
  • UDP。
  • ICMP。
  • ICMPv6。
  • GRE。
  • ALL:支持所有协议。

N的取值范围:1~100。

Permissions.N.DestCidrIp String 10.0.0.0/8

需要撤销访问权限的目的端IPv4 CIDR地址块。支持CIDR格式和IPv4格式的IP地址范围。

N的取值范围:1~100。

Permissions.N.Ipv6DestCidrIp String 2001:db8:1233:1a00::***

需要撤销访问权限的目的端IPv6 CIDR地址块。支持CIDR格式和IPv6格式的IP地址范围。

N的取值范围:1~100。

说明 仅在支持IPv6的VPC类型ECS实例上有效,且该参数与DestCidrIp参数不可同时设置。
Permissions.N.DestGroupId String sg-bp67acfmxa123b****

需要撤销访问权限的目的端安全组ID。

  • 至少设置一项DestGroupId或者DestCidrIpIpv6DestCidrIpDestPrefixListId参数中的一项。
  • 如果指定了DestGroupId没有指定参数DestCidrIp,则参数NicType取值只能为intranet。
  • 如果同时指定了DestGroupIdDestCidrIp,则默认以DestCidrIp为准。

您需要注意:

  • 企业安全组不支持授权安全组访问。
  • 普通安全组支持授权的安全组数量最多为20个。

N的取值范围:1~100。

Permissions.N.DestPrefixListId String pl-x1j1k5ykzqlixdcy****

需要撤销访问权限的目的端前缀列表。您可以调用DescribePrefixLists查询可以使用的前缀列表ID。

注意事项:

  • 安全组的网络类型为经典网络时,不支持设置前缀列表。关于安全组以及前缀列表使用限制的更多信息,请参见安全组使用限制
  • 当您指定了DestCidrIpIpv6DestCidrIpDestGroupId参数中的一个时,将忽略该参数。

N的取值范围:1~100。

Permissions.N.PortRange String 22/22

安全组开放的传输层协议相关的端口范围。取值范围:

  • TCP/UDP协议:取值范围为1~65535。使用正斜线(/)隔开起始端口和终止端口。例如:1/200。
  • ICMP协议:-1/-1。
  • GRE协议:-1/-1。
  • ALL:-1/-1。

N的取值范围:1~100。

Permissions.N.SourceCidrIp String 10.0.0.0/8

源端IPv4 CIDR地址段。支持CIDR格式和IPv4格式的IP地址范围。

用于支持五元组规则,请参见安全组五元组规则

N的取值范围:1~100。

Permissions.N.Ipv6SourceCidrIp String 2001:db8:1234:1a00::***

源端IPv6 CIDR地址段。支持CIDR格式和IPv6格式的IP地址范围。

用于支持五元组规则,请参见安全组五元组规则

N的取值范围:1~100。

说明 仅在支持IPv6的VPC类型ECS实例上有效,且该参数与DestCidrIp参数不可同时设置。
Permissions.N.SourcePortRange String 22/22

安全组开放的传输层协议相关的源端端口范围。取值范围:

  • TCP/UDP协议:取值范围为1~65535。使用正斜线(/)隔开起始端口和终止端口。例如:1/200。
  • ICMP协议:-1/-1。
  • GRE协议:-1/-1。
  • ALL:-1/-1。

用于支持五元组规则,请参见安全组五元组规则

N的取值范围:1~100。

Permissions.N.DestGroupOwnerAccount String Test@aliyun.com

撤销跨账户授权的安全组规则时,目的端安全组所属的阿里云账户。

  • 如果DestGroupOwnerAccountDestGroupOwnerId均未设置,则认为是撤销您其他安全组的访问权限。
  • 如果已经设置参数DestCidrIp,则参数DestGroupOwnerAccount无效。

N的取值范围:1~100。

Permissions.N.DestGroupOwnerId String 12345678910

撤销跨账户授权的安全组规则时,目的端安全组所属的阿里云账户。

  • 如果DestGroupOwnerIdDestGroupOwnerAccount均未设置,则认为是撤销您其他安全组的访问权限。
  • 如果您已经设置参数DestCidrIp,则参数DestGroupOwnerId无效。

N的取值范围:1~100。

Permissions.N.NicType String intranet

经典网络类型安全组规则的网卡类型。取值范围:

  • internet:公网网卡。
  • intranet:内网网卡。

专有网络VPC类型安全组规则无需设置网卡类型,默认为intranet,只能为intranet。

撤销安全组之间授权规则,即指定了SourceGroupId参数时,只能为intranet。

默认值:internet。

N的取值范围:1~100。

Permissions.N.Description String This is description.

安全组规则的描述。长度为1~512个字符。

N的取值范围:1~100。

Policy String accept

已废弃。请使用Permissions.N.Policy来设置访问权限。

Priority String 1

已废弃。请使用Permissions.N.Priority来指定规则优先级。

IpProtocol String TCP

已废弃。请使用Permissions.N.IpProtocol来指定传输层协议。

DestCidrIp String 10.0.0.0/8

已废弃。请使用Permissions.N.DestCidrIp来指定目的端IPv4 CIDR地址块。

Ipv6DestCidrIp String 2001:db8:1233:1a00::***

已废弃。请使用Permissions.N.Ipv6DestCidrIp来指定目的端IPv6 CIDR地址块。

DestGroupId String sg-bp67acfmxa123b****

已废弃。请使用Permissions.N.DestGroupId来指定目的端安全组ID。

DestPrefixListId String pl-x1j1k5ykzqlixdcy****

已废弃。请使用Permissions.N.DestPrefixListId来指定源端前缀列表ID。

PortRange String 22/22

已废弃。请使用Permissions.N.PortRange来指定端口范围。

SourceCidrIp String 10.0.0.0/8

已废弃。请使用Permissions.N.SourceCidrIp来指定源端IPv4 CIDR地址段。

Ipv6SourceCidrIp String 2001:db8:1234:1a00::***

已废弃。请使用Permissions.N.Ipv6SourceCidrIp来指定源端IPv6 CIDR地址段。

SourcePortRange String 22/22

已废弃。请使用Permissions.N.SourcePortRange来指定源端端口范围。

DestGroupOwnerAccount String Test@aliyun.com

已废弃。请使用Permissions.N.DestGroupOwnerAccount来指定目的端安全组所属的阿里云账户。

DestGroupOwnerId Long 12345678910

已废弃。请使用Permissions.N.DestGroupOwnerId来指定目的端安全组所属的阿里云账户ID。

NicType String intranet

已废弃。请使用Permissions.N.NicType来指定网卡类型。

Description String This is description.

已废弃。请使用Permissions.N.Description来指定规则的描述。

返回数据

名称 类型 示例值 描述
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

请求ID。

示例

请求示例

http(s)://ecs.aliyuncs.com/?Action=RevokeSecurityGroupEgress
&RegionId=cn-hangzhou
&ClientToken=473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
&SecurityGroupId=sg-bp67acfmxazb4p****
&SecurityGroupRuleId.1.IpProtocol=sg-bp67acfmxazb4f****
&SecurityGroupRuleId.2.DestCidrIp=sg-bp67acfmxazb4k****
&公共请求参数

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<RevokeSecurityGroupEgressResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
</RevokeSecurityGroupEgressResponse>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}

错误码

HttpCode 错误码 错误信息 描述
400 InvalidIpPortRange.Malformed The specified parameter PortRange is not valid. IP协议相关的端口号范围格式不正确。
400 InvalidDestCidrIp.sMalformed The specified parameter DestCidrIp is not valid. 指定的参数 DestCidrIp 不合法。
400 MissingParameter The input parameter DestGroupId or DestCidrIp cannot be both blank. 参数 DestGroupId 和 DestCidrIp 不得为空。
400 InvalidDestGroupId.Mismatch Specified security group and destination group are not in the same VPC. 指定的安全组和目标组不在同一个 VPC 下。
400 InvalidDestCidrIp.Malformed The specified parameter DestCidrIp is not valid. 指定的 DestCidrIp 无效,请您检查该参数是否正确。
400 InvalidPriority.Malformed The parameter Priority is invalid. 指定的参数 Priority 无效。
400 InvalidSecurityGroupId.Malformed The specified parameter SecurityGroupId is not valid. 指定的参数 SecurityGroupId 无效。
400 InvalidSourcePortRange.Malformed The specified parameter SourcePortRange is not valid. 指定的参数 SourcePortRange 无效。
400 InvalidSecurityGroupDiscription.Malformed The specified security group rule description is not valid. 指定的安全组规则描述不合法。
400 NotSupported.ClassicNetworkPrefixList The prefix list is not supported when the network type of security group is classic. 安全组的网络类型为经典网络,不支持前缀列表。
400 InvalidParam.SourceCidrIp The specified param SourceCidrIp is not valid. 参数SourceCidrIp不合法。
400 InvalidParam.DestCidrIp The specified parameter DestCidrIp is invalid. 指定的参数“DestCidrIp”无效。
400 InvalidParam.Permissions The specified parameter Permissions cannot coexist with other parameters. 指定的参数Permissions不能与其他参数同时存在。
400 InvalidParam.DuplicatePermissions There are duplicate permissions in the specified parameter Permissions. 指定的参数Permissions中存在重复的规则。
403 InvalidNicType.Mismatch Specified nic type conflicts with the authorization record. 指定的 NIC 类型与规则信息冲突。
403 InvalidGroupAuthItem.NotFound Specified group authorized item does not exist in our records. 指定的组授权条目不存在。
403 InvalidSecurityGroup.IsSame The authorized SecurityGroupId should be different from the DestGroupId. 已授权的 SecurityGroupId 不能与 DestGroupId 相同。
403 InvalidParamter.Conflict The specified SecurityGroupId should be different from the SourceGroupId. 授权与被授权安全组必须不同。
403 InvalidOperation.ResourceManagedByCloudProduct %s 云产品托管的安全组不支持修改操作。
404 InvalidSecurityGroupId.NotFound The specified SecurityGroupId does not exist. 指定的安全组在该用户账号下不存在,请您检查安全组 ID 是否正确。
404 InvalidDestGroupId.NotFound The DestGroupId provided does not exist in our records. 指定的出方向安全组不存在。
500 InvalidPrefixListId.NotFound The specified prefix list was not found. 前缀列表不存在。
500 InvalidSecurityGroupId.NotFound %s 指定的安全组 ID 不存在。
500 InternalError The request processing has failed due to some unknown error. 内部错误,请重试。

访问错误中心查看更多错误码。