tencent cloud

Feedback

CloneSecurityGroup

Last updated: 2022-05-31 16:37:47

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.

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 Params. The value used for this API: CloneSecurityGroup.
Version Yes String Common Params. The value used for this API: 2017-03-12.
Region Yes String Common Params. 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 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.
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support