npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-red-contrib-aws-kms

v2.0.2

Published

Node-RED node for AWS KMS operations with flexible credential handling

Readme

node-red-contrib-aws-kms

A Node-RED node for AWS KMS (Key Management Service) operations. This module provides a simple way to perform encryption, decryption, and key generation operations using AWS KMS directly from your Node-RED flows.

Developed by Andrii Lototskyi

Installation

Run the following command in your Node-RED user directory (typically ~/.node-red):

npm install node-red-contrib-aws-kms

After installation, restart Node-RED to load the new nodes.

Features

This node provides the following AWS KMS operations:

  • Encrypt: Encrypt data using a KMS key
  • Decrypt: Decrypt data that was encrypted using KMS
  • Generate Data Key: Generate a new data key for client-side encryption

Supported Operations

  1. Encrypt

    • Encrypts data using the specified KMS key
    • Input: String or Buffer in msg.payload
    • Output: Base64-encoded encrypted data in msg.payload
  2. Decrypt

    • Decrypts data encrypted using KMS
    • Input: Base64-encoded encrypted data in msg.payload
    • Output: Decrypted data in msg.payload
  3. Generate Data Key

    • Generates a new data key for client-side encryption
    • No input required
    • Output: Object in msg.payload containing:
      • plaintext: Base64-encoded plaintext key
      • ciphertext: Base64-encoded encrypted key

Configuration

AWS Credentials

  1. Add a new AWS KMS Config node
  2. Choose an authentication method:
    • IAM Role (recommended for EC2 instances)
    • Access Key and Secret Key
    • Temporary credentials with Session Token

Node Configuration

  1. Add an AWS KMS node to your flow
  2. Configure the node with:
    • AWS credentials (select the config node)
    • Region (e.g., us-east-1)
    • Operation type
    • Key ID (ARN of the KMS key)
    • Key Spec (for Generate Data Key operation)

Examples

Basic Encryption Flow

[
    {
        "id": "aws-kms-encrypt",
        "type": "aws-kms",
        "name": "Encrypt Data",
        "aws": "aws-credentials",
        "region": "us-east-1",
        "operation": "encrypt",
        "keyId": "arn:aws:kms:us-east-1:123456789012:key/your-key-id"
    }
]

Decryption Flow

[
    {
        "id": "aws-kms-decrypt",
        "type": "aws-kms",
        "name": "Decrypt Data",
        "aws": "aws-credentials",
        "region": "us-east-1",
        "operation": "decrypt"
    }
]

Generate Data Key Flow

[
    {
        "id": "aws-kms-generate-key",
        "type": "aws-kms",
        "name": "Generate Data Key",
        "aws": "aws-credentials",
        "region": "us-east-1",
        "operation": "generateDataKey",
        "keyId": "arn:aws:kms:us-east-1:123456789012:key/your-key-id",
        "keySpec": "AES_256"
    }
]

Best Practices

  1. Security

    • Use IAM roles when possible
    • Rotate access keys regularly
    • Use temporary credentials for enhanced security
    • Follow the principle of the least privilege
  2. Performance

    • Use data keys for large data encryption
    • Cache data keys when possible
    • Consider regional placement of KMS keys
  3. Error Handling

    • Always handle encryption/decryption errors
    • Implement retry logic for transient failures
    • Log security-related events

Troubleshooting

Common Issues

  1. "Key ID required" Error

    • Ensure the Key ID is set in node config or msg.keyId
    • Verify the Key ID format (should be a valid KMS key ARN)
  2. "Could not load credentials" Error

    • Check AWS credentials configuration
    • Verify IAM role permissions
    • Ensure environment variables are set correctly
  3. "Invalid region" Error

    • Verify the region format (e.g., us-east-1)
    • Ensure the region is supported by AWS KMS
  4. "Invalid ciphertext" Error

    • Verify the input data is properly base64 encoded
    • Check if the data was encrypted with the same key

Debugging

  1. Enable Node-RED debug output
  2. Check AWS CloudWatch logs
  3. Verify IAM permissions
  4. Test with AWS CLI first

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

MIT

Support

For issues and feature requests, please use the GitHub issue tracker.