@stratiformdigital/serverless-stage-destroyer
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

serverless-stage-destroyer

Utility to help destroy AWS resources deployed by Serverless Framework.

latest release npm latest version Maintainability semantic-release: angular Dependabot code style: prettier

Usage

Install to your project with your packager manager of choice, likely as a dev dependency:

npm install @stratiformdigital/serverless-stage-destroyer --save-dev

Import the package:

import { ServerlessStageDestroyer } from "@stratiformdigital/serverless-stage-destroyer";
let destroyer = new ServerlessStageDestroyer();

Destroy resources associated with the "foo" stage in Amazon's us-east-1 region:

destroyer.destroy("us-east-1", "foo", {});

Assorted Notes/Considerations

This package is meant to make it easy to clean up cloudformation stacks deployed by the Serverless Framework.

Keep in mind:

  • Any stage that contains the substring 'prod' cannot be removed with this package. There's no override provided; if you need to destroy a stage containing 'prod', you're on your own.
  • By default, the destroy function will wait for all cloudformation stacks to be destroyed. If you'd like to trigger destroys and then exit immediately without waiting, you may pass 'wait: false' in the destroy() options.
destroyer.destroy("us-east-1", "foo", {
  wait: false
});
  • By default, the destroy function will prompt the user to confirm destruction by way of asking the user to re-enter the stage name. If you'd like to skip the prompt (like for CI systems), you may pass 'verify: false' in the destroy() options.
destroyer.destroy("us-east-1", "foo", {
  verify: false
});
  • Any number of cloudformation tag filters may be passed in the destroy options. This can be useful if you want to destroy just a particular service. If your project adds default tags to each stage, such as to identify the parent project in a shared AWS account, you can filter on that, too. The filters can contain any number of Key/Value pairs:
destroyer.destroy("us-east-1", "foo", {
  filters: [
    {
      Key: "PROJECT",
      Value: "serverless-stage-destroyer",
    },
    {
      Key: "SERVICE",
      Value: "alpha",
    },
  ]
});

License

License: MIT

See LICENSE for full details.

Package Sidebar

Install

npm i @stratiformdigital/serverless-stage-destroyer

Weekly Downloads

119

Version

2.1.1

License

MIT

Unpacked Size

33.5 kB

Total Files

17

Last publish

Collaborators

  • mdial87r