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:
File
orText
. - Click Add.
- Choose how to add it:
- In the Intermediate certificate chain field, click Add chain.
- Choose how to add it:
File
orText
. - Click Add.
- Choose how to add it:
- In the Private key field, click Add private key.
- Choose how to add it:
File
orText
. - Click Add.
- Choose how to add it:
- Click Update.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder through 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
Result:
+----------------------+--------+-------------+---------------------+----------+--------+ | 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.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.
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 don't have Terraform, install it and configure the Yandex Cloud 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 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.