CloneSecurityGroup

Last updated: 2021-03-19 16:26:12

1. API Description

Domain name for API request: vpc.tencentcloudapi.com.

This API is used to create a security group with the same rule configurations as an existing security group. The cloning only copies the security group and its rules, but not the security group tags.

A maximum of 20 requests can be initiated per second for this API.

Note: This API supports Finance regions. If the common parameter Region is a Finance region, a domain name with the Finance region needs to be specified, for example: vpc.ap-shanghai-fsi.tencentcloudapi.com

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common parameter. The value used for this API: CloneSecurityGroup.
Version Yes String Common parameter. The value used for this API: 2017-03-12.
Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
SecurityGroupId Yes String ID of the security group to be cloned, such as sg-33ocnj9n. This can be obtained through the DescribeSecurityGroups API.
GroupName No String The name of security group clone. You can enter any name within 60 characters. If this parameter is left empty, the security group clone will use the name of the source security group.
GroupDescription No String Description of the security group clone. You can enter up to 100 characters. If this parameter is left empty, the security group clone will use the description of the source security group.
ProjectId No String Project ID of the security group clone. The default is 0. You can query it on the project management page of the Tencent Cloud console.
RemoteRegion No String The region of the source security group for a cross-region clone. For example, to clone the security group in Guangzhou to Shanghai, set it to ap-guangzhou.

3. Output Parameters

Parameter Name Type Description
SecurityGroup SecurityGroup Security group object
Note: this field may return null, indicating that no valid values can be obtained.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Cloning a security group

Input Example

https://vpc.tencentcloudapi.com/?Action=CloneSecurityGroup
&SecurityGroupId=sg-12345678
&<Common request parameters>

Output Example

{
  "Response": {
    "RequestId": "354f4ac3-8546-4516-8c8a-69e3ab73aa8a",
    "SecurityGroup": {
      "SecurityGroupId": "sg-12341234",
      "SecurityGroupName": "TestGroup",
      "SecurityGroupDesc": "test-group-desc",
      "ProjectId": "0"
    }
  }
}

Example2 Cloning a security group and specifying the security group name and description of the newly created one

Input Example

https://vpc.tencentcloudapi.com/?Action=CloneSecurityGroup
&SecurityGroupId=sg-12345678
&GroupName=test
&GroupDescription=test
&<Common request parameters>

Output Example

{
  "Response": {
    "RequestId": "354f4ac3-8546-4516-8c8a-69e3ab73aa8a",
    "SecurityGroup": {
      "SecurityGroupId": "sg-12341256",
      "SecurityGroupName": "test",
      "SecurityGroupDesc": "test",
      "ProjectId": "0"
    }
  }
}

Example3 Cloning a security group and specifying the project ID of the newly created one

Input Example

https://vpc.tencentcloudapi.com/?Action=CloneSecurityGroup
&SecurityGroupId=sg-12345678
&ProjectId=1001
&<Common request parameters>

Output Example

{
  "Response": {
    "RequestId": "354f4ac3-8546-4516-8c8a-69e3ab73aa8a",
    "SecurityGroup": {
      "SecurityGroupId": "sg-12341278",
      "SecurityGroupName": "TestGroup",
      "SecurityGroupDesc": "test-group-desc",
      "ProjectId": "1001"
    }
  }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InvalidParameterValue Incorrect parameter value.
InvalidParameterValue.Malformed Invalid input parameter format.
InvalidParameterValue.TooLong Invalid parameter value. The parameter value is too long.
LimitExceeded Quota limit is reached.
ResourceNotFound The resource does not exist.

Was this page helpful?

Was this page helpful?

  • Not at all
  • Not very helpful
  • Somewhat helpful
  • Very helpful
  • Extremely helpful
Send Feedback