Backup management

Updated at:

Key Management Service (KMS) backup management helps you quickly restore data in scenarios such as accidental deletion of keys or secrets and disaster recovery. This topic describes how to enable automatic backup and manual backup, and how to restore, extend, reset, and download backup data.

Scope

Supported instance types

Both software key management instances and hardware key management instances support backup. For more information, see Manage keys.

  • Software key management instances: Backup of key metadata, key material, and secret data is supported.

  • Hardware key management instances:

    • Backup scope: Only the metadata of hardware keys is backed up. Key material is not backed up by KMS. Key material is backed up by the associated HSM cluster. For more information, see Data backup and restoration.

      Important

      To fully protect key data in a hardware instance, you must enable both KMS backup and HSM backup.

    • Image version requirement: The image version of a hardware key management instance must be 3.9.1 or later to use the backup feature. To upgrade the image version, see Upgrade the image version of a KMS instance.

Recovery target scope

  • Single account: Data can be restored to any software key management instance within the current account.

  • Multi-account sharing: Only the resource owner can perform backup and restore operations.

    • Resources created by the resource owner: Data can be restored to any software key management instance of the resource owner.

    • Resources created by a resource user: Data can be restored only to the original shared KMS instance. After the restoration, both parties can use the resources.

      Note

      Restoration is not supported after the sharing relationship is terminated.

  • Hardware key management instances: Data cannot be restored to the original instance. Data can be restored only to a new instance.

Scenarios

  • A software key management instance or hardware key management instance needs to be recovered after it is released.

  • Keys or secrets need to be restored after they are accidentally deleted.

  • Your business is distributed across multiple regions, and you need to copy keys or secrets to other regions for disaster recovery or nearby access.

Features

Each backup can back up the data of one KMS instance. Two backup methods are supported: automatic backup and manual backup.

  • Automatic backup:

  • Manual backup: Includes default backups and purchased backups. You must manually enable manual backup.

Item

Description

Automatic backup

Manual backup

Default backup

Purchased backup

Fee

Whether additional fees are charged.

Free of charge.

Free of charge.

Paid.

The fee depends on the subscription duration and the configured number of viewable days.

Backup deletion time

The time when backup data is deleted by default.

The backup lifecycle depends on the backed-up KMS instance. Backup data is deleted 90 days after the KMS instance is released.

Backup data cannot be manually deleted.

Valid permanently. You can manually delete backup data by resetting the backup.

The backup lifecycle depends on the subscription duration. The backup is released and deleted 15 days after it expires.

You can also manually delete backup data by resetting the backup.

Important

No operations are supported after a backup expires. However, before the backup is released, you can renew it to reactivate and use it. The fee for reactivation is the same as the fee for purchasing a new backup of the same specification.

Viewable days

The number of days within which you can view backup data.

For example, the viewable days of a purchased backup is set to 50.

Assume that 80 days of data have been backed up since the backup was started. Because the viewable days is 50, you can view only the backup data of the most recent 50 days. To view earlier data, you must extend the viewable days.

Note

Configure the viewable days based on your key rotation and business disaster recovery requirements.

90 days. Extension is not supported.

7 days. Extension is not supported.

You can select 7 to 600 days when you purchase the backup.

You can extend the viewable days after the purchase, but you cannot decrease it.

Backup time

The time at which backups are performed every day.

A full backup is performed the first time. After that, a full backup is performed at 00:00 every day, and an incremental backup is performed every 5 minutes after the full backup is complete.

Backup type

Identifies the backup source for quick recognition.

System Created

Default

Paid

Back up data

Prerequisites

To restore a backup, the destination instance must meet the following conditions.

  • The destination instance has sufficient key or secret quota.

  • No key or secret with the same name exists in the destination region. To overwrite data during restoration, delete the corresponding key or secret in the destination region first.

  • To restore a secret, the key that is used to encrypt the secret must already exist in the destination instance.

Automatic backup

After you enable a software or hardware key management instance, KMS automatically backs up the data of the instance. For more information about how to enable an instance, see Purchase and enable a KMS instance.

After the instance is enabled, KMS automatically generates a backup. You can view the backup on the Backups page. A backup whose Backup Type is System Created and whose Backup Object is the corresponding software key management instance is a backup created by KMS.

Manual backup

  1. Log on to the Key Management Service console. In the top navigation bar, select a region. In the left-side navigation pane, choose Security Operations > Disaster Recovery > Backups.

  2. (Optional) Purchase a backup.

    Note

    Skip this step if you use the default backup.

    1. On the Backups page, click Create Backup, configure the parameters based on your business requirements, and then click Buy Now.

      Parameter

      Description

      Key Management Type

      Select Key Value-added Service.

      Key Value-added Service

      Select Instance Backup.

      Region

      The region must be the same as the region of the software key management instance that you want to back up.

      Viewable Days

      The number of days within which you can view backup data.

      Quantity

      The number of backups.

      Note

      Each backup can back up the data of one software key management instance.

      Subscription Duration

      The subscription duration of the backup.

    2. On the Confirm Order page, read and select Terms of Service, and then click Pay to complete the purchase.

  3. Enable the backup.

    Important

    A full backup is performed the first time you enable the backup. After that, a full backup is performed at 00:00 every day, and an incremental backup is performed every 5 minutes after the full backup is complete.

    1. On the Backups page, find the target backup and click Enable in the Actions column.

    2. In the Enable Backup dialog box, configure the parameters and click Confirm.

      Parameter

      Description

      Instance Type

      Select Software Key Management or Hardware Key Management. If you switch the type, the backup object field is reset.

      Source Instance

      Select the key management instance that you want to back up. Only enabled instances that match the selected backup data specification are displayed.

      Data Type

      Default values: Keys and Secrets. You cannot change the values.

      Backup Alias

      The custom alias of the backup.

  4. (Optional) View backup data.

    In the Actions column of the target backup, click View Data, select a date, and then view the backup data of that day.

    Data type

    Description

    Fully Backed up Keys

    All keys backed up at 00:00 on that day.

    Incrementally Backed up Keys

    Keys added on that day.

    Rotated Keys

    Keys rotated on that day.

    Fully Backed up Secrets

    All secrets backed up at 00:00 on that day.

    Incrementally Backed up Secrets

    Secrets added on that day.

    Rotated Secrets

    Secrets rotated on that day.

Restore data

Restore backups of software key management instances

  1. Log on to the Key Management Service console. In the top navigation bar, select a region. In the left-side navigation pane, choose Security Operations > Disaster Recovery > Backups.

  2. In the Actions column of the target backup, click Details and select the date of the data that you want to restore.

    Important

    Purchased backups support extending the Viewable Days. If the date of the data that you want to restore is outside the current range, you can extend the viewable days first and then restore the data. However, data generated before the backup was enabled cannot be restored.

    For example, a backup is enabled on May 1, 2024, and the initial Viewable Days is 10. To restore the data of May 5 on May 20, 2024, you can extend the Viewable Days to 16.

    Data type

    Procedure

    Keys

    1. Select a Data Type (for example, Fully Backed up Keys), find the target key, and then click Restore Data in the Actions column.

    2. In the Restore Data dialog box, select the destination region and instance, and then click OK.

    Secrets

    1. Restore the key that is used to encrypt the secret.

      Note

      To restore a secret, the key that is used to encrypt the secret must exist in the destination instance. If you are sure that the key exists in the destination instance, skip this step and restore the secret directly.

      1. Select a Data Type (for example, Fully Backed up Keys), find the key associated with the secret, and then click Restore Data in the Actions column.

      2. In the Restore Data dialog box, select the region and instance to which you want to restore the key, and then click OK.

    2. Restore the secret.

      1. Select a Data Type (for example, Fully Backed up Secrets), find the target secret, and then click Restore Data in the Actions column.

      2. In the Restore Data dialog box, select the destination region and instance, and then click OK.

Restore backups of hardware key management instances

Usage notes

  • Data cannot be restored to the original instance. Data can be restored only to a new instance.

  • To ensure eventual data consistency, we recommend that you set the HSM backup time to one day later than the KMS backup time.

Step 1: Back up HSM data

If data backup and recovery was enabled when you purchased the associated HSM instance of the hardware instance that you want to restore, skip this step.

  1. Log on to the HSM Management Console. In the top navigation bar, select the destination region.

  2. On the VSMs page, find the target HSM and choose Upgrade in the Actions column.

    Note

    If Upgrade is not displayed, data backup and recovery may have been enabled for the HSM.

  3. On the configuration change page, enable data backup and recovery, select the Number of Images, read and select the terms of service, click Buy Now, and then complete the purchase as prompted.

    Important

    Make sure that the number of Image Extensions is the same as the Viewable Days of the KMS instance backup. Otherwise, the backup data may be incomplete. For example, if the viewable days is set to 30, you must purchase 30 image extensions.

  4. After the purchase is complete, backups are automatically created at the scheduled time. You can view the names of the generated backups on the Data Backup and Restoration page.

Step 2: Create a hardware instance and restore data

  1. Restore data: After the HSM backup data is generated, restore data by following the instructions below.

    1. Prepare a new HSM instance:

      1. Purchase an HSM instance in the region where the hardware key management instance to which you want to restore data resides.

      2. Backup management supports only HSMs deployed in cluster mode. Therefore, when you purchase instances, you must select at least two HSMs across two zones. For more information, see Purchase an HSM instance.

        Warning

        After the purchase, do not enable the HSM instance. If the destination HSM is in use, contact Alibaba Cloud technical support to disable and reset the HSM instance first. Resetting clears all data in the HSM instance and restores the instance to factory settings. You can then restore the original data from the backup image.

    2. Restore HSM data:

      1. Log on to the Encryption Service Management console.

      2. On the Data Backup and Restoration page, select the backup data of the HSM associated with the hardware key management instance that you want to restore (Backup Type is Auto Create).

        Note

        We recommend that you select the most recent backup data.

      3. Click View Image in the Actions column of the target backup.

      4. On the image backup details page, click Restore Instance in the Actions column of the target image.

      5. In the Restore Instance dialog box, select Instance (the HSM instance purchased in the previous step), and then click OK.

    3. Purchase and enable a hardware key management instance:

      1. Log on to the Key Management Service console. In the top navigation bar, select a region. In the left-side navigation pane, choose Resources > Instances.

      2. On the Hardware Key Management tab, click Create Instance, select the specification of the KMS hardware key management instance that you want to purchase, and then click Buy Now.

      3. Return to the Hardware Key Management page, find the newly purchased hardware key management instance, and then click Enable in the Actions column.

      4. In the Connect to HSM panel, select the HSM instance newly purchased in Step 1 in the Select Cluster section, and then click Connect to HSM.

    4. Restore data of the hardware key management instance:

      1. Log on to the Key Management Service console. In the top navigation bar, select a region. In the left-side navigation pane, choose Security Operations > Disaster Recovery > Backups.

      2. In the Actions column of the target backup, click Details and select the date of the data that you want to restore.

        Important

        Purchased backups support extending the Viewable Days. If the date of the data that you want to restore is outside the current range, you can extend the viewable days first and then restore the data. However, data generated before the backup was enabled cannot be restored.

        For example, a backup is enabled on May 1, 2024, and the initial Viewable Days is 10. To restore the data of May 5 on May 20, 2024, you can extend the Viewable Days to 16.

        Data type

        Procedure

        Keys

        1. Select a Data Type (for example, Fully Backed up Keys), find the target key, and then click Restore Data in the Actions column.

        2. In the Restore Data dialog box, select the destination region and instance, and then click OK.

        Secrets

        1. Restore the key that is used to encrypt the secret.

          Note

          To restore a secret, the key that is used to encrypt the secret must exist in the destination instance. If you are sure that the key exists in the destination instance, skip this step and restore the secret directly.

          1. Select a Data Type (for example, Fully Backed up Keys), find the key associated with the secret, and then click Restore Data in the Actions column.

          2. In the Restore Data dialog box, select the region and instance to which you want to restore the key, and then click OK.

        2. Restore the secret.

          1. Select a Data Type (for example, Fully Backed up Secrets), find the target secret, and then click Restore Data in the Actions column.

          2. In the Restore Data dialog box, select the destination region and instance, and then click OK.

More operations

Extend viewable days

Important

Only purchased backups support extending viewable days. Only upgrades are supported. Downgrades are not supported.

  1. Log on to the Key Management Service console. In the top navigation bar, select a region. In the left-side navigation pane, choose Security Operations > Disaster Recovery > Backups.

  2. In the Actions column of the target backup, click View Data.

  3. On the backup details page, click Extend Queryable Range, select the new number of viewable days, click Buy Now, and then complete the payment.

Reset a backup

Only default backups and purchased backups can be reset. You can reset a backup to delete the backed-up data and unbind the backup from the software key management instance.

Warning

Resetting a backup deletes all data that has been backed up by the backup. Proceed with caution.

  1. Log on to the Key Management Service console. In the top navigation bar, select a region. In the left-side navigation pane, choose Security Operations > Disaster Recovery > Backups.

  2. In the Actions column of the target backup, click Reset.

  3. Read the message in the Reset dialog box, confirm that the information is correct, and then click OK.

    After the backup is reset, its status changes to Disabled. You can bind the backup to a software key management instance again.

Renew a backup

Only purchased backups can be renewed.

  1. Log on to the Key Management Service console. In the top navigation bar, select a region. In the left-side navigation pane, choose Security Operations > Disaster Recovery > Backups.

  2. In the Actions column of the target backup, click Renew.

  3. On the renewal page, select a subscription duration, read and select the terms of service, click Buy Now, and then complete the payment.

Download backup data files

Important

Keep the downloaded backup data file secure. The backup data file can be used to restore data only in the KMS console.

  1. Log on to the Key Management Service console. In the top navigation bar, select a region. In the left-side navigation pane, choose Security Operations > Disaster Recovery > Backups.

  2. In the Actions column of the target backup, click Download.

  3. In the Download dialog box, select a Backup Date and click OK.

    Note

    To download backup data outside the Viewable Days range, you must extend the viewable days first.

  4. Save the backup data.

    • Click the Copy icon icon next to Encryption Key to copy the key, and then save it to your computer.

    • Click Download next to Backup Data to download the backup data file, and then keep the file secure.

    Important

    The data encryption key is used to decrypt the downloaded backup data file. KMS does not store the Data Encryption Key or the Backup Data File. Keep them secure to prevent leaks.

Upload backup data files

Important

If you upload backup data files across borders, make sure that you comply with the relevant laws and regulations on cross-border data transfer.

  1. Log on to the Key Management Service console. In the top navigation bar, select a region. In the left-side navigation pane, choose Security Operations > Disaster Recovery > Backups.

  2. On the Backups page, click Upload Backup.

  3. In the Import Backup Data dialog box, enter the Decryption Key and Backup Name, and then click OK.

  4. In the file selection dialog box that appears, select the backup data file and click Open.

    After the file is uploaded, you can view the uploaded data on the Backups page. The Backup Type of the data is Upload.

View the HSM information associated with a hardware instance backup

Note

This information helps you identify the HSM cluster that needs to be backed up. We recommend that you set the HSM backup time to one day later than the KMS backup time to ensure data consistency.

  1. Log on to the Key Management Service console. In the top navigation bar, select a region. In the left-side navigation pane, choose Security Operations > Disaster Recovery > Backups.

  2. On the Backups page, click Details in the Actions column.

  3. In the basic information panel of the backup details page, you can view the following HSM-related fields:

    • Cluster ID: the ID of the HSM cluster associated with the hardware instance.

    • Primary HSM: the ID of the primary HSM in the HSM cluster.

FAQ

  • How do I view the viewable days of a backup?

    On the Backups page, view the Queryable Range column.

  • What do I do if a restoration fails due to insufficient quota?

    If the key or secret quota of the destination instance is exhausted, delete unused keys or secrets in the destination instance to free up quota, or upgrade the destination instance to a higher specification to obtain a larger quota. Then, restore the data again.

  • What do I do if a name conflict occurs during restoration?

    Restoration requires that no key or secret with the same name exists in the destination instance. If a conflict occurs, delete the key or secret with the same name in the destination region, and then restore the data again. If you want to retain the existing resources, rename them before you delete them, or restore the data to another destination instance that has no conflicts.

  • What do I do after a backup expires?

    No operations are supported after a purchased backup expires. However, if the backup has not been released (within 15 days after it expires), you can renew it to reactivate and use it. The renewal fee is the same as the fee for purchasing a new backup of the same specification. Automatic backups cannot be renewed. The lifecycle of an automatic backup depends on the associated KMS instance.