调用CreateSecurityGroup新建一个安全组。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
ens:CreateSecurityGroup |
create |
*全部资源
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| SecurityGroupName |
string |
否 |
安全组名称。长度为 2~128 个英文或中文字符。必须以大小字母或中文开头,不能以 http://和 https://开头。可以包含数字、半角冒号(:)、下划线(_)或者连字符(-)。 默认值:空。 |
Dcdn1:2_3-4 |
| Description |
string |
否 |
描述信息。 长度为 2~256 个字符,必须以字母或中文开头,但不能以 http://或 https://开头。 |
testDescription |
| Permissions |
array<object> |
否 |
安全组规则数组。数组长度:0~200。 |
|
|
object |
否 |
安全组规则。 |
||
| Direction |
string |
是 |
授权方向。
|
ingress |
| IpProtocol |
string |
是 |
协议类型。取值范围:
枚举值:
|
TCP |
| PortRange |
string |
是 |
安全组开放的各协议相关的目的端口范围。取值范围:
|
80/80 |
| SourcePortRange |
string |
否 |
安全组开放的各协议相关的源端口范围。取值范围:
|
22/22 |
| Policy |
string |
是 |
访问权限。取值范围:
枚举值:
|
Accept |
| DestCidrIp |
string |
否 |
目的端 IPv4 CIDR 地址段。支持 CIDR 格式和 IPv4 格式的 IP 地址范围。 |
0.0.0.0/0 |
| Description |
string |
否 |
描述信息。 长度为 2~256 个字符,不能以 http://或 https://开头。 |
testDescription |
| Priority |
integer |
是 |
安全组规则优先级,数字越小,代表优先级越高。取值范围:1~100。 |
1 |
| SourceCidrIp |
string |
否 |
源端 IPv4 CIDR 地址段。支持 CIDR 格式和 IPv4 格式的 IP 地址范围。 |
0.0.0.0/0 |
| Ipv6SourceCidrIp |
string |
否 |
||
| Ipv6DestCidrIp |
string |
否 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| RequestId |
string |
请求 ID。 |
760bad53276431c499e30dc36f6b26be |
| SecurityGroupId |
string |
安全组 ID。 |
sg-bp1fg655nh68xyz9i*** |
示例
正常返回示例
JSON格式
{
"RequestId": "760bad53276431c499e30dc36f6b26be",
"SecurityGroupId": "sg-bp1fg655nh68xyz9i***"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | NoPermission | Permission denied. | |
| 400 | CallInterface | Call Interface Happen Error. | 接口调用出错。 |
| 400 | ens.interface.error | Failed to call API. | 接口调用发生异常。 |
| 400 | Invalid%s | The specified parameter %s is invalid. | |
| 400 | Missing%s | You must specify the parameter %s. | |
| 400 | AuthorizationLimitExceed | The limit of authorization records in the security group reaches. | 安全组规则数量超出限额。 |
| 400 | SecurityGroupRuleConflict.Duplicated | The SecurityGroup rule already exists. | 安全组规则重复。 |
| 400 | InvalidParameter.PortRange | The parameter PortRange is not valid. | 端口范围配置不正确。 |
| 400 | InvalidParameter.CidrIp | The parameter CidrIp is not valid. | 安全组规则网段参数不合法。 |
| 400 | QuotaExceed.SecurityGroup | The maximum number of security groups is reached. | 安全组数量超过额度限制。 |
| 400 | InvalidParameter.DestIpConflict | The Parameters DestCidrIp and Ipv6DestCidrIp cannot be set at the same time. | 参数DestCidrIp和Ipv6DestCidrIp不能被同时设置。 |
| 400 | InvalidParameter.Ipv4ProtocolConflictWithIpv6Address | IPv6 address cannot be specified for IPv4-specific protocol. | IPv4协议不能指定IPv6地址。 |
| 400 | InvalidParameter.Ipv6ProtocolConflictWithIpv4Address | IPv4 address cannot be specified for IPv6-specific protocol. | IPv6协议不能指定IPv4地址。 |
| 400 | InvalidParameter.SourceIpConflict | The Parameters SourceCidrIp and Ipv6SourceCidrIp cannot be set at the same time. | 参数SourceCidrIp和Ipv6SourceCidrIp不能被同时设置。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。