---
title: "Getting started with Cloud HSM"
description: "Get an OVHcloud Cloud HSM cluster, retrieve its endpoints, authenticate with IAM and run a cryptographic operation via the PKCS#11 driver"
url: https://docs.ovhcloud.com/en/guides/manage-and-operate/cloud-hsm/quick-start
lang: en
lastUpdated: 2026-12-02
---
> For AI agents: the complete documentation index is available at https://docs.ovhcloud.com/en/llms.txt, the full documentation bundle is available at https://docs.ovhcloud.com/en/llms-full.txt.

# Getting started with Cloud HSM

**Warning:** **Beta version** — Cloud HSM is currently in beta. Features, interfaces and procedures may change until general availability (GA), and this guide will be updated along with them. To find out more about the beta or to request access, visit the [Cloud HSM page on OVHcloud Labs](https://labs.ovhcloud.com/en/cloud-hsm/).

## Objective

**This guide shows you how to get a Cloud HSM cluster, give your application access to it, and run a first cryptographic operation through the OVHcloud PKCS#11 driver.**

To understand how clusters, partitions and endpoints work before you start, read [Cloud HSM - Architecture and high availability](https://docs.ovhcloud.com/en/guides/manage-and-operate/cloud-hsm/architecture.md).

***

### OVHcloud Console Access

- **Direct link:** "Cloud HSM"
- **Navigation path:** "Security" > "Cloud HSM" > Select your cluster

***

## Instructions

### Step 1: Getting your Cloud HSM cluster

During the beta, clusters cannot be ordered from the OVHcloud Console yet: OVHcloud handles the order of registered participants directly.

Once ordered, your cluster appears in the list of your Cloud HSM clusters in the OVHcloud Console, with the status **Creating**. When its status is **Ready**, you can use its partitions.

### Step 2: Retrieving the ID and endpoints of your cluster

Your application needs two pieces of information about your cluster:

- the **ID of the cluster**;
- the **endpoints** of its partitions, in the form `host:5697`.

#### OVHcloud Console

In the list of your Cloud HSM clusters, click your cluster. The **ID** of the cluster is displayed in **Cluster details**. The **Resource map** shows the cluster and its partitions, with the endpoint of each partition. Copy the ID and the endpoints you need.

#### OVHcloud API

List your clusters to retrieve their IDs:

[GET /cloudHSM/resource](https://api.eu.ovhcloud.com/console/?section=/cloudHSM&branch=v2#get-/cloudHSM/resource)

Then retrieve the details of your cluster:

[GET /cloudHSM/resource/{cloudHSMId}](https://api.eu.ovhcloud.com/console/?section=/cloudHSM&branch=v2#get-/cloudHSM/resource/-cloudHSMId-)

The response contains the ID of the cluster (`id`), its IAM URN (`iam.urn`) and, in `currentState.partitions`, the endpoint of each partition:
```json
{
  "id": "0b7a5e1c-2f3d-4c8e-9a6b-1d2e3f4a5b6c",
  "resourceStatus": "READY",
  "currentState": {
    "region": "eu-west-par",
    "partitions": [
      { "id": "…", "az": "eu-west-par-a", "endpoint": "<endpoint-a>:5697", "vendor": "Thales", "model": "…" },
      { "id": "…", "az": "eu-west-par-b", "endpoint": "<endpoint-b>:5697", "vendor": "Thales", "model": "…" },
      { "id": "…", "az": "eu-west-par-c", "endpoint": "<endpoint-c>:5697", "vendor": "Thales", "model": "…" }
    ],
    "ipAllowlist": []
  },
  "iam": { "urn": "urn:v1:eu:resource:cloudHSM:0b7a5e1c-2f3d-4c8e-9a6b-1d2e3f4a5b6c" }
}
```

In a 1-AZ region, the backup partition has no endpoint (`endpoint` is empty): only the two partitions of the region can be reached.

### Step 3: Restricting access by IP address

This step is optional. By default, your cluster accepts connections from any IP address, and every request must still carry a valid IAM token. To accept connections only from your own networks, define an IP allowlist with the following API call:

[PUT /cloudHSM/resource/{cloudHSMId}](https://api.eu.ovhcloud.com/console/?section=/cloudHSM&branch=v2#put-/cloudHSM/resource/-cloudHSMId-)

```json
{
  "checksum": "<checksum returned by GET /cloudHSM/resource/{cloudHSMId}>",
  "targetSpec": {
    "ipAllowlist": [
      { "cidr": "203.0.113.0/24", "description": "Production servers" },
      { "cidr": "2001:db8::/48", "description": "Production servers (IPv6)" }
    ]
  }
}
```

- The list replaces the previous one entirely: to add a range, send the current ranges along with the new one.
- Pass the `checksum` returned by your last `GET`. If the cluster was changed in the meantime, the request is refused with an HTTP 412 error: retrieve the cluster again and retry.
- The cluster must have the status `READY`. The new list applies within 30 seconds, including to open connections.
- An empty list (`"ipAllowlist": []`) allows any address again.

**Warning:** Allow the public address from which your machines reach the Internet. If they go through a NAT gateway, this is the address of the gateway. Otherwise, your application will be refused as soon as the allowlist applies.

### Step 4: Getting an IAM token for your application

Your application authenticates to Cloud HSM with an OVHcloud IAM token, passed to the PKCS#11 driver as the **PIN**. Use one of the following:

- a **Personal Access Token (PAT)** of an IAM local user: see [How to configure a Personal Access Token (PAT)](https://docs.ovhcloud.com/en/guides/manage-and-operate/iam/configure-personal-access-token-pat.md);
- an **OAuth2 access token** obtained with a **service account**: see [How to use service accounts to connect to OVHcloud APIs](https://docs.ovhcloud.com/en/guides/account-and-service-management/account-information/authenticate-api-with-service-account.md).

The token grants the rights of the identity it belongs to. The administrator of the OVHcloud account holds every right on its clusters. For any other identity, attach an IAM policy that grants the Cloud HSM actions it needs on your cluster: see the "[Authorisation with OVHcloud IAM](https://docs.ovhcloud.com/en/guides/manage-and-operate/cloud-hsm/pkcs11-driver.md#authorisation-with-ovhcloud-iam)" section of the "Installing and configuring the Cloud HSM PKCS#11 driver" guide for example policies.

**Tip:** Give each application its own identity, with only the actions it needs. For example, an application that only signs needs `cloudHSM:pkcs11:read` and `cloudHSM:pkcs11:sign`. Every identity needs `cloudHSM:pkcs11:read`, which the driver uses to log in. To run the example of step 6, the identity also needs `cloudHSM:pkcs11:create` and `cloudHSM:pkcs11:verify`.

### Step 5: Installing and configuring the PKCS#11 driver

During the beta, the OVHcloud PKCS#11 driver is provided directly to the participants, as a precompiled library for Linux on amd64 and arm64, with glibc 2.28 or later. Copy the file that matches your architecture to the machine that runs your application, for example as `/usr/local/lib/libovhcloud_pkcs11_driver.so`.

For a first test, configure the driver with the following environment variables, using the values retrieved in the previous steps. This configuration uses a single endpoint, without failover: use it for testing only.

```bash
export PKCS11_HSMGW_ENDPOINT="<endpoint>:5697"
export PKCS11_HSMGW_CLUSTER_ID="<cluster ID>"
```

The IAM token is passed as the PIN when your application logs in to the PKCS#11 token (`C_Login`).

For any other use, configure the driver with a configuration file that lists every endpoint of your cluster, so that the driver can fail over: see the "[Configuration with a YAML file](https://docs.ovhcloud.com/en/guides/manage-and-operate/cloud-hsm/pkcs11-driver.md#configuration-with-a-yaml-file-recommended)" section of the "Installing and configuring the Cloud HSM PKCS#11 driver" guide.

### Step 6: Running your first operations

The example below uses `pkcs11-tool`, from the OpenSC project, to illustrate the PKCS#11 calls. Any PKCS#11 application works the same way: it loads the driver library and logs in with the IAM token as the PIN.

```bash
export TOKEN="<your IAM token>"
MODULE=/usr/local/lib/libovhcloud_pkcs11_driver.so

# Display the token exposed by the driver

pkcs11-tool --module "$MODULE" --list-slots

# Generate an RSA 2048-bit key pair in your cluster

pkcs11-tool --module "$MODULE" --login --pin "$TOKEN" \
  --keypairgen --key-type rsa:2048 --label my-first-key --id 01

# Sign a file with the private key

echo "Hello Cloud HSM" > data.txt
pkcs11-tool --module "$MODULE" --login --pin "$TOKEN" \
  --sign --mechanism SHA256-RSA-PKCS --id 01 \
  --input-file data.txt --output-file data.sig

# Verify the signature

pkcs11-tool --module "$MODULE" --login --pin "$TOKEN" \
  --verify --mechanism SHA256-RSA-PKCS --id 01 \
  --input-file data.txt --signature-file data.sig
```

The key pair now lives in your cluster: it can be used through every endpoint of the cluster, and its private key never leaves the HSM.

If an operation fails, set `PKCS11_LOG_LEVEL=error` and run it again: the driver then writes the cause of each error to the standard error output.

## Go further

[Cloud HSM - Architecture and high availability](https://docs.ovhcloud.com/en/guides/manage-and-operate/cloud-hsm/architecture.md)

[Installing and configuring the Cloud HSM PKCS#11 driver](https://docs.ovhcloud.com/en/guides/manage-and-operate/cloud-hsm/pkcs11-driver.md)

[Cloud HSM - Shared responsibilities](https://docs.ovhcloud.com/en/guides/manage-and-operate/cloud-hsm/raci.md)

Join our [community of users](https://community.ovhcloud.com/).
