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, and this page is available as Markdown at https://docs.ovhcloud.com/en/guides/public-cloud/compute/encrypting-a-block-storage-volume-with-luks.md.

Encrypting a Block Storage volume with LUKS

View as Markdown

Find out how to encrypt a Block Storage volume with LUKS, and how to use your own customer-managed key (CMK) stored in OKMS

Objective

OVHcloud Block Storage volumes can be encrypted at rest using LUKS. The encryption key — called a Service Key — is generated and stored in OVHcloud Key Management Service (OKMS).

By default, this Service Key is entirely generated and managed by OVHcloud: you simply order an encrypted (-luks) volume type and OVHcloud takes care of the rest. Optionally, you can instead use a customer-managed key (CMK): a Service Key that you create and control yourself in your own OKMS domain, including its suspension and deletion.

This guide first reminds how default (OVHcloud-managed) LUKS encryption works, then explains how to switch to a customer-managed key (CMK).

Warning

Encrypted (LUKS) volumes have a performance overhead of about 10% compared to equivalent non-encrypted volumes.

Default encryption (OVHcloud-managed key)

To encrypt a Block Storage volume with the default, OVHcloud-managed key, order the encrypted variant of any volume type (classic-luks, high-speed-luks, high-speed-gen2-luks) — from the Control Panel or with the tools described in the How to create and configure an additional disk on an instance guide. OVHcloud automatically generates and manages the Service Key in OKMS: there is no OKMS domain to create, no Service Key to manage, and no IAM policy to configure.

Info

Once attached to your instance, an encrypted volume behaves like a standard volume — all encryption and unlocking are handled automatically by the OVHcloud infrastructure. See the Migrating a Block Storage volume to an encrypted LUKS volume guide if you need to encrypt an existing, non-encrypted volume.

Warning

Do not modify or delete the automatically generated key linked to a -luks volume. Doing so would make the data on that volume, and all its snapshots, permanently unrecoverable.

The rest of this guide covers the customer-managed key (CMK) alternative.

Using a customer-managed key (CMK)

Most steps below are documented in 2 ways:

  • via the OVHcloud Control Panel, available today for the OKMS and IAM operations;
  • via the OVHcloud API or the OpenStack CLI, currently the only ways to create the encrypted Block Storage volume itself. Control Panel support for volume creation with a CMK is coming soon.

Requirements

These requirements apply only to the customer-managed key (CMK) workflow below.

  • An active OVHcloud account with sufficient rights to manage IAM, OKMS, and Block Storage.
  • API access with valid credentials — a Bearer token (OAuth2 via an IAM service account) or the classic application key / signature authentication. See the First Steps with the OVHcloud APIs guide.
  • Optionally, the OpenStack CLI installed and configured for the target region, as an alternative to the OVHcloud API for creating the volume. See the Preparing an environment for using the OpenStack API guide.
  • Appropriate IAM permissions to create policies and assign them to OVHcloud NICs — specifically the account:apiovh:iam/policy/create action.

OVHcloud Control Panel Access

Policies:

  • Direct link:
  • Navigation path: Identity, Security & Operations > Policies

Key Management Service:

  • Direct link:
  • Navigation path: Identity, Security & Operations > Key Management Service > Select your OKMS domain

Instructions

Each step below presents the available interfaces as tabs: OVHcloud Control Panel, OVHcloud API, or OpenStack CLI.

Info

For API calls, the base URL is https://api.eu.ovhcloud.com in Europe and https://api.ca.ovhcloud.com in Canada, each serving both the /v1/* and /v2/* endpoints.

Step 1: Create an OKMS domain

An OKMS domain is a logical namespace inside OKMS that holds your Service Keys. Each domain is tied to a specific region.

An OKMS domain is ordered as a service from the OVHcloud Control Panel; the OVHcloud API is then used to retrieve its ID.

OVHcloud Control Panel
OVHcloud API

To order an OKMS domain, follow the "Ordering your KMS" section of the Getting started with OVHcloud Key Management Service (KMS) guide.

Info

Note your OKMS domain ID (okms_domain_id / domainId). You will need it when creating the LUKS volume in Step 4.

Step 2: Create a Service Key

A Service Key is a cryptographic key stored inside your OKMS domain. The Block Storage service uses it to generate and protect the data encryption keys (DEKs) that encrypt your volumes.

OVHcloud Control Panel
OVHcloud API

To create the Service Key, follow the "Create an encryption key" section of the Getting started with OVHcloud Key Management Service (KMS) guide, and set the following parameters:

ParameterRequired valueNotes
Service Key typeAESSymmetric encryption algorithm required for LUKS volume encryption.
Service Key size (Algorithm)256 bits256-bit key length, for AES-256 encryption strength.
Service Key usageWrap / Unwrap, Encrypt / DecryptThese operations are mandatory.

Once created, note the Service Key ID (okms_servicekey_id / serviceKeyId).

Info

Why wrap / unwrap? The Block Storage service uses the Service Key to wrap (encrypt) the generated data encryption key (DEK) before storing it, and to unwrap (decrypt) it when the volume needs to be accessed. The Service Key itself never leaves OKMS.

Info

BYOK. Instead of letting OKMS generate the Service Key, you can import your own key material using Bring Your Own Key (BYOK), which wraps the key with an RSA transport key pair so it never travels in plaintext.

Step 3: Delegate access via an IAM policy

To allow OVHcloud's OpenStack services to create and use LUKS volumes with your key, you must grant specific IAM permissions to the OVHcloud NIC associated with the Block Storage service in your region.

3.1 Identify the OVHcloud NIC for your region

Each OVHcloud region has a dedicated internal NIC that the Block Storage service uses to interact with OKMS:

RegionOVHcloud NIC
GRA1, GRA3, GRA5, GRA7, GRA9, GRA11vt202366-ovh
BHS1, BHS3, BHS5rh149494-ovh
SBG5, SBG7yq2822-ovh
EU-WEST-PARdy230283-ovh
EU-SOUTH-MILxz3473-ovh
DE1qy10886-ovh
UK1gz25568-ovh
WAW1xe2946-ovh
RBX-Axz3500-ovh
SGP1sc1243248-ovh
SYD1oy31561-ovh
AP-SOUTHEAST-SYD-2td444999-ovh
AP-SOUTH-MUM-1pu54673-ovh
Warning

If your region is not listed here, contact OVHcloud support to obtain the correct NIC.

3.2 Create the IAM policy

OVHcloud Control Panel
OVHcloud API

Create a new IAM policy in the Control Panel, as described in the How to use IAM policies using the OVHcloud Control Panel guide, and configure it with the following values:

FieldValue
IdentitiesUnder Other OVHcloud customer accounts, click Add an account and enter the NIC for your region (see 3.1).
Product typesKey Management Service (OKMS) / Service Keys
ResourcesSelect the specific Service Key created in Step 2.
ActionsSee 3.3 Actions to authorize below.

3.3 Actions to authorize

Under Key Management Service (OKMS) / Service Keys, in the OPERATE category:

ActionPurpose
okms:apikms:serviceKey/dataKey/createAllows Block Storage to generate a new data encryption key (DEK).
okms:apikms:serviceKey/dataKey/decryptAllows Block Storage to decrypt the data key to access encrypted data.

Step 4: Create the LUKS volume

Warning

Volume creation with a CMK is currently available via API only (OVHcloud API or OpenStack CLI). Control Panel support is coming soon.

OVHcloud API
OpenStack CLI

Create the LUKS volume with the following API call:

VariableDescription
serviceNameYour Public Cloud project ID.
regionNameTarget region, e.g. EU-WEST-PAR.

Payload:

{
  "name": "my-encrypted-volume",
  "description": "CMK LUKS encrypted volume",
  "size": 50,
  "type": "high-speed-gen2-luks",
  "availabilityZone": "eu-west-par-a",
  "encryption": {
    "encrypted": true,
    "kms": {
      "domainId": "{okmsDomainId}",
      "serviceKeyId": "{serviceKeyId}"
    }
  }
}
FieldExample valueDescription
size50Size of the volume in gigabytes.
typehigh-speed-gen2-luksLUKS-enabled volume type (classic-luks, high-speed-luks, high-speed-gen2-luks). classic-luks is not available in 3-AZ regions — use high-speed-gen2-luks there. See the volume types overview for details.
availabilityZoneeu-west-par-aTarget availability zone, used in 3-AZ regions.
encryption.kms.domainId{okmsDomainId}UUID of your OKMS domain (Step 1).
encryption.kms.serviceKeyId{serviceKeyId}UUID of your Service Key (Step 2).

Step 5: Use the volume

Once created, a CMK LUKS encrypted volume behaves like a standard OVHcloud Block Storage volume: you attach and detach it the same way. Deleting the volume does not delete your Service Key.

Warning

Key availability. If your Service Key is deleted in OKMS, a volume that is currently attached keeps working — the key is only needed again once the volume is detached, or once the instance is migrated (whether by OVHcloud or by you), at which point the volume becomes permanently inaccessible. Suspending a key, on the other hand, is reversible: unsuspending it restores access with no data loss. Always ensure your key lifecycle management aligns with your data access requirements.

Limitations

Converting a volume to an image is not supported for LUKS volumes, whether the encrypted version uses a CMK or the default OVHcloud-managed key. This restriction applies regardless of the tool used — Control Panel, OVHcloud API, OpenStack CLI, or Terraform.

Summary

#StepControl PanelAPI
1Create OKMS domainOrder via Control PanelList/read via GET /v2/okms/resource
2Create Service Key✅POST /v2/okms/resource/{okmsId}/serviceKey
3Create IAM policy✅POST /v2/iam/policy
4Create LUKS volumeComing soonPOST /v1/cloud/project/{serviceName}/region/{regionName}/volume or OpenStack CLI
5Use the volume✅Standard volume operations

Go further

How to create and configure an additional disk on an instance

Migrating a Block Storage volume to an encrypted LUKS volume

Getting started with OVHcloud Key Management Service (KMS)

How to use IAM policies using the OVHcloud Control Panel

Join our community of users.

Was this page helpful?