You need to enable JavaScript to run this app.
Elastic Compute Service

Elastic Compute Service

Copy page
Download PDF
Key pairs
Associating key pairs with instances
Copy page
Download PDF
Associating key pairs with instances
You can associate a key pair when you create an instance. Alternatively, you can follow the steps in this topic to associate a key pair with an existing instance.​
Prerequisites​
  • You can associate a key pair with an instance that is installed with the reset-authentication plug-in.​
tip​
Method for querying whether an instance has the reset-authentication plug-in installed:​
  1. Execute the systemctl status reset-authentication command.​
  • If reset-authentication.service could not be found. is returned, the reset-authentication plug-in is not installed.​
  1. Install the reset-authentication plug-in before you perform the steps in this topic.​
Usage notes​
  • If you have already associated a key pair with an instance in the console, the newly associated key pair overwrites the existing key pair. However, this does not affect any key pairs that you have manually added within the instance.​
  • After you associate a key pair with an instance, you need to restart the instance for the key pair to take effect. If your instance is configured for password login, the password login method is automatically disabled after you associate a key pair with the instance and restart the instance.​
Procedure​
​
Associate on the key pair list page
Associate on the Instances page
​
  1. Log in to the ECS console. ​
  1. In the top menu bar, select the region and project where the key pair is located. ​
  1. Click the "Bind instances" button in the "Actions" column of the target key pair.​
  1. On the "Bind instances" page, select the instances in the list on the left that you want to associate with the key pair. After you select the instances, the instances automatically appear in the selected instances list on the right.​
tip​
If there are instances that cannot be selected, those instances have already been associated with the current key pair and no further action is required.​
  1. Select "Restart selected instances now" to make the operation take effect.​
tip​
During the restart process, instances whose status is Running are restarted by default, and instances whose status is Stopped are started.​
  1. Click "Bind" to complete the operation.​
​
Subsequent operations​
  • If you want to log in to an instance by using a password after you associate a key pair with the instance, reset the login password. After the reset, you can log in to the instance by using either the key pair or the password.​
  • If multiple users want to access the same instance, you can manually add multiple key pairs within the instance.​
Related document​
​
Last updated: 2025.09.09 15:59:21