JSPM

@aws-cdk/aws-kms

1.21.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 303054
  • Score
    100M100P100Q22545F
  • License Apache-2.0

CDK Constructs for AWS KMS

Package Exports

  • @aws-cdk/aws-kms

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@aws-cdk/aws-kms) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

AWS Key Management Service Construct Library


Stability: Stable


Define a KMS key:

import kms = require('@aws-cdk/aws-kms');

new kms.Key(this, 'MyKey', {
    enableKeyRotation: true
});

Add a couple of aliases:

const key = new kms.Key(this, 'MyKey');
key.addAlias('alias/foo');
key.addAlias('alias/bar');

Sharing keys between stacks

To use a KMS key in a different stack in the same CDK application, pass the construct to the other stack:

sharing key between stacks

Importing existing keys

To use a KMS key that is not defined in this CDK app, but is created through other means, use Key.fromKeyArn(parent, name, ref):

const myKeyImported = kms.Key.fromKeyArn(this, 'MyImportedKey', 'arn:aws:...');

// you can do stuff with this imported key.
myKeyImported.addAlias('alias/foo');

Note that a call to .addToPolicy(statement) on myKeyImported will not have an affect on the key's policy because it is not owned by your stack. The call will be a no-op.