Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Cloud Desktop
    • Yandex SIEM
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • Serverless Integrations
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Certificate Manager
  • Getting started
    • All guides
      • Adding a certificate
      • Getting the contents of a certificate
      • Renewing a certificate
      • Editing a certificate
      • Deleting a certificate
    • Backups
    • Adding an alert for a certificate
    • Configuring access permissions for a certificate
    • Viewing operations with a certificate
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • FAQ

In this article:

  • Creating a self-signed certificate file
  • Adding a self-signed custom certificate
  • Storing a certificate's private key in Yandex Lockbox
  1. Step-by-step guides
  2. Custom certificate
  3. Adding a certificate

Adding a custom certificate

Written by
Yandex Cloud
Updated at July 20, 2026
View in Markdown
  • Creating a self-signed certificate file
  • Adding a self-signed custom certificate
  • Storing a certificate's private key in Yandex Lockbox

In this article, we will add a self-signed certificate as an example of a custom certificate. Check the custom certificate requirements in Custom certificate.

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

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

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: To output a certificate file.
  • -newkey: To create a new private key file.
  • rsa:4096: Algorithm and key length.
  • -nodes: Do not encrypt the private key file.
  • -keyout: Name of the file to save the private key to.
  • -out: Certificate file name.
  • -days: Certificate validity period.
  • -subj: Certificate owner's Common Name value.

If you run the req command with the above parameters, it 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. Navigate to Certificate Manager.
  3. Click Add certificate.
  4. In the menu that opens, select User certificate.
  5. In the window that opens, in the Name field, enter a custom certificate name.
  6. Optionally, in the Description field, describe your custom certificate.
  7. In the Certificate field, click Add certificate.
    1. Choose how to add it: File.
    2. Click Attach file.
      1. In the window that opens, select the cert.pem self-signed certificate file.
    3. Click Add.
  8. In the Private key field, click Add private key.
    1. Choose how to add it: File.
    2. Click Attach file.
      1. In the window that opens, select the key.pem private key file.
    3. Click Add.
  9. Click Create.

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. View the command description:

    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 certificate private key file.

    Result:

    id: fpqmg47avvim********
    folder_id: b1g7gvsi89m3********
    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 Yandex Cloud provider.

To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), authenticate using the appropriate method.

  1. In the configuration file, describe 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-----
                      <contents_of_certificate_private_key>
                      -----END PRIVATE KEY-----
                      EOT
      }
    }
    

    Where:

    • name: Certificate name.
    • certificate: Certificate file contents.
    • private_key: Private key file contents.

    For more on the properties of the yandex_cm_certificate resource, see this provider guide.

  2. Create the resources:

    1. In the terminal, navigate to the configuration file directory.

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

      terraform validate
      

      If the configuration is valid, you will get this message:

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

      terraform plan
      

      You will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.

    4. Apply the configuration changes:

      terraform apply
      
    5. Type yes and press Enter to confirm the changes.

This will add the certificate to the specified folder. You can check the new certificate and its settings 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 will appear in the certificate list.

Storing a certificate's private key in Yandex LockboxStoring a certificate's private key in Yandex Lockbox

To avoid storing a private key of the user certificate as plain text in the Terraform configuration file, write it to Yandex Lockbox:

Terraform

If you do not have Terraform yet, install it and configure the Yandex Cloud provider.

To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), authenticate using the appropriate method.

  1. Create a secret and write the private key to it.

  2. In the configuration file, specify the properties of the resources you want to create:

    resource "yandex_cm_certificate" "example-lockbox" {
      name = "<secret_name>"
    
      self_managed {
        certificate = <<-EOT
                      -----BEGIN CERTIFICATE-----
                      <certificate_contents>
                      -----END CERTIFICATE-----
                      EOT
        private_key_lockbox_secret {
          id  = "<secret_ID>"
          key = "<secret_key>"
        }
      }
    }
    

    Where:

    • name: Yandex Lockbox secret name.
    • certificate: Certificate file contents.
    • id: ID of the Yandex Lockbox secret containing the private key.
    • key: Key of the Yandex Lockbox secret containing the private key.

    For more on the properties of the yandex_cm_certificate resource, see this provider guide.

  3. Create the resources:

    1. In the terminal, navigate to the configuration file directory.

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

      terraform validate
      

      If the configuration is valid, you will get this message:

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

      terraform plan
      

      You will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.

    4. Apply the configuration changes:

      terraform apply
      
    5. Type yes and press Enter to confirm the changes.

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

yc certificate-manager certificate get <certificate_name>

A new certificate with the Issued status will appear in the certificate list.

Was the article helpful?

Previous
Deleting a certificate
Next
Getting the contents of a certificate
© 2026 Direct Cursus Technology L.L.C.