CreateSecurityGroupWithPolicies

Last Updated At: 2026-08-02 00:06:20

1. Interface Description

Interface request domain name: vpc.api3.convergecloud.com.

This API is used to create a security group and add security group rules.

  • For the limit on the number of security groups for each project in each region per account, see Security Group Limits.
  • The action is Deny all for both inbound and outbound rules of the created security group by default. After a security group is created, you need to call CreateSecurityGroupPolicies to set the security group rules as needed.

Security group rule description:

  • Version indicates the version number of a security group rule. Each time you update a security group rule, the version number automatically increases by 1 to prevent the updated rule from expiring. This parameter is optional.
  • The Protocol field supports TCP, UDP, ICMP, ICMPV6, GRE, and ALL.
  • The CidrBlock field supports any string conforming to the CIDR format standard (complete form). On a basic network, if the CidrBlock field values contain the private IP addresses of devices other than CVM instances under your account, it does not mean that the rule allows you to access these devices. The tenant network isolation rules have a higher priority than the private network rules of security groups.
  • The Ipv6CidrBlock field supports any string conforming to the IPv6 CIDR format standard (complete form). On a basic network, if the Ipv6CidrBlock field values contain the private IPv6 addresses of devices other than CVM instances under your account, it does not mean that the rule allows you to access these devices. The tenant network isolation rules have a higher priority than the private network rules of security groups.
  • The SecurityGroupId field supports the ID of a security group in the same project as the security group to be modified and the ID of the security group to be modified. The private IP addresses of all CVM instances associated with the security group are used as source IP addresses. When this field is specified, the network packet matching process of the rule will change as the CVM instance associated with the corresponding security group changes. The source IP addresses do not need to be modified again.
  • The Port field supports a single port number or a port range. For example, 80 or 8000-8010. The Port field is valid only when the Protocol field is set to TCP or UDP. In other words, when the Protocol field is not set to TCP or UDP, the Protocol and Port fields cannot be specified at the same time. Otherwise, an API error will occur.
  • The Action field supports only ACCEPT or DROP.
  • CidrBlock, Ipv6CidrBlock, SecurityGroupId, and AddressTemplate cannot be specified at the same time. ServiceTemplate cannot be specified if Protocol or Port is specified.
  • One request allows you to create rules in only one direction. If the PolicyIndex parameter needs to be specified, the indexes of multiple rules should be consistent.

Default interface request rate limit: 100 times per second.

Interface update time: 2020-04-10 01:27:31.

The interface only verifies the signature but does not authenticate.

2. Input Parameters

The following list of request parameters only lists interface request parameters and some public parameters, For a complete list of public parameters see public request parameters.

Parameter name Required Allow NULL Type Description
Action Yes No String Public parameter, The value of this interface: CreateSecurityGroupWithPolicies
Version Yes No String Public parameter, The value of this interface: 2017-03-12
Region No No String Public parameter,Regional information A list of supported geographies is available through the DescribeRegions interface
ProjectId No No String Project ID. Default value: 0. It can be queried on the project management page in the console.
Example: 1
GroupName Yes No String Security group name. The name can be given freely but must not exceed 60 characters.
Example: demo
GroupDescription Yes No String Security group remarks, up to 100 characters.
Example: demo 20230214
SecurityGroupPolicySet No No SecurityGroupPolicySet Security group policy collection.
Example:View

3. Output Parameters

Parameter name Type Description
SecurityGroup SecurityGroup Security group object.
Example:View
RequestId String Unique request id, Each request will return. The RequestId of the request needs to be provided when locating the problem.

4. Error Code

The following lists only the error codes related to the interface business logic, For other error codes, see public ErrorCode.

Error Code Description
InvalidParameterValue The parameter value is invalid.
LimitExceeded Exceeded the limit
ResourceNotFound The resource does not exist
InvalidParameter.Coexist The parameters must not be specified simultaneously.
InvalidParameterValue.TooLong Invalid input: Excessive length of the parameter.
MissingParameter Missing parameters. The request did not carry the required parameter.