Giter VIP home page Giter VIP logo

aws-es-credentials's Introduction

aws-es-credentials

Elasticsearch credentials manager for AWS

A wrapper around the elasticsearch JS client that keeps the AWS session token updated automatically. The client defaults to using the metadata service, but can also use a provided credentials object or environment variables.

Using the credentials or environment variables is handy for local development, where as your instance will have the metadata service to use.

The client will automatically refresh the token every hour by requesting again from the metadata service.

Usage

The client will query the metadata service by default but can be disabled by passing false useMetadataService option.

// The client returns a promise as an async request is made to get the session token values

// Automatically use metadata service
import awsEsCredentials from 'aws-es-credentials';

(async () => {
    const options = {
        hosts: 'localhost:9200'
    };

    const client = await awsEsCredentials(options);
    client.seach(// search json goes here);
})();

// Turn metadata service off, will attempt to use environment variables
(async () => {
    const options = {
        hosts: 'localhost:9200',
        useMetadataService: false
    };

    const client = await awsEsCredentials(options);
    client.seach(// search json goes here);
})();

// Pass credentials manually
(async () => {
    const options = {
        hosts: 'localhost:9200',
        useMetadataService: false,
        credentials: new AWS.Credentials('x', 'xx', 'xxx')
    };

    const client = await awsEsCredentials(options);
    client.seach(// search json goes here);
})();

TODO

  • handle relvalidation errors

aws-es-credentials's People

Contributors

jackpopp avatar matt-rhys-jones avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar Takako Tsukayoshi  avatar Marty Sainty avatar Tom Williams avatar  avatar  avatar  avatar

aws-es-credentials's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.