Renewing a custom certificate
Certificate Manager does not manage custom 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.
- Choose how to add it:
FileorText. - Click Add.
- Choose how to add it:
- In the Intermediate certificate chain field, click Add chain.
- Choose how to add it:
FileorText. - Click Add.
- Choose how to add it:
- In the Private key field, click Add private key.
- Choose how to add it:
FileorText. - Click Add.
- Choose how to add it:
- Click Update.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command 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 listResult:
+----------------------+--------+-------------+---------------------+----------+--------+ | ID | NAME | DOMAINS | NOT AFTER | TYPE | STATUS | +----------------------+--------+-------------+---------------------+----------+--------+ | fpqmg47avvim******** | mycert | example.com | 2021-09-15 06:48:26 | IMPORTED | ISSUED | +----------------------+--------+-------------+---------------------+----------+--------+ -
Run this command:
yc certificate-manager certificate update \ --id fpqmg47avvim******** \ --chain myupdatedcert.pem \ --key myupdatedkey.pemWhere:
--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.
Result:
id: fpqmg47avvim******** folder_id: b1g7gvsi89m3******** 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 Yandex Cloud provider.
-
Open the Terraform configuration file and change the
certificateandprivate_keyparameters 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, go to the directory where you edited the configuration file.
-
Make sure the configuration file is correct using this command:
terraform validateIf the configuration is correct, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.
-
Apply the changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
-
You can check the certificate 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.