Skip to main content

ssh_keys

Creates, updates, deletes, gets or lists a ssh_keys resource.

Overview​

Namessh_keys
TypeResource
Idovh.public_cloud.ssh_keys

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
namestringUnique name of the SSH key
created_atstring (date-time)Creation date of the SSH key (wire: createdAt)
public_keystringSSH public key content (wire: publicKey)
updated_atstring (date-time)Last update date of the SSH key (wire: updatedAt)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectname, project_idReturns the SSH key with its public key content.
listselectproject_idx_pagination_cursor, x_pagination_sizeReturns the SSH public keys stored in the project.
createinsertproject_id, name, public_keyStores an SSH public key under a name that is unique in the project. Use this name to install the key on an instance at creation.
deletedeletename, project_idDeletes the SSH key from the project. Instances created with this key keep it.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
namestringName
project_idstringThe Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set.
x_pagination_cursorstringPagination cursor (wire: X-Pagination-Cursor)
x_pagination_sizeintegerPagination size (wire: X-Pagination-Size)

SELECT examples​

Returns the SSH key with its public key content.

SELECT
name,
created_at,
public_key,
updated_at
FROM ovh.public_cloud.ssh_keys
WHERE name = '{{ name }}' -- required
AND project_id = '{{ project_id }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;

INSERT examples​

Stores an SSH public key under a name that is unique in the project. Use this name to install the key on an instance at creation.

INSERT INTO ovh.public_cloud.ssh_keys (
name,
public_key,
project_id
)
SELECT
'{{ name }}' /* required */,
'{{ public_key }}' /* required */,
'{{ project_id }}'
RETURNING
name,
created_at,
public_key,
updated_at
;

DELETE examples​

Deletes the SSH key from the project. Instances created with this key keep it.

DELETE FROM ovh.public_cloud.ssh_keys
WHERE name = '{{ name }}' --required
AND project_id = '{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;