You need to enable JavaScript to run this app.
导航

AuthorizeSecurityGroupEgress

最近更新时间2024.04.22 19:01:29

首次发布时间2021.07.29 14:11:53

调用 AuthorizeSecurityGroupEgress 接口,为安全组添加一条出方向规则。

调试

请求参数

参数名称
类型
是否必选
示例值
描述
ActionStringAuthorizeSecurityGroupEgress系统规定参数。取值: AuthorizeSecurityGroupEgress。
VersionString2020-04-01API版本信息,取值为:2020-04-01。

SecurityGroupId

String

sg-bp67acfmxazb4p****

安全组ID。
您可以调用 DescribeSecurityGroups 接口,查询安全组的ID。

Protocol

String

all

协议类型。取值如下:

  • tcp:TCP协议。
  • udp:UDP协议。
  • icmp:ICMP协议。
  • icmpv6:ICMPV6协议。

    说明

    IPv6功能正在邀测中,如需试用,请联系客户经理。

  • all:支持所有协议。

PortStart

Integer

22

端口范围开始值。

  • Protocol 传入tcp或udp时,取值范围为1~65535。
  • Protocol 传入icmp、icmpv6或all时,仅支持传入-1,表示不限制端口。

PortEnd

Integer

22

端口范围结束值。

  • Protocol 传入tcp或udp时,取值范围为1~65535。
  • Protocol 传入icmp、icmpv6或all时,仅支持传入-1,表示不限制端口。

CidrIp

String

10.XX.XX.0/8

目的地址的IPv4 CIDR或IPv6 CIDR。

说明

参数CidrIpSourceGroupIdPrefixListId,三者必须传入一个。若传入多个,仅生效一个,生效的优先级为CidrIp > SourceGroupId > PrefixListId

SourceGroupId

String

sg-bp67acfmxazb4p****

目的地址安全组ID。即该安全组中的所有网卡的地址作为目的地址。

说明

参数CidrIpSourceGroupIdPrefixListId,三者必须传入一个。若传入多个,仅生效一个,生效的优先级为CidrIp > SourceGroupId > PrefixListId

PrefixListId

String

pl-bp1fg655nh68xyz9****

目的地址前缀列表的ID。即前缀列表中的CIDR均为目的地址。
您可以调用 DescribePrefixLists 接口,查询前缀列表的ID。

说明

  • 当前安全组还可添加出方向安全组规则的数量不小于前缀列表最大条目数。
  • 参数CidrIpSourceGroupIdPrefixListId,三者必须传入一个。若传入多个,仅生效一个,生效的优先级为CidrIp > SourceGroupId > PrefixListId
  • 前缀列表正在邀测中,如需试用,请联系客户经理。

Policy

String

accept

访问策略。即安全组内的网卡访问CidrIpSourceGroupIdPrefixListId 对应的资源。

  • accept(默认): 允许。
  • drop:拒绝。

Priority

Integer

1

安全组规则优先级,数字越小,代表优先级越高。

  • 取值范围:1 ~ 100
  • 不填默认值:1

Description

String

SG-Egress-1

安全组规则的描述信息。

  • 需要以字母、中文或数字开头。可包含英文逗号(,)、点号(.)、下划线(_)、空格( )、等号(=)、短横线(-)、中文逗号(,)、中文句号(。)。
  • 长度限制为1 ~ 255个字符。
  • 不填默认为空字符串。

ClientToken

String

123e4567-e89b-12d3-a456-42665544****

客户端Token,用于保证请求幂等性。

  • 由客户端自动生成一个参数值,确保不同请求间该参数值唯一,避免当调用API超时或服务器内部错误时,客户端多次重试导致重复性操作。
  • 仅支持ASCII字符,且不能超过64个字符。
  • 若不传入ClientToken,则此次API调用不进行幂等校验。

返回数据

参数名称
类型
示例值
描述
RequestIdString2021062415303301022514515207C4****请求ID。

请求示例

