DEV Community

Cover image for ActiveMQ as event source for Lambda in Terraform
Vignesh
Vignesh

Posted on

ActiveMQ as event source for Lambda in Terraform

Finding example for ActiveMQ as event source of lambda in terraform is difficult. Here are the steps to setup quickly.

Assuming below services up and running

  1. ActiveMQ broker created with users
  2. Lambda

Step 1:

Create secret(String) in secret manager with below format.

{
    "username": "lambda-sink",
    "password": "random-string"
}
Enter fullscreen mode Exit fullscreen mode

Step 2:

Create below terraform resource

resource "aws_lambda_event_source_mapping" "lambda_sink_mapping" {

  event_source_arn = aws_mq_broker.broker.arn
  function_name    = aws_lambda_function.lambda.function_name
  batch_size       = 100
  queues = ["queue-name"]

  source_access_configuration {
    type = "BASIC_AUTH"
    uri  = aws_secretsmanager_secret.lambda_user_secret.arn
  }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Tiger Data image

🐯 🚀 Timescale is now TigerData: Building the Modern PostgreSQL for the Analytical and Agentic Era

We’ve quietly evolved from a time-series database into the modern PostgreSQL for today’s and tomorrow’s computing, built for performance, scale, and the agentic future.

So we’re changing our name: from Timescale to TigerData. Not to change who we are, but to reflect who we’ve become. TigerData is bold, fast, and built to power the next era of software.

Read more