Skip to content

tomorrow-one/kafkajs-msk-iam-authentication-mechanism

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kafka MSK IAM integration

Installation

const { Kafka, AuthenticationMechanisms } = require('kafkajs')
const { Mechanism, Type } = require('kafka-msk-iam-demo')
AuthenticationMechanisms[Type] = () => Mechanism

const kafka = new Kafka({
  brokers: process.env.BROKERS.split(','),
  clientId: 'consumer',
  ssl: true,
  sasl: {
    mechanism: Type,
    region: process.env.REGION
  }
})

async function run () {
  const admin = kafka.admin()
  await admin.connect()
  const topics = await admin.listTopics()
  console.log('Topics: ', topics)
  await admin.disconnect()
}

run()
  .then(() => process.exit(0))
  .catch((err) => {
    console.error('Error: ', err)
    process.exit(1)
  })

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%