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

aws-parameter-cache

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-parameter-cache

Parameter cache for AWS System Manager Parameter Store and AWS Secrets Manager

  • 2.0.15
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.2K
increased by15.23%
Maintainers
1
Weekly downloads
 
Created
Source

aws-parameter-cache

Build Release

Parameter cache for AWS System Manager Parameter Store and AWS Secrets Manager

Installation

npm install aws-parameter-cache @aws-sdk/client-ssm @aws-sdk/client-secrets-manager

How to use

import { ssmParameter } from 'aws-parameter-cache';

const param = ssmParameter({ name: 'foo' });
const value = await param.value;

Secrets Manager Parameter

// https://docs.aws.amazon.com/systems-manager/latest/userguide/integration-ps-secretsmanager.html
import { secretsManagerParameter } from 'aws-parameter-cache';

const param = secretsManagerParameter({ name: 'foo' });
const value = await param.value;

Secrets Manager Secret

import { secretsManagerSecret } from 'aws-parameter-cache';

const secret = secretsManagerSecret({ secretId: 'foo' });
const secretString = await secret.secretString;

Cache invalidation

const param = ssmParameter({ name: 'foo', maxAge: 1000 * 60 * 5 });
const value = await param.value;

Force refresh

const param = ssmParameter({ name: 'foo' });
const value = await param.value;

param.refresh();

const newValue = await param.value;

StringList (SSM Parameter)

const param = ssmParameter({ name: 'fooList' }); // XXX,YYY,ZZZ
const valueArray = await param.value; // ['XXX','YYY','ZZZ']

valueArray.forEach(console.log)

Usage with AWS Lambda

const param = ssmParameter({ name: 'name' });

export const handler =  async (event, context) => {
  const value = await param.value
  return `Hello ${value}`
}

IAM (SSM Parameter)

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ssm:GetParameter"
            ],
            "Resource": "arn:aws:ssm:<REGION>:<ACCOUNT_ID>:parameter/<PARAMETER_NAME>"
        },
        {
            "Effect": "Allow",
            "Action": [
                "kms:Decrypt"
            ],
            "Resource": "arn:aws:kms:<REGION>:<ACCOUNT_ID>:alias/aws/ssm"
        }
    ]
}

License

MIT

Keywords

FAQs

Package last updated on 10 Jan 2022

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