/serverless-backup-vault-cleaner

Serverless Framework plugin that empties an AWS Backup vault before removing a stack

Primary LanguageTypeScriptMIT LicenseMIT

serverless-backup-vault-cleaner

serverless license build status npm version

Serverless Framework plugin that empties an AWS backup vault (i.e. deletes all its restore points) before removing a deployed stack. This makes it possible to remove stacks that contain a backup vault as a resource.

Installation

npm install serverless-backup-vault-cleaner --save-dev

Compatibility with Serverless Framework

Version 1.0.1 is compatible with Serverless Framework v3, but it uses the legacy logging interface. Version 2.0.0 and later uses the new logging interface.

serverless-backup-vault-cleaner Serverless Framework
v1.0.0 v1.x, v2.x
v1.0.1 v1.x, v2.x, v3.x
≥ v2.0.0 v3.x

Usage

Add the following to your serverless.yml:

plugins:
  - serverless-backup-vault-cleaner

custom:
  serverless-backup-vault-cleaner:
    # Names of backup vaults to remove before a stack is removed
    backupVaults:
      - vaultName1
      - vaultName2

    # (optional) Backup vaults to remove before a stack is deployed
    backupVaultsToCleanOnDeploy:
      - oldBucketName

When removing a Serverless Framework stack, this plugin automatically empties the backup vaults listed under backupVaults option.

When deploying a Serverless Framework stack, this plugin automatically empties the backup vaults listed under backupVaultsToCleanOnDeploy option. Use this when renaming or removing a backup vault (put here the old vault name) to avoid deployment errors when CloudFormation tries to remove the old backup vault.

Permissions

The plugin requires the following permissions for the role that Serverless runs with:

  • backup:DescribeBackupVault
  • backup:ListRecoveryPointsByBackupVault
  • backup:DeleteRecoveryPoint