Editing a custom certificate
After adding a custom certificate to Certificate Manager, you can change its name or description. To edit a 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 need to change from the list.
- In the window that opens, click Edit.
- Change the name or description of the certificate.
- Click Save.
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 list
Result:
+----------------------+--------+-------------+---------------------+----------+--------+ | ID | NAME | DOMAINS | NOT AFTER | TYPE | STATUS | +----------------------+--------+-------------+---------------------+----------+--------+ | fpqmg47avvim******** | mycert | example.com | 2021-09-15 08:12:57 | IMPORTED | ISSUED | +----------------------+--------+-------------+---------------------+----------+--------+
-
Run this command:
yc certificate-manager certificates update \ --id fpqmg47avvim******** \ --new-name myupdatedcert \ --description "description of myupdatedcert"
Where:
--id
: Certificate ID.--new-name
: New name for the certificate.--description
: Certificate description.
Result:
id: fpqmg47avvim******** folder_id: b1g7gvsi89m3******** created_at: "2020-09-15T06:54:44.916Z" ... issued_at: "2020-09-15T08:23:50.147Z" 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 its Yandex Cloud provider.
-
Open the Terraform configuration file and change the certificate name or description:
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 validate
If the configuration is correct, you will get this message:
Success! The configuration is valid.
-
Run this command:
terraform plan
You will see a detailed list of resources. No changes will be made at this step. Terraform will show any errors found in your configuration.
-
Apply the changes:
terraform apply
-
Type
yes
and press Enter to confirm the changes.
-
You can check the certificate update using the management console
yc certificate-manager certificate get <certificate_name>
To edit a certificate, use the update REST API method for the Certificate resource or the CertificateService/Update gRPC API call.