- Documentation
Elastic Compute Service
Elastic Compute Service
User Guide
Security
Passwords and key pairs
Key pairs
Associating key pairs with instances
Key pairs
Associating key pairs with instances
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:
- 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.
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
- In the top menu bar, select the region and project where the key pair is located.
- Click the "Bind instances" button in the "Actions" column of the target key pair.
- 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.
- 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.
- Click "Bind" to complete the operation.
- In the top menu bar, select the region and project where the instance is located.
- In the left-side navigation pane, select "Instances & Images > Instances".
- On the Instances page, use one of the following methods to go to the page for associating a key pair with instances.
- Associate a key pair with a single instance: Click "... > Instance property > Bind key pair" in the "Actions" column of the target instance.
- Associate a key pair with multiple instances at the same time: Select one or more instances that you want to associate with a key pair, and click "··· > Bind key pair" at the bottom of the list.
- On the "Associated key pair in bulk" page, select the key pair to associate from the drop-down list.
- Select "Agree to restart Instances now" to make the operation take effect. You can also manually restart the instances after the instances are associated with the key pair.
tip
During the restart process, instances whose status is Running are restarted by default, and instances whose status is Stopped are started.
- Click the "bind" button to complete the operation.
- After you submit the association request, you can click "Go to instance maintenance attribute" to go to the orchestration page and view the task details. This step is applicable only when you associate a key pair with multiple instances at the same time. When the task status is Success, the key pair is associated with the instances. For information about task-related parameters, see Viewing task details.
tip
The first time you use the Orchestration service, you need to create the CustomRoleForOOS role to complete the authorization. Learn more. -
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