tencent cloud

Feedback

CreateSSHKeyPairSecret

Last updated: 2023-09-18 17:15:30

1. API Description

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

This API is used to create a secret that hosts SSH keys.

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: CreateSSHKeyPairSecret.
Version Yes String Common Params. The value used for this API: 2019-09-23.
Region No String Common Params. This parameter is not required for this API.
SecretName Yes String Secret name, which must be unique in the same region. It can contain 128 bytes of letters, digits, hyphens and underscores and must begin with a letter or digit.
ProjectId Yes Integer ID of the project to which the created SSH key belongs.
Description No String Description, such as what it is used for. It contains up to 2,048 bytes.
KmsKeyId No String Specifies a KMS CMK to encrypt the secret.
If this parameter is left empty, the CMK created by Secrets Manager by default will be used for encryption.
You can also specify a custom KMS CMK created in the same region for encryption.
Tags.N No Array of Tag List of tags.
SSHKeyName No String Name of the SSH key pair, which only contains digits, letters and underscores and must start with a digit or letter. The maximum length is 25 characters.

3. Output Parameters

Parameter Name Type Description
SecretName String Name of the created secret.
SSHKeyID String ID of the created SSH key.
SSHKeyName String Name of the created SSH key.
TagCode Integer Tag return code. 0: success; 1: internal error; 2: business processing error.
Note: this field may return null, indicating that no valid values can be obtained.
TagMsg String Tag return message.
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 Creating an SSH key secret

This example shows you how to create an SSH key secret.

Input Example

POST / HTTP/1.1
Host: ssm.tencentcloudapi.comp
Content-Type: application/json
X-TC-Action: CreateSSHKeyPairSecret
<Common request parameters>

{
    "ProjectId": 0,
    "Tags": [
        {
            "TagKey": "xx",
            "TagValue": "xx"
        }
    ],
    "KmsKeyId": "xx",
    "Description": "xx",
    "SecretName": "xx",
    "SSHKeyName": "xx"
}

Output Example

{
    "Response": {
        "SSHKeyID": "xx",
        "TagMsg": "xx",
        "TagCode": 1,
        "RequestId": "xx",
        "SecretName": "xx",
        "SSHKeyName": "xx"
    }
}

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
FailedOperation Operation failed.
FailedOperation.AccessKmsError KMS operation failed.
InternalError An internal error occurred.
InvalidParameter Incorrect parameter.
InvalidParameterValue The parameter value is invalid.
InvalidParameterValue.TagKeysDuplicated The tag keys are duplicated.
InvalidParameterValue.TagsNotExisted The tag key or tag value does not exist.
LimitExceeded The quota limit is exceeded.
MissingParameter Missing parameter.
OperationDenied Operation denied.
RequestLimitExceeded The number of requests exceeds the frequency limit.
ResourceInUse.SecretExists The Secret name already exists.
ResourceUnavailable.NotPurchased The service is not purchased.
UnauthorizedOperation The operation is unauthorized.
UnauthorizedOperation.AccessKmsError Failed to access KMS.
UnknownParameter Unknown parameter.
UnsupportedOperation Unsupported operation.
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