AssociateInstancesKeyPairs

Last Updated At: 2026-08-02 00:05:21

1. Interface Description

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

This API (AssociateInstancesKeyPairs) is used to associate the key with an instance.

  • By writing the public key of the key into the SSH configuration of the instance, users can log in to the instance by using the private key of the key.
  • If the instance was previously associated with a key, the original key will become invalid.
  • If the instance was previously logged in with a password, after associating the key, you cannot use the password to log in.
  • Batch operations are supported. A maximum of 100 batch instances per request are allowed. If there are instances in the batch that are not allowed to be operated, operations will be returned with a specific error code.

Default interface request rate limit: 10 times per second.

Interface update time: 2022-10-28 03:51:28.

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: AssociateInstancesKeyPairs
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
InstanceIds Yes No Array of String One or more instance IDs to be operated. A maximum of 100 batch instances per request are allowed.

You can obtain an available instance ID in the following ways:
  • By querying the instance ID by logging in to the Console.
  • By calling the InstanceId in the returned information from the API DescribeInstances.
    Example: ["ins-1e4r6y8i","ins-3e56fg78"]
  • KeyIds Yes No Array of String One or more key pair IDs to be operated. A maximum of 100 batch instances per request are allowed. The key pair ID is in the format of skey-11112222.

    You can obtain an available key pair ID in the following ways:
  • By querying the key pair ID by logging in to the Console.
  • By calling the KeyId in the returned information from the API DescribeKeyPairs.
    Example: ["skey-4e5ty7i8"]
  • ForceStop No No Bool Whether to perform forced shutdown on the running instance. It is recommended to perform manual shutdown on the running instance first, and then reset the user password. Value Range:
  • TRUE: Indicates forced shutdown performed after normal shutdown fails.
  • FALSE: Indicates no forced shutdown performed after normal shutdown fails.

    Default value: FALSE.
    Example: true
  • 3. Output Parameters

    Parameter name Type Description
    TaskId String Task ID
    Example: 345342
    FlowId Int64 Task Flow ID
    Example: 2
    flowId Int64 Task Flow ID
    Example: 2
    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
    InvalidInstanceId.NotFound No corresponding instance was found.
    InvalidInstance.NotSupported Unsupported instance.
    InvalidParameterValue Invalid parameter value. The format of the parameter value is incorrect or not supported, etc.
    InvalidKeyPairId.Malformed Invalid key pair ID. The format of the specified key pair ID is incorrect, for example, an ID length error skey-1122.
    InternalServerError Internal operation error.
    InvalidParameterValue.LimitExceeded The parameter value is out of range
    InvalidInstanceId.Malformed Invalid Instance ID. The format of the specified instance ID is incorrect, for example, an instance ID length error ins-1122.
    InvalidKeyPairId.NotFound Invalid key pair ID. The specified key pair ID does not exist.
    MissingParameter Parameters are missing. The request did not include mandatory parameters.