RevokeSecurityGroupEgress_云服务器 ECS_API文档

插件下载了解更多
VS Code 插件
安装插件之前,确保已安装 VS Code安装插件之前,确保已安装 VS Code
Alibaba Cloud Developer Toolkit is a collection of extensions that can help access Alibaba Cloud services in Visual Studio Code.
JetBrains 插件
安装插件之前,确保已安装 JetBrains IDE安装插件之前,确保已安装 JetBrains IDE
The Alibaba Cloud Developer Toolkit for JetBrains makes it easier to access Alibaba Cloud services.

接口说明

注意 阿里云已于 2024 年 7 月 8 日对该接口进行了校验规则调整。当删除不存在的安全组规则时,从返回成功调整为返回错误码:“InvalidSecurityGroupRule.RuleNotExist“。请您及时做好错误码兼容,避免影响线上业务。
该接口有两种传参方式来删除安全组规则:

  • 通过指定安全组规则 ID 参数删除规则(推荐)。

    • 如果指定的安全组规则 ID 不存在,会报异常。
  • 通过指定 Permissions 参数删除规则。

    • 如果匹配的安全组规则不存在,此次调用成功,但不会删除规则。
    • 删除一条安全组规则必要的相关参数:
      • 目的端设置:选择 DestCidrIp(IPv4 地址)、Ipv6DestCidrIp(IPv6 地址)、DestPrefixListId(前缀列表 ID)、DestGroupId(目的端安全组)中的一项。
      • 目的端口范围:PortRange。
      • 协议类型:IpProtocol。
      • 权限策略:Policy。
说明 不支持同时设置安全组规则 ID 和 Permissions 参数。

请求示例

  • 根据安全组规则 ID 删除。
"SecurityGroupId":"sg-bp67acfmxazb4p****", //设置安全组 ID
"SecurityGroupRuleId":["sgr-bpdfmk****","sgr-bpdfmg****"] //设置安全组规则 ID
  • 根据 IP 地址段删除。
"SecurityGroupId":"sg-bp67acfmxazb4ph***",
"Permissions":[
  {
    "IpProtocol":"TCP", //设置协议类型
    "DestCidrIp":"10.0.0.0/8", //设置目的端 IP 地址段
    "PortRange":"22/22", //设置目的端口范围
    "Policy":"accept" // 设置访问策略
  }
]
  • 根据目的端安全组删除。
"SecurityGroupId":"sg-bp67acfmxazb4ph***",
"Permissions":[
  {
    "DestGroupId":"sg-bp67acfmxa123b****", //设置目的端安全组 ID
    "IpProtocol":"TCP",
    "PortRange":"22/22",
    "Policy":"accept"
  }
]
  • 根据指定前缀列表删除。
"SecurityGroupId":"sg-bp67acfmxazb4ph***",
"Permissions":[
  {
    "IpProtocol":"TCP",
    "DestPrefixListId":"pl-x1j1k5ykzqlixdcy****", //设置目的端前缀列表 ID
    "PortRange":"22/22",
    "Policy":"accept",
  }
]

流控信息

请求速率为1000/60(s)。

授权信息

如下是此API对应的授权信息,用于RAM权限策略语句的Action元素中,为RAM用户或RAM角色授予调用此API的权限。请通过 RAM 访问控制设置,使用方法可参考访问控制帮助文档

具体说明如下:展开详情

操作访问级别资源类型条件关键字关联操作
ecs:RevokeSecurityGroupEgress
Delete
SecurityGroup
acs:ecs:{#regionId}:{#accountId}:securitygroup/{#securitygroupId}
ecs:tag
ecs:tag
ecs:tag

请求参数

字段名称字段详情
RegionIdstring

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

示例值:cn-hangzhou参考取值来源:
    DescribeRegions
ClientTokenstring

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

示例值:473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
SecurityGroupIdstring

安全组 ID。

示例值:sg-bp67acfmxazb4p****参考取值来源:
    CreateSecurityGroup
    DescribeSecurityGroups
SecurityGroupRuleIdarray<string>

安全组规则 ID 数组。数组长度:0~100。

子级条数 <= 100
Permissionsarray<object>

安全组规则数组。数组长度:0~100。

子级条数 <= 100
deprecatedPolicystring

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

示例值:accept
deprecatedPrioritystring

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

示例值:1
deprecatedIpProtocolstring

已废弃。请使用Permissions.N.IpProtocol来指定协议类型。

示例值:TCP
deprecatedDestCidrIpstring

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

示例值:10.0.0.0/8
deprecatedIpv6DestCidrIpstring

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

示例值:2001:db8:1233:1a00::***
deprecatedDestGroupIdstring

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

示例值:sg-bp67acfmxa123b****参考取值来源:
    DescribeSecurityGroupAttribute
deprecatedDestPrefixListIdstring

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

示例值:pl-x1j1k5ykzqlixdcy****
deprecatedPortRangestring

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

示例值:22/22
deprecatedSourceCidrIpstring

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

示例值:10.0.0.0/8
deprecatedIpv6SourceCidrIpstring

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

示例值:2001:db8:1234:1a00::***
deprecatedSourcePortRangestring

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

示例值:22/22
deprecatedDestGroupOwnerAccountstring

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

示例值:Test@aliyun.com参考取值来源:
    DescribeSecurityGroupAttribute
deprecatedDestGroupOwnerIdinteger<int64>

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

注意 该字段类型为 Long,在序列化/反序列化的过程中可能导致精度丢失,请注意数值不得大于 9007199254740991。
示例值:12345678910
deprecatedNicTypestring

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

示例值:intranet
deprecatedDescriptionstring

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

示例值:This is description.

返回参数

字段名称字段详情
RequestIdstring

请求 ID。

示例值:473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

返回示例

错误码

全局错误码
HTTP 状态码错误码错误信息操作
400
InvalidIpProtocol.ValueNotSupported
The parameter IpProtocol must be specified with case insensitive TCP, UDP, ICMP, GRE or All.诊断
400
InvalidIpPortRange.Malformed
The specified parameter PortRange is not valid.诊断
400
InvalidDestCidrIp.sMalformed
The specified parameter DestCidrIp is not valid.诊断
400
MissingParameter
The input parameter DestGroupId or DestCidrIp cannot be both blank.诊断
400
InvalidPolicy.Malformed
The specified parameter %s is not valid.诊断
400
InvalidNicType.ValueNotSupported
The specified parameter %s is not valid.诊断
400
InvalidDestGroupId.Mismatch
Specified security group and destination group are not in the same VPC.诊断
400
InvalidDestCidrIp.Malformed
The specified parameter DestCidrIp is not valid.诊断
400
MissingParameter.Dest
One of the parameters DestCidrIp, Ipv6DestCidrIp, DestGroupId or DestPrefixListId in %s must be specified.诊断
400
InvalidParam.PortRange
The specified parameter %s is not valid. It should be two integers less than 65535 in ?/? format.诊断
400
InvalidPriority.Malformed
The parameter Priority is invalid.诊断
400
InvalidPriority.ValueNotSupported
The specified parameter %s is invalid.诊断
400
InvalidParam.SourceIp
The Parameters SourceCidrIp and Ipv6SourceCidrIp in %s cannot be set at the same time.诊断
400
InvalidParam.DestIp
The Parameters DestCidrIp and Ipv6DestCidrIp in %s cannot be set at the same time.诊断
400
InvalidParam.Ipv6DestCidrIp
The specified parameter %s is not valid.诊断
400
InvalidParam.Ipv6SourceCidrIp
The specified parameter %s is not valid.诊断
400
InvalidParam.Ipv4ProtocolConflictWithIpv6Address
IPv6 address cannot be specified for IPv4-specific protocol.诊断
400
InvalidParam.Ipv6ProtocolConflictWithIpv4Address
IPv4 address cannot be specified for IPv6-specific protocol.诊断
400
InvalidParameter.Ipv6CidrIp
The specified Ipv6CidrIp is not valid.诊断
400
InvalidGroupAuthParameter.OperationDenied
The security group can not authorize to enterprise level security group.诊断
400
InvalidSecurityGroupId.Malformed
The specified parameter SecurityGroupId is not valid.诊断
400
InvalidPortRange.Malformed
The specified parameter PortRange must set.诊断
400
InvalidSourcePortRange.Malformed
The specified parameter SourcePortRange is not valid.诊断
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 parameter %s is not valid.诊断
400
InvalidParam.DestCidrIp
The specified parameter %s is not valid.诊断
400
InvalidParam.Permissions
The specified parameter Permissions cannot coexist with other parameters.诊断
400
InvalidParam.DuplicatePermissions
There are duplicate permissions in the specified parameter Permissions.诊断
400
InvalidParam.SecurityGroupRuleId
The specified parameter SecurityGroupRuleId is not valid.诊断
400
InvalidParam.SecurityGroupRuleIdRepeated
The specified parameter SecurityGroupRuleId is repeated.诊断
400
InvalidGroupParameter.OperationDenied
The attributes Policy, SourceGroupId, DestGroupId of enterprise level security groups are not allowed to be set or modified.诊断
400
InvalidSecurityGroupRule.RuleNotExist
The specified rule does not exist.诊断
400
InvalidParam.ProtocolNotSupportPortRangeList
The specified protocol does not support the port range list.诊断
400
InvalidPortRangeListId.NotFound
The specified port range list was not found.诊断
401
InvalidOperation.SecurityGroupNotAuthorized
The specified security group is not authorized to operate.诊断
403
InvalidNicType.Mismatch
Specified nic type conflicts with the authorization record.诊断
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.诊断
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.诊断
404
InvalidDestGroupId.NotFound
The DestGroupId provided does not exist in our records.诊断
404
InvalidSecurityGroupRuleId.NotFound
The specified SecurityGroupRuleId is not exists.诊断
404
InvalidPrefixListId.NotFound
The specified prefix list was not found.诊断

变更历史

变更时间变更内容概要操作
2025-04-01
变更错误码400
变更请求参数Permissions
2024-12-04
新增错误码401
2024-06-20
变更错误码400
2023-11-21
变更错误码400
2023-04-07
变更错误码400
变更错误码404
删除错误码500
  • 1
  • 2
  • 10 条/页

相关示例