Updating a Secure Shell (SSH) key means replacing the public key from your Vultr account. Before updating the key, ensure you have a fresh SSH key pair. Then, keep the private key on your local device and copy the public key to your clipboard.
Follow this guide to update SSH keys using the Vultr Customer Portal, API, and CLI.
Navigate to Account and select SSH Keys under OTHER.
Select the SSH key from the list and click the Edit Icon.
Enter the SSH Keys details and click Update SSH Key.
Send a GET
request to the List SSH Keys endpoint to view all SSH keys and note the ID.
$ curl "https://api.vultr.com/v2/ssh-keys" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a PATCH
request to the Update SSH Key endpoint to update an SSH key.
$ curl "https://api.vultr.com/v2/ssh-keys/{ssh-key-id}" \
-X PATCH \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"name" : "test-ssh-key",
"ssh_key" : "ssh-rsa AAAAB3NzaC1yc2EA...."
}'
Visit the Update SSH Key endpoint to view additional attributes to add to your request.
List all SSH keys and note the SSH key ID.
$ vultr-cli ssh-keys list
Update the SSH Key by specifying the ID.
$ vultr-cli ssh-keys update ssh-key-id \
--name="test-ssh-key" \
--key="ssh-rsa AAAAB3NzaC1yc2EA...."
Run vultr-cli ssh-keys update --help
to view all options.