Setting up and Configuring Lambda Queries on AWS

Running queries on AWS Lambda can result in lower costs and better performance, here's how to set up and configure a lambda function to run queries using an Application Load Balancer and update the Helm Chart deployment to use this load balancer.

The Lambda container images can only be deployed from Elastic Container Registry in your AWS Account and therefore the image has to be copied first.

Note: Lambda Query Functions installation only applies to Axiom Self-Host installs. If you are using Axiom Cloud, you already benefit from scalable query functions!


Copy the Docker image

  1. Pull the Axiom lambda function image from Docker hub

docker pull axiomhq/axiom-lambda-func:latest

  1. Tag the Axiom lambda image in your Private ECR registry on AWS

docker tag axiomhq/axiom-lambda-func:latest <private_ecr>/axiom-lambda-func:latest

  1. Push the image to your private registry

docker push <private_ecr>/axiom-lambda-func:latest

Create Lambda Function

  1. Create a Lambda function from the image pushed.
  • In your AWS console, click on Lambda and select Create function from Container image
Lambda overview
  • In your Lambda function configuration, select Environment variables, click Edit and add an environment variable with key AXIOM_STORAGE and value s3://your S3 bucket name
Lambda overview

Create and Attach Lambda Role

  • Create and attach this Lambda policy to your Lambda role.
Lambda overview
"Version": "2012-10-17",
"Statement": [
"Sid": "VisualEditor2",
"Effect": "Allow",
"Action": [
"Resource": [

Where: bucket-name is the name of your S3 bucket.

Edit function configuration

  1. You need to bump the the memory configuration of your lambda function in AWS Console, click on Configuration, select General Configuration and click Edit
Lambda overview
  • Change Memory Size to a minimum of 1024MB, but we recommend size 1536MB

  • Change Timeout to 30 seconds.

Lambda overview

Create a Target group

  1. Create a target group on AWS and associate it to the Lambda function you created in step 4. The target group will tell the load balancer were to direct traffic to. The traffic will be routed to your Lambda function.
Target group overview

Create an Application Load Balancer

  1. Create an Application Load Balancer for the target group you created in step 6, select the internal load balancer route under the scheme section. The application load balancer will trigger the lambda function.
Load balancer
  • Associate your loadbalancer to it in the listeners and routing section.
Load balancer
  1. Copy the DNS name of your load balancer and paste it as lambdaUrl in your Helm chart values.
  • Back in your Lmbda function console, you can see the Application Load balancer has been attached as a trigger.