调用ModifySecurityGroupEgressRule修改安全组出方向规则的描述信息。该接口只能修改描述信息,如果您需要修改安全组规则的策略、端口范围、授权对象等信息,请在ECS管理控制台修改。

接口说明

以下任意一组参数可以确定一条安全组出方向规则,只指定一个参数无法确定一条安全组规则。

  • 授权指定IP地址段的访问权限:IpProtocol、PortRange、(可选)SourcePortRange、NicType、Policy、DestCiderIp和(可选)SourceCidrIp。
  • 授权其他安全组的访问权限:IpProtocol、PortRange、(可选)SourcePortRange、NicType、Policy、(可选)DestCiderIp、DestGroupOwnerAccount和DestGroupId。

调试

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

请求参数

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

系统规定参数。取值:ModifySecurityGroupRule

IpProtocol String tcp

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

  • icmp
  • gre
  • tcp
  • udp
  • all:支持所有协议
PortRange String 80/80

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

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

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

SecurityGroupId String sg-bp67acfmxazb4p****

源端安全组ID。

DestGroupId String sg-bp67acfmxazb4p****

目的端安全组ID。

DestGroupOwnerId Long 1234567890

目的端安全组所属的账号ID,亦即UID。

DestGroupOwnerAccount String EcsforCloud@Alibaba.com

目的端安全组所属的账号登录名称。

DestCidrIp String 10.0.0.0/8

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

默认值:无

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

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

默认值:无

SourceCidrIp String 10.0.0.0/8

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

默认值:无

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

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

默认值:无

SourcePortRange String 80/80

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

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

访问权限。取值范围:

  • accept:接受访问。
  • drop:拒绝访问,不发回拒绝信息。

默认值:accept

Priority String 1

安全组规则优先级。取值范围:1~100

默认值:1

NicType String intranet

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

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

默认值:internet

在以下情况中,参数NicType取值只能为intranet:

  • 安全组规则的网络类型为专有网络VPC时,您必须设置NicType参数,且只能为intranet。
  • 设置安全组之间互相访问时,即指定了DestGroupId且没有指定DestCidrIp时,只能为intranet。
ClientToken String 123e4567-e89b-12d3-a456-426655440000

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

Description String This is a new securitygroup rule.

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

返回数据

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

请求ID。

示例

请求示例

https://ecs.aliyuncs.com/?Action=ModifySecurityGroupEgressRule
&SecurityGroupId=sg-bp67acfmxazb4p****
&DestGroupId=sg-bp67acfmxazb4p****
&SourceGroupOwnerAccount=EcsforCloud@Alibaba.com
&IpProtocol=tcp
&PortRange=80/80
&Policy=allow
&Description=This is a new securitygroup rule.
&<公共请求参数>

正常返回示例

XML 格式

<ModifySecurityGroupEgressRuleResponse>
      <RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
</ModifySecurityGroupEgressRuleResponse>

JSON 格式

{
    "RequestId":"CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}

错误码

HttpCode 错误码 错误信息 描述
404 InvalidSecurityGroupId.NotFound The specified SecurityGroupId does not exist. 指定的安全组在该用户账号下不存在,请您检查安全组id是否正确。
404 InvalidDestGroupId.NotFound The DestGroupId provided does not exist in our records. 指定的出方向安全组不存在。
400 OperationDenied The specified IpProtocol does not exist or IpProtocol and PortRange do not match. 指定的 IP 协议不存在,或与端口范围不匹配。
400 InvalidIpProtocol.Malformed The specified parameter "PortRange" is not valid. IP协议参数格式不正确,PortRange参数不正确。
403 InvalidDestGroupId.Mismatch NicType is required or NicType expects intranet. 请指定 NicType,或使用内网模式。
400 InvalidDestCidrIp.Malformed The specified parameter "DestCidrIp" is not valid. 指定的 DestCidrIp 无效,请您检查该参数是否正确。
403 MissingParameter The input parameter "DestGroupId" or "DestCidrIp" cannot be both blank. 参数 DestGroupId 和 DestCidrIp 不得为空。
400 InvalidPolicy.Malformed The specified parameter "Policy" is not valid. 指定的参数无效,请您检查该参数是否正确。
400 InvalidNicType.ValueNotSupported The specified NicType does not exist. 指定的网络类型不存在,请您检查网络类型是否正确。
400 InvalidNicType.Mismatch Specified nic type conflicts with the authorization record. 指定的 NIC 类型与规则信息冲突。
403 AuthorizationLimitExceed The limit of authorization records in the security group reaches. 安全组授权规则数达到上限,请您检查授权规则是否合理。
403 InvalidParamter.Conflict The specified SecurityGroupId should be different from the SourceGroupId. 授权与被授权安全组必须不同。
400 InvalidDestGroupId.Mismatch Specified security group and destination group are not in the same VPC. 指定的安全组和目标组不在同一个 VPC 下。
400 InvalidDestGroup.NotFound Specified destination security group does not exist. 指定的出方向安全组不存在。
400 VPCDisabled Can't use the SecurityGroup in VPC. VPC 不支持安全组。
400 InvalidPriority.Malformed The specified parameter "Priority" is not valid. 指定的 Priority 参数不合法。
400 InvalidPriority.ValueNotSupported The specified Priority is invalid. 您指定的优先级无效。
400 InvalidDestCidrIp.Malformed The specified parameter DestCidrIp is not valid. 指定的 DestCidrIp 无效,请您检查该参数是否正确。
500 InternalError The request processing has failed due to some unknown error. 内部错误,请重试。如果多次尝试失败,请提交工单。
403 InvalidNetworkType.Conflict The specified SecurityGroup network type should be same with SourceGroup network type (vpc or classic). 指定的 SecurityGroup 的网络类型必须与 SouceGroup 的网络类型一致。
403 InvalidSecurityGroup.IsSame The authorized SecurityGroupId should be different from the DestGroupId. 已授权的 SecurityGroupId 不能与 DestGroupId 相同。
400 InvalidNicType.ValueNotSupported The specified NicType is not valid. 指定的网络类型不存在,请您检查网络类型是否正确。
400 InvalidSecurityGroupDiscription.Malformed The specified security group rule description is not valid. 指定的安全组规则描述不合法。
404 SecurityGroupRule.NotFound The target security group rule do not exist. 指定的安全组规则不存在。
400 InvalidSecurityGroup.InvalidNetworkType The specified security group network type is not support this operation, please check the security group network types. For VPC security groups, ClassicLink must be enabled. 指定的安全组网络类型不支持此操作,请检查安全组网络类型。对于 VPC 安全组,必须启用 ClassicLink。
400 MissingParameter.Dest The parameter DestCidrIp or DestGroupId is essential. 参数“DestCidrIp”和“DestGroupId”不能同时为空。
400 InvalidParam.PortRange The specified param PortRange or SourcePortRange is not valid. should be integer and less than 65535, range separator is '/'. 指定的参数“PortRange”或“SourcePortRange”无效。应为整数且小于 65535,范围分隔符为“ /”。
400 InvalidIpProtocol.ValueNotSupported The specified parameter IpProtocol should not be null and only tcp, udp, icmp, gre or all is supported. Ignore case. 协议类型只能是 TCP 、UDP 、 ICMP 、 GRE 或者 All。
400 InvalidPriority.ValueNotSupported The parameter Priority is invalid. 指定的参数“Priority”无效。
400 InvalidParam.SourceIp %s 指定的参数“SourceIp”无效。
400 InvalidParam.DestIp %s 指定的参数“DestIp”无效。
400 InvalidParam.Ipv6DestCidrIp %s 您输入的参数无效。
400 InvalidParam.Ipv6SourceCidrIp %s 您输入的参数无效。
400 InvalidParam.Ipv4ProtocolConflictWithIpv6Address %s 您输入的参数无效,请检查 IPv4 协议下是否填写了 IPv6 地址。
400 InvalidParam.Ipv6ProtocolConflictWithIpv4Address %s 您输入的参数无效,请检查 IPv6 协议下是否填写了 IPv4 地址。
400 ILLEGAL_IPV6_CIDR %s 指定的 IPv6 地址无效。
400 InvalidSourcePortRange.Malformed The specified parameter "SourcePortRange" is not valid. 指定的参数“SourcePortRange”无效。

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