Renewing a custom certificate
Certificate Manager doesn't manage user certificates. To make your certificate continuously available to your resources, be sure to renew it on time.
To get a new version of a user certificate:
- In the management console
, select the folder the certificate was added to. - In the list of services, select Certificate Manager.
- Select the certificate you want to renew in the list.
- In the window that opens, click Renew certificate.
- In the window that opens, click Add certificate in the Certificate field.
- Select how to add your certificate: File or Text.
- Click Add.
- In the Intermediate certificate chain field, click Add chain.
- Select how to add your certificate: File or Text.
- Click Add.
- In the Private key field, click Add private key.
- Select how to add your certificate: File or Text.
- Click Add.
- 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.
-
View a description of the command:
yc certificate-manager certificate update --help
-
View the list of certificates:
yc certificate-manager certificate list
Command result:
+----------------------+--------+-------------+---------------------+----------+--------+ | ID | NAME | DOMAINS | NOT AFTER | TYPE | STATUS | +----------------------+--------+-------------+---------------------+----------+--------+ | fpqmg47avvimp7rvmp30 | mycert | example.com | 2021-09-15 06:48:26 | IMPORTED | ISSUED | +----------------------+--------+-------------+---------------------+----------+--------+
-
Run this command:
yc certificate-manager certificate update \ --id fpqmg47avvimp7rvmp30 \ --chain myupdatedcert.pem \ --key myupdatedkey.pem
Where:
--id
: ID of the certificate to renew.--chain
: Path to the new certificate chain file.--key
: Path to the file of the new certificate private key.
Command result:
id: fpqmg47avvimp7rvmp30 folder_id: b1g7gvsi89m34qmcm3ke created_at: "2020-09-15T06:54:44.916Z" ... issued_at: "2020-09-15T08:23:50.147668Z" not_after: "2021-09-15T08:12:57Z" not_before: "2020-09-15T08:12:57Z"
If you do not have Terraform yet, install it and configure the Nebius Israel provider.
-
Open the Terraform configuration file and change the
certificate
andprivate_key
parameters of the certificate:Sample certificate description in the Terraform configuration... resource "yandex_cm_certificate" "imported-certificate" { name = "my-certificate" description = "this is a test certificate" self_managed { certificate = <<-EOT -----BEGIN CERTIFICATE----- MIIF... -----END CERTIFICATE----- EOT private_key = <<-EOT -----BEGIN PRIVATE KEY----- MIIJ... -----END PRIVATE KEY----- EOT } } ...
-
Apply the changes:
-
In the terminal, change to the folder where you edited the configuration file.
-
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.
-
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.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
in the terminal and press Enter.
-
You can check the certificate's update using the management console
yc certificate-manager certificate get <certificate_name>
To renew a certificate, use the update REST API method for the Certificate resource or the CertificateService/Update gRPC API call.