Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Open source

Search with AWS Lambda

This document explains how to set up AWS Lambda for serverless backend search. Read improve search performance for more guidance on configuration options for backend search.

  1. Build the code package:

    cd ./cmd/tempo-serverless && make build-lambda-zip

    This will create a ZIP file containing the binary required for the function. The file name will be of the form: ./lambda/tempo-<branch name>-<commit hash>.zip. Here is an example of that name:

    ls lambda/*.zip
  2. Provision an S3 bucket.

  3. Copy the ZIP file into your bucket.

    aws s3 cp lambda/ gs://<newly provisioned gcs bucket>
  4. Provision the Lambda. For a Lambda function to be invoked via HTTP, we also need to create an ALB and some other resources. This example uses Terraform and only includes the function definition. Additionally, you will need a VPC, security groups, IAM roles, an ALB, target groups, etc., but that is beyond the scope of this guide.

    locals {
      // this can be increased if you would like to use multiple functions
      count = 1
    resource "aws_lambda_function" "lambda" {
        count = local.count
        function_name    = "${}-${count.index}"
        description      = "${}-${count.index}"
        role             = <arn of appropriate role>
        handler          = "main"
        runtime          = "go1.x"
        timeout          = "60"
        s3_key           = ""
        s3_bucket        = <S3 bucket created above>
        memory_size      = 1769 # 1 vcpu
        vpc_config {
            subnet_ids         = <appropriate subnets>
            security_group_ids = [<appropriate security groups>]
        environment {
            variables = {
            "TEMPO_S3_BUCKET"               = "<S3 bucket name backing your Tempo instance>"
            "TEMPO_BACKEND"                 = "s3"
            "TEMPO_S3_HEDGE_REQUESTS_AT"    = "400ms"
            "TEMPO_S3_HEDGE_REQUESTS_UP_TO" = "2"
            "TEMPO_S3_ENDPOINT"             = ""
  5. Add the hostname of the newly-created ALB to the querier config:

        - http://<alb dns hostname>