GET /?Action=AuthorizeSecurityGroupEgress&Version=2020-04-01&SecurityGroupId=sg-bp67acfmxazb4p****&Protocol=tcp&PortStart=22&PortEnd=22&CidrIp=10.XX.XX.0/8&Policy=accept&Priority=1 HTTP/1.1
Host: open.volcengineapi.com
Service: vpc
Region: cn-beijing

返回示例

{
    "ResponseMetadata": {
        "RequestId": "2021062415303301022514515207C4****",
        "Action": "AuthorizeSecurityGroupEgress",
        "Version": "2020-04-01",
        "Service": "vpc",
        "Region": "cn-beijing"
    },
   "Result": {
        "RequestId": "2021062415303301022514515207C4****"
    }
}

错误码

此处仅展示当前API的错误码,更多错误码请参见公共错误码

HttpCode
错误码
错误信息
描述
400IdempotentParameterMismatchArguments on this idempotent request are inconsistent with arguments used in previous request(s).此幂等请求的参数与前一个请求中使用的参数不一致。
400InvalidCidr.MalformedThe specified cidr block is malformed.指定的网段格式不合法。
400InvalidCidr.ProtocolMismatchThe specified cidr block mismatch the protocol type.指定的网段格式和协议类型不匹配。
400InvalidDescription.MalformedThe specified description is malformed.指定的描述格式不合法。请修复描述格式后重试。
400InvalidDescription.MalformedThe specified description is malformed. Ensure the maximum length of description is 255.指定的描述格式不合法。描述长度不能超过255个字符。
400InvalidParameter.ClientTokenMalformedThe specified parameter ClientToken is malformed.指定的参数ClientToken格式不合法,长度不能超过64个ASCII字符。
400InvalidPrefixList.InvalidStatusThe specified prefix list is not in the correct status for the request.指定的前缀列表所处状态无法响应该请求。
400InvalidRouteCidr.MalformedThe specified CIDR is malformed.指定的网段不合法。
400InvalidSecurityGroup.InvalidStatusThe specified security group is not in the correct status for the request.指定的安全组所处的状态无法响应该请求。
400InvalidSecurityGroup.VpcMismatchThe specified source security group is not in the specified VPC.指定的引用安全组不在指定的VPC中。
400InvalidSecurityRulePolicy.MalformedThe specified security rule policy is malformed.指定的安全组规则的行为不合法。
400InvalidSecurityRulePort.MalformedThe specified security rule port is malformed.指定的安全组规则的端口不合法。
400InvalidSecurityRulePriority.MalformedThe specified security rule priority is malformed.指定的安全组规则的优先级不合法。
400InvalidSecurityRuleProtocol.MalformedThe specified security rule protocol is malformed.指定的安全组规则的协议不合法。
400QuotaExceeded.PrefixListAssociationThe number of resources a prefix list can be referenced by exceeded quota.前缀列表绑定的资源数量超过配额限制。
400QuotaExceeded.SecurityGroupRuleYou've reached the limit on the number of egress security rules that you can create.已达到安全组可创建的出项规则的数量上限。
400QuotaExceeded.SecurityGroupSecurityGroupThe number of security groups bound to the security group exceeded quota.指定安全组已达到作为源端安全组的数量上限。
403ForbiddenYou are not authorized to access the prefix list.您无权限访问前缀列表。
403ForbiddenYou are not authorized to perform operations on the specified security group. The specified security group is a service-managed security group.无权限对指定安全组进行操作。指定的安全组为云产品托管的安全组。
404InvalidPrefixList.NotFoundThe specified prefix list does not exist.指定的前缀列表不存在。
404InvalidSecurityGroupId.NotFoundThe specified security group does not exist.指定的安全组不存在。
409InvalidSecurityRule.ConflictThe specified security rule conflicts with that of another security rule in your security group.指定的安全组规则与所属安全组下另一条规则冲突。
412IdempotentProcessingThe request uses the same client token as a previous one that is still in process.幂等请求处理中。