Prerequisites
You can create symmetric keys in any Nebius AI Cloud interface, but to encrypt and decrypt data, use the Nebius AI Cloud CLI.- Install and configure the Nebius AI Cloud CLI.
- Make sure you are in a group that has at least the
editorrole within your tenant or project; for example, the defaulteditorsgroup. You can check this in the Administration → IAM section of the web console.
Steps
Create a symmetric key
- Web console
- CLI
-
In the web console, go to
Cryptography → KMS.
-
Click
Create key.
-
On the key creation page:
- In the Name field, enter
my-symmetric-key. - In the Type field, preserve Symmetric key.
- In the Name field, enter
- Click Create key.
AES_256_GCM algorithm and the default rotation period of three months.You need the key ID to encrypt and decrypt data. In the list of symmetric keys, click KEY_ID environment variable:Encrypt data
-
Encode the text
Hello worldin Base64:The output looks like the following: -
Encrypt the text
Hello world:This command includes the following parameters:--key-id: ID of the symmetric key that you created.--plaintext: Base64-encoded value of your text.
ciphertextvalue that you need for decrypting the data later:
Decrypt data
-
To decrypt the data, use the same symmetric key and the returned ciphertext:
This command includes the following parameters:
--key-id: ID of the symmetric key that you created.--ciphertext: Ciphertext returned when you encrypted the plaintext.
-
Decode the
plaintextvalue from Base64:The output is:
What’s next
- Learn how to rotate a symmetric key manually
- Learn how to encrypt larger volumes of data with envelope encryption