Nebius Israel
Contact usConsole
  • GPU
  • Docs
© 2023 Nebius Israel Ltd
Certificate Manager
  • Getting started
  • Access management
  • Pricing policy
  • FAQ
  1. Step-by-step guides
  2. User certificate
  3. Adding a certificate

Adding a custom certificate

  • Creating a self-signed certificate file
  • Adding a self-signed custom certificate

As an example, let's look at how to add a custom certificate using a self-signed certificate. You can see the custom certificate requirements on the User certificate page.

Creating a self-signed certificate fileCreating a self-signed certificate file

To create a self-signed certificate using the OpenSSL library, run the command below:

Bash
PowerShell
openssl req -x509 -newkey rsa:4096 -nodes \
  -keyout key.pem \
  -out cert.pem \
  -days 365 \
  -subj '/CN=example.com'
openssl req -x509 -newkey rsa:4096 -nodes `
  -keyout key.pem `
  -out cert.pem `
  -days 365 `
  -subj '/CN=example.com'

Where:

  • -x509: Command will output a certificate file.
  • -newkey: New private key file will be created.
  • rsa:4096: Algorithm and key length.
  • -nodes: Do not encrypt the private key file.
  • -keyout: Name of the file the private key is saved to.
  • -out: Certificate file name.
  • -days: Certificate validity period.
  • -subj: Certificate owner's Common Name value.

The req command launched with the above parameters will issue a self-signed certificate and generate the associated private key.

Adding a self-signed custom certificateAdding a self-signed custom certificate

To add a custom certificate to Certificate Manager:

Management console
CLI
Terraform
API
  1. In the management console, select the folder to add a custom certificate to.
  2. In the list of services, select Certificate Manager.
  3. Click Add certificate.
  4. In the menu that opens, select User certificate.
  5. In the resulting window, use the Name field to enter a user certificate name.
  6. (Optional) Enter a certificate description in the Description field.
  7. In the Certificate field, click Add certificate.
    1. Select File as the adding method.
    2. Click Select file.
      1. In the resulting window, select the cert.pem self-signed certificate file.
    3. Click Add.
  8. In the Private key field, click Add private key.
    1. Select File as the adding method.
    2. Click Select file.
      1. In the resulting window, select the key.pem private key file.
    3. Click Add.
  9. Click Create.

If you don't have the Nebius Israel command line interface yet, install and initialize it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. View a description of the command:

    yc certificate-manager certificate create --help
    
  2. Run this command:

    yc certificate-manager certificate create \
      --name mycert \
      --chain mycert.pem \
      --key mykey.pem
    

    Where:

    • --name: Certificate name.
    • --chain: Path to the certificate chain file.
    • --key: Path to the file of the certificate private key.

    Command result:

    id: fpqmg47avvimp7rvmp30
    folder_id: b1g7gvsi89m34qmcm3ke
    created_at: "2020-09-15T06:54:44.916325Z"
    ...
    issued_at: "2020-09-15T06:54:44.916325Z"
    not_after: "2021-09-15T06:48:26Z"
    not_before: "2020-09-15T06:48:26Z"
    

If you do not have Terraform yet, install it and configure the Nebius Israel provider.

  1. In the configuration file, describe the parameters of the resources you want to create:

    resource "yandex_cm_certificate" "user-certificate" {
      name    = "<certificate_name>"
    
      self_managed {
        certificate = <<-EOT
                      -----BEGIN CERTIFICATE-----
                      <certificate_contents>
                      -----END CERTIFICATE-----
                      EOT
        private_key = <<-EOT
                      -----BEGIN PRIVATE KEY-----
                      <certificate_private_key_contents>
                      -----END PRIVATE KEY-----
                      EOT
      }
    }
    

    Where:

    • name: Certificate name.
    • certificate: Contents of the certificate file.
    • private_key: Contents of the private key file.

    For more information about the yandex_cm_certificate resource parameters in Terraform, see the provider documentation.

  2. Create resources:

    1. In the terminal, change to the folder where you edited the configuration file.

    2. Make sure the configuration file is correct using the command:

      terraform validate
      

      If the configuration is correct, the following message is returned:

      Success! The configuration is valid.
      
    3. Run the command:

      terraform plan
      

      The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.

    4. Apply the configuration changes:

      terraform apply
      
    5. Confirm the changes: type yes in the terminal and press Enter.

This will add the certificate to the specified folder. You can check the new certificate and its configuration using the management console or this CLI command:

yc certificate-manager certificate get <certificate_name>

To add a certificate, use the create REST API method for the Certificate resource or the CertificateService/Create gRPC API call.

A new certificate with the Issued status appears in the certificate list.

© 2023 Nebius Israel Ltd
In this article:
  • Creating a self-signed certificate file
  • Adding a self-signed custom certificate