πŸ” SSH Keys

SSH keys are public keys you provide to the cloud system. They can be injected into Servers at creation time. We highly recommend that you use keys instead of passwords to manage your Servers.

Get all SSH keys

Returns all SSH key objects.

HetznerCloudClient hetznerCloudClient = new HetznerCloudClient("ApiKey");

List<SshKey> list = await hetznerCloudClient.SshKey.Get();

Get a SSH key

Returns a specific SSH key object.

HetznerCloudClient hetznerCloudClient = new HetznerCloudClient("ApiKey");

long sshKeyId = 13121954;

SshKey sshKey = await hetznerCloudClient.SshKey.Get(sshKeyId);

Create an SSH key

Creates a new SSH key with the given name and public_key. Once an SSH key is created, it can be used in other calls such as creating Servers.

HetznerCloudClient hetznerCloudClient = new HetznerCloudClient("ApiKey");

// We rely on the 'SshKeyGenerator' library to generate SSH credentials.
SshKeyGenerator.SshKeyGenerator sshKeyGenerator = new SshKeyGenerator.SshKeyGenerator(2048);

string name = $"name";
string pub = sshKeyGenerator.ToRfcPublicKey($"{Guid.NewGuid()}");

SshKey sshKey = await hetznerCloudClient.SshKey.Create(name, pub);

Update an SSH key

Updates an SSH key. You can update an SSH key name and an SSH key labels.

Delete a Volume

Deletes a volume. All Volume data is irreversibly destroyed. The Volume must not be attached to a Server and it must not have delete protection enabled.

JSON

Last updated

Was this helpful?