Socket
Socket
Sign inDemoInstall

@acuris/aws-es-connection

Package Overview
Dependencies
14
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @acuris/aws-es-connection

AWS ElasticSearch connection for the @elastic/elasticsearch ES client


Version published
Weekly downloads
11K
increased by0.62%
Maintainers
3
Install size
29.7 kB
Created
Weekly downloads
 

Readme

Source

AWS ES Connection

AWS ES connection for the new elasticsearch client (@elastic/elasticsearch)

Usage

Javascript:

const { Client } = require('@elastic/elasticsearch')
const { createAWSConnection, awsGetCredentials } = require('@acuris/aws-es-connection')

const awsCredentials = await awsGetCredentials()
const AWSConnection = createAWSConnection(awsCredentials)
const client = new Client({
  ...AWSConnection,
  node: 'https://node-name.eu-west-1.es.amazonaws.com'
})

// inside async func
await client.cat.help()

Typescript:

import { createAWSConnection, awsGetCredentials } from '@acuris/aws-es-connection'
import AWS from 'aws-sdk'
import { Client } from '@elastic/elasticsearch'

const awsCredentials = await awsGetCredentials()
const AWSConnection = createAWSConnection(awsCredentials)
const client = new Client({
  ...AWSConnection,
  node: 'https://node-name.eu-west-1.es.amazonaws.com'
})

// inside async func
await client.cat.help()

How does it work?

This package creates a Connection class that signs the requests to AWS elasticsearch and a Transport class that checks that the AWS credentials haven't expired before every call, and refreshes them when needed.

Developer notes

Running the tests.

Make sure that your AWS credentials are available to your env, for example you could set them in your ENV.

You need a running AWS ES instance for the tests to run against. Set the endpoint URL as the env AWS_ES_ENDPOINT.

AWS_ES_ENDPOINT=https://xxxx.es.amazonaws.com npm test

Tested versions

This package has been tested on versions of the official elasticsearch client up to 7.13.0.

Keywords

FAQs

Last updated on 06 Aug 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc