1.1.0 • Published 6 years ago

credstash-lambda v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

credstash-lambda

Provide reliable method to read Credstash secrets on-demand within Lambda functions. Problem: How do we load values from Credstash (AWS KMS and DynamoDB) smartly and reliably given Lambda's lifecycle? This module provides a simple way to "load" secrets once as part of a Lambda's handler and provide a simple local copy of secrets during the life of the Lambda process.

installation

$ npm install --save credstash-lambda

options

  • table: (STRING) the name of the DynamoDB table which stores encrypted secrets
  • region: (STRING) the AWS region i.e. us-west-2
  • keys: (ArraySTRING) the keys for the values you are retrieving from Credstash
  • [defaults]: (ArraySTRING) optional array of values to use in lieu of Credstash values, used for local test

usage

Credstash.load() / Credstash.get(key)

const Credstash = require('credstash-lambda')({
  table: 'TABLE_NAME',
  region: 'AWS_REGION',
  keys: ['SAMPLE_KEY']
});

function doSomething(..., sampleValue, callback) {
   ...
   callback();
}

module.exports.handle = (event, context, callback) => {
  Credstash.load(function(error) {
    if (error) {
      callback(error);
    } else {
      let sampleValue = Credstash.get('SAMPLE_KEY');
      console.log(`SAMPLE_KEY: ${sampleValue}`);
      doSomething(..., sampleValue, callback);
    }
  });
}
1.1.0

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago