@neweracode/cdk-deletion-protection
TypeScript icon, indicating that this package has built-in type declarations

1.9.1 • Public • Published

NewEraCode Deletion Protection Component

Description

An AWS CDK construct that protects the stack from being deleted or a resource from being deleted during update or deployment.

Usage

Install

$ npm i @neweracode/cdk-deletion-protection

Import

NodeJS

const cdp = require('@neweracode/cdk-deletion-protection');
const deletionProtection = new cdp.CDKDeletionProtection(....)

TypeScript / Babel

import { CDKDeletionProtection } from '@neweracode/cdk-deletion-protection';

Example:

import { UserPool, CfnUserPool } from '@aws-cdk/aws-cognito';
import { CDKDeletionProtection } from '@neweracode/cdk-deletion-protection';

const deletionProtection = new CDKDeletionProtection(this, 'ProtectionPolicies', {
    resourceDeletionPolicy: "RETAIN",
    terminationProtection: true,
});

// enable stack termination deletion protection:
deletionProtection.setStackTerminationProtection(this.stackName);

// protect a Cognito User Pool from getting deleted on update:
const userPool = new UserPool(this, 'cdkUserPool', {...});
const cfnUserPool = userPool.node.defaultChild as CfnUserPool;
deletionProtection.setResourcePolicy(cfnUserPool);

Readme

Keywords

none

Package Sidebar

Install

npm i @neweracode/cdk-deletion-protection

Weekly Downloads

2

Version

1.9.1

License

MIT

Unpacked Size

16 kB

Total Files

6

Last publish

Collaborators

  • neweracode-jj