ModifySecurityGroupRule_云服务器 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.

接口说明

指定安全组规则 ID 修改安全组规则时,您需要注意以下使用限制:

  • 安全组规则的授权对象分为 IPv4 的 CIDR 地址块(或 IP 地址)、IPv6 的 CIDR 地址块(或 IP 地址)、安全组、前缀列表,您不能通过该接口修改已有安全组规则的授权对象类型。如原来授权对象类型为 IPv4 的 CIDR 地址块,您可以更改为另一个 IPv4 的 CIDR 地址块(或 IP 地址),但不能修改为 IPv6 的 CIDR 地址块(或 IP 地址)、安全组或前缀列表。

  • 字段不支持从非空修改为空,如果需要修改建议先增加一条新规则,再删除当前规则。

流控信息

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

授权信息

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

具体说明如下:展开详情

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

请求参数

字段名称字段详情
RegionIdstring

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

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

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

示例值:123e4567-e89b-12d3-a456-426655440000
SecurityGroupIdstring

安全组 ID。

示例值:sg-bp67acfmxazb4p****参考取值来源:
    CreateSecurityGroup
    DescribeSecurityGroups
SecurityGroupRuleIdstring

安全组规则 ID。您可以通过 DescribeSecurityGroupAttribute 查询安全组规则 ID。

示例值:sgr-bp67acfmxa123b***参考取值来源:
    DescribeSecurityGroupAttribute
Policystring

访问权限。取值范围: 展开详情

示例值:accept
Prioritystring

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

示例值:1正则:^\d+$
IpProtocolstring

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

示例值:ALL
SourceCidrIpstring

设置访问权限的源端 IPv4 CIDR 地址块。支持 CIDR 格式和 IPv4 格式的 IP 地址范围。展开详情

示例值:10.0.0.0/8
Ipv6SourceCidrIpstring

设置访问权限的源端 IPv6 CIDR 地址块。支持 CIDR 格式和 IPv6 格式的 IP 地址范围。展开详情

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

设置访问权限的源端安全组 ID。至少设置一项SourceGroupId或者SourceCidrIp参数。展开详情

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

设置访问权限的源端前缀列表 ID。您可以调用 DescribePrefixLists 查询可以使用的前缀列表 ID。展开详情

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

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

示例值:80/80
DestCidrIpstring

目的端 IPv4 CIDR 地址块。支持 CIDR 格式和 IPv4 格式的 IP 地址范围。展开详情

示例值:10.0.0.0/8
Ipv6DestCidrIpstring

目的端 IPv6 CIDR 地址段。支持 CIDR 格式和 IPv6 格式的 IP 地址范围。展开详情

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

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

示例值:80/80
SourceGroupOwnerAccountstring

跨账户设置安全组规则时,源端安全组所属的阿里云账户。 展开详情

示例值:EcsforCloud@Alibaba.com参考取值来源:
    DescribeSecurityGroupAttribute
SourceGroupOwnerIdinteger<int64>

跨账户设置安全组规则时,源端安全组所属的阿里云账户。 展开详情

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

网卡类型。展开详情

示例值:intranet
Descriptionstring

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

示例值:This is a new security group rule.

返回参数

字段名称字段详情
RequestIdstring

请求 ID。

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

返回示例

错误返回示例

错误码

全局错误码
HTTP 状态码错误码错误信息操作
400
OperationDenied
The specified IpProtocol does not exist or IpProtocol and PortRange do not match.诊断
400
InvalidIpProtocol.Malformed
The specified parameter PortRange is not valid.诊断
400
InvalidSourceCidrIp.Malformed
The specified parameter SourceCidrIp is not valid.诊断
400
InvalidPolicy.Malformed
The specified parameter Policy is not valid.诊断
400
InvalidNicType.ValueNotSupported
The specified NicType does not exist.诊断
400
InvalidNicType.Mismatch
The specified NicType conflicts with the authorization record.诊断
400
InvalidSourceGroupId.Mismatch
Specified security group and source group are not in the same VPC.诊断
400
InvalidSourceGroup.NotFound
Specified source security group does not exist.诊断
400
InvalidPriority.Malformed
The parameter Priority is invalid.诊断
400
InvalidPriority.ValueNotSupported
The parameter Priority is invalid.诊断
400
InvalidSecurityGroupDiscription.Malformed
The specified security group rule description is not valid.诊断
400
MissingParameter.Source
One of the parameters SourceCidrIp, SourceGroupId or SourcePrefixListId must be specified.诊断
400
InvalidParam.PortRange
The specified parameter %s is not valid. It should be two integers less than 65535 in ?/? format.诊断
400
InvalidIpProtocol.ValueNotSupported
The parameter IpProtocol must be specified with case insensitive TCP, UDP, ICMP, GRE or All.诊断
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
InvalidParam.DestCidrIp
The specified parameter %s is not valid.诊断
400
InvalidSourcePortRange.Malformed
The specified parameter SourcePortRange is not valid.诊断
400
InvalidSecurityGroupId.Malformed
The specified parameter SecurityGroupId is not valid.诊断
400
InvalidParam.SourceCidrIp
The specified param SourceCidrIp is not valid.诊断
400
InvalidParameter.Conflict
IPv6 and IPv4 addresses cannot exist at the same time.诊断
400
InvalidParam.SecurityGroupRuleId
The specified parameter SecurityGroupRuleId is not valid.诊断
400
InvalidOperation.ModifySgRuleEntityType
The source or destination type of the rules cannot be modified.诊断
400
AuthorizationLimitExceed
The limit of authorization records in the security group reaches.诊断
400
InvalidParam.ProtocolAndPortRangeMismatch
The specified Protocol and PortRange do not match.诊断
400
InvalidParam.ProtocolAndAddressFamilyMismatch
The specified Protocol and address family do not match.诊断
400
InvalidParam.PrefixListAddressFamilyMismatch
The address family of the prefix list does not match the rule.诊断
400
InvalidParam.InvalidModifyRuleRequest
The request parameters are illegal.诊断
400
InvalidOperation.ModifyNicType
NicType is not allowed to modify.诊断
400
InvalidParamter.Conflict
The specified SourceCidrIp should be different from the DestCidrIp.诊断
400
InvalidOperation.RuleDuplicate
%s.诊断
403
InvalidSourceGroupId.Mismatch
NicType is required or NicType expects intrnet.诊断
403
MissingParameter
The input parameter SourceGroupId or SourceCidrIp cannot be both blank.诊断
403
AuthorizationLimitExceed
The limit of authorization records in the security group reaches.诊断
403
InvalidParamter.Conflict
The specified SecurityGroupId should be different from the SourceGroupId.诊断
403
InvalidNetworkType.Mismatch
The specified SecurityGroup network type should be same with SourceGroup network type (vpc or classic).诊断
403
InvalidOperation.ResourceManagedByCloudProduct
%s诊断
404
InvalidSecurityGroupId.NotFound
The specified SecurityGroupId does not exist.诊断
404
InvalidSourceGroupId.NotFound
The SourceGroupId provided does not exist in our records.诊断
404
SecurityGroupRule.NotFound
The target security group rule not exist.诊断
404
InvalidPrefixListId.NotFound
The specified prefix list was not found.诊断
404
InvalidSecurityGroupRuleId.NotFound
The specified SecurityGroupRuleId is not exists.诊断
500
InternalError
The request processing has failed due to some unknown error.诊断

变更历史

变更时间变更内容概要操作
2024-06-27
变更错误码400
2023-08-23
变更错误码404
2023-04-07
变更错误码400
变更错误码500
2023-01-05
变更错误码500
变更请求参数IpProtocol
变更请求参数PortRange
变更请求参数NicType
新增请求参数SecurityGroupRuleId
2022-09-05
变更错误码400
变更错误码403
  • 1
  • 2
  • 10 条/页

相关示例

2024年08月20日