ALTER BACKUP statement allows for new KMS encryption keys to be applied to an existing chain of encrypted backups (full and incremental). Each ALTER BACKUP statement must include the new KMS encryption key with NEW_KMS, and use WITH OLD_KMS to refer to at least one of the KMS URIs that were originally used to encrypt the backup.
After an ALTER BACKUP statement successfully completes, subsequent BACKUP, RESTORE, and SHOW BACKUP statements can use any of the existing or new KMS URIs to decrypt the backup.
CockroachDB supports AWS, Azure, and Google Cloud KMS keys. For more detail on encrypted backups and restores, see Take and Restore Encrypted Backups.
Synopsis
Parameters
Required privileges
ALTER BACKUPcan only be run by members of theadminrole. By default, therootuser belongs to theadminrole.ALTER BACKUPrequires full read and write permissions to the target cloud storage bucket.
admin role when using s3, azure, or gs with specified credentials. The backup collection’s URI does require the admin role when using s3, azure, or gs with implicit credentials.
We recommend using cloud storage.
Examples
ALTER BACKUP will apply the new encryption information to the entire chain of backups (full and incremental).
When running
ALTER BACKUP with a subdirectory, the statement must point to a full backup in the backup collection.Add an AWS KMS key to an encrypted backup
To add a new KMS key to the most recent backup:ALTER BACKUP statement that points to the full backup:
SHOW BACKUP.
Add an Azure KMS key to an encrypted backup
To add a new KMS key to the most recent backup:ALTER BACKUP statement that points to the full backup:
SHOW BACKUP.
Add a Google Cloud KMS key to an encrypted backup
To add a new KMS key to the most recent backup:ALTER BACKUP statement that points to the full backup:
SHOW BACKUP.

