Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-cdk/aws-kms

Package Overview
Dependencies
Maintainers
5
Versions
288
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-cdk/aws-kms

CDK Constructs for AWS KMS

  • 1.61.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
135K
increased by5.08%
Maintainers
5
Weekly downloads
 
Created

What is @aws-cdk/aws-kms?

@aws-cdk/aws-kms is an AWS CDK library that allows you to define and manage AWS Key Management Service (KMS) resources in your AWS infrastructure as code. It provides constructs for creating and managing KMS keys, aliases, and grants, enabling secure encryption and decryption of data.

What are @aws-cdk/aws-kms's main functionalities?

Create a KMS Key

This code sample demonstrates how to create a new KMS key with key rotation enabled and an alias using the AWS CDK.

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

const app = new cdk.App();
const stack = new cdk.Stack(app, 'MyStack');

const key = new kms.Key(stack, 'MyKey', {
  enableKeyRotation: true,
  alias: 'alias/my-key'
});

app.synth();

Create a KMS Alias

This code sample demonstrates how to create a new KMS alias that points to an existing KMS key using the AWS CDK.

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

const app = new cdk.App();
const stack = new cdk.Stack(app, 'MyStack');

const key = new kms.Key(stack, 'MyKey');

const alias = new kms.Alias(stack, 'MyAlias', {
  aliasName: 'alias/my-alias',
  targetKey: key
});

app.synth();

Grant Permissions to a KMS Key

This code sample demonstrates how to grant encrypt and decrypt permissions to an IAM user for a KMS key using the AWS CDK.

const cdk = require('@aws-cdk/core');
const kms = require('@aws-cdk/aws-kms');
const iam = require('@aws-cdk/aws-iam');

const app = new cdk.App();
const stack = new cdk.Stack(app, 'MyStack');

const key = new kms.Key(stack, 'MyKey');

const user = new iam.User(stack, 'MyUser');

key.grantEncryptDecrypt(user);

app.synth();

Other packages similar to @aws-cdk/aws-kms

Keywords

FAQs

Package last updated on 28 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc