Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

ssm-parameter-store

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Issues
File Explorer

Advanced tools

ssm-parameter-store

λ✨Ergonomic SSM Parameter Store wrapper for AWS Lambda designed with ease-of-use in mind, with built-in caching and idempotent preloading, TypeScript compile time checks, and handy autocompletion.

    2.1.2latest
    Github

Version published
Maintainers
1
Weekly downloads
840
increased by10.38%

Weekly downloads

Changelog

Source

v2.1.2

  • Take an SSM parameter store instance as a constructor parameter instead of initializing it within the package.
  • Make aws-sdk a peerDependency and not a dependency.

This was done to keep the package size small and avoid bundling a copy of the AWS SDK because it contributed significantly towards the Lambda package size limit, and the AWS SDK was available by default in the AWS Lambda environment anyway. So now ssm-parameter-store doesn't care how you're getting the SDK, it just needs the SSM instance from the SDK to work.

Readme

Source

SSMParameterStore

λ✨Ergonomic SSM Parameter Store wrapper for AWS Lambda designed with ease-of-use in mind, with built-in caching and idempotent preloading, TypeScript compile time checks, and handy autocompletion.

https://www.npmjs.com/package/ssm-parameter-store

Installation

npm install --save ssm-parameter-store

Changelog

2.1.2
  • Take an SSM parameter store instance as a constructor parameter instead of initializing it within the package.

Usage

const AWS = require('aws-sdk'); const SSMParameterStore = require('ssm-parameter-store'); const parameters = new SSMParameterStore(new AWS.SSM(), { SomeParameter: 'some_parameter', SomeNestedParameter: '/some/nested/parameter', NonExistentParameter: 'this_parameter_doesnt_exist_on_ssm' }); exports.handler = async (event, context) => { await parameters.preload(); // Fetch and cache all the parameter values from SSM. // The cache persists across warm start Lambda invocations, so subsequent // calls to preload will resolve instantly, making it safe to call every time // in the Lambda handler. await params.getAll(); // Returns all the parameters as an object. Since we already fetched and cached // the values when we called `preload` this resolves instantly. If `preload` wasn't // called then we fetch the parameter values from SSM and cache them before returning // them as an object. Parameters that don't exist on SSM have empty strings as their values. // // { // SomeParameter: '1', // SomeNestedParameter: 'Hello, World!', // NonExistentParameter: '' // } await parameters.preload({ ignoreCache: true }); // Clear the cache and preload everything again from SSM await parameters.get('SomeParameter')); // Get a specific parameter value from SSM and return it // Caches it in case it hasn't been cached before. // If the parameter doesn't exist on SSM it returns an empty string. await parameters.get('SomeParameter', { ignoreCache: true }); // Fetches this parameter value from SSM again and returns it ignoring any cached values. // The newly fetched value is cached before returning. // If the parameter doesn't exist on SSM it returns an empty string. await parameters.get('UndeclaredParameter'); // Throws an error because this wasn't declared in the object passed to the // `new SSMParameterStore()` constructor. // If you're using TypeScript you'll also get a compile time error }

Autocompletion

Keywords

FAQs

Last updated on 18 Jul 2020

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc