
The Axiom Lambda Extension is an open-source project and welcomes your contributions. For more information, see the GitHub repository.
Prerequisites
- Create an Axiom account.
- Create a dataset in Axiom where you send your data.
- Create an API token in Axiom with permissions to ingest data to the dataset you have created.
Setup
- Install the Axiom Lambda extension.
- Ensure everything works properly in Axiom.
- Turn off the permissions for Amazon CloudWatch.
Installation
To install the Axiom Lambda Extension, choose one of the following methods:Install with AWS CLI
1
Add the extension as a layer with the AWS CLI:
- Replace
AWS_REGIONwith the AWS Region to send the request to. For example,us-west-1. - Replace
ARCHwith the system architecture type. For example,arm64. - Replace
VERSIONwith the latest Lambda layer version. For example,17, which contains extension release v16. The layer version doesn’t match the release version on the GitHub Releases page because AWS assigns layer version numbers automatically.
2
Add the Axiom dataset name and API token to the list of environment variables. For more information on setting environment variables, see the AWS documentation.
Replace
API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.Replace DATASET_NAME with the name of the Axiom dataset where you send your data.Replace AXIOM_DOMAIN with the base domain of your edge deployment. For more information, see Edge deployments.Install with Terraform
Choose one of the following to install the Axiom Lambda Extension with Terraform:- Use plain Terraform code
Example with plain Terraform code
Example with plain Terraform code
Replace
AWS_REGION with the AWS Region to send the request to. For example, us-west-1.
Replace ARCH with the system architecture type. For example, arm64.
Replace VERSION with the latest Lambda layer version. For example, 17, which contains extension release v16. The layer version doesn’t match the release version on the GitHub Releases page because AWS assigns layer version numbers automatically.Replace API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.Replace DATASET_NAME with the name of the Axiom dataset where you send your data.Replace AXIOM_DOMAIN with the base domain of your edge deployment. For more information, see Edge deployments.- Use the AWS Lambda Terraform module
Example with AWS Lambda Terraform module
Example with AWS Lambda Terraform module
Replace
AWS_REGION with the AWS Region to send the request to. For example, us-west-1.
Replace ARCH with the system architecture type. For example, arm64.
Replace VERSION with the latest Lambda layer version. For example, 17, which contains extension release v16. The layer version doesn’t match the release version on the GitHub Releases page because AWS assigns layer version numbers automatically.Replace API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.Replace DATASET_NAME with the name of the Axiom dataset where you send your data.Replace AXIOM_DOMAIN with the base domain of your edge deployment. For more information, see Edge deployments.Install with AWS Lambda function UI
1
Add a new layer to your Lambda function with the following ARN (Amazon Resource Name). For more information on adding layers to your function, see the AWS documentation.
Replace
AWS_REGION with the AWS Region to send the request to. For example, us-west-1.
Replace ARCH with the system architecture type. For example, arm64.
Replace VERSION with the latest Lambda layer version. For example, 17, which contains extension release v16. The layer version doesn’t match the release version on the GitHub Releases page because AWS assigns layer version numbers automatically.2
Add the Axiom dataset name and API token to the list of environment variables. For more information on setting environment variables, see the AWS documentation.
Replace
API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.Replace DATASET_NAME with the name of the Axiom dataset where you send your data.Verify the extension version
The extension stamps its release version on every event it sends to Axiom. After you install or upgrade, check which release your functions actually run:v16. If the result shows an older release than you expect, the layer version in your function configuration points to an older build. Update the layer ARN to the latest layer version, and then redeploy your function.
Turn off Amazon CloudWatch logging
After you install the Axiom Lambda extension, the Lambda service still sends logs to CloudWatch Logs. You need to manually turn off Amazon CloudWatch logging. To turn off Amazon CloudWatch logging, deny the Lambda function access to Amazon CloudWatch by editing the permissions:- In the AWS Lambda function UI, go to Configuration > Permissions.
- In the Execution role section, click the role related to Amazon CloudWatch Logs.
- In the Permissions tab, select the role, and then click Remove.
Requirements for log level fields
The Stream and Query tabs allow you to easily detect warnings and errors in your logs by highlighting the severity of log entries in different colors. As a prerequisite, specify the log level in the data you send to Axiom. For Open Telemetry logs, specify the log level in the following fields:record.errorrecord.levelrecord.severitytype
Best practices for production workloads
The Axiom Lambda Extension runs inside your Lambda execution environment and shares its CPU, memory, and network with your function. It favors the performance of your function over guaranteed log delivery: it buffers events in memory and, when Axiom is unreachable for a sustained period, drops the oldest buffered events. The buffer only lives as long as the execution environment. For low-to-medium volume workloads that tolerate occasional loss, sending directly from the extension to Axiom works well. For high-volume, high-concurrency, or delivery-critical workloads, don’t send directly to Axiom from your functions. Decouple your functions from Axiom with a durable collector that you run on separate infrastructure. Your functions hand logs to a nearby collector and return immediately, and the collector owns buffering, batching, backpressure, and retries before forwarding to Axiom. This keeps your function durations predictable and prevents log loss when Axiom is briefly unreachable.Forward to a collector you manage (recommended)
Run a durable log pipeline such as Vector or the OpenTelemetry Collector on always-on infrastructure you manage, such as Amazon ECS or EC2. The collector forwards to Axiom: Vector through its native Axiom sink, and the OpenTelemetry Collector over OTLP, which Axiom ingests natively. The sizing and operation of the collector are up to you. Get logs from your functions to this collector in one of the following ways:- Axiom Lambda Extension. Set the
AXIOM_URLenvironment variable to your collector’s endpoint. The extension sends gzip-compressed NDJSON to the/v1/datasets/DATASET_NAME/ingestpath of that URL, so any intermediary that accepts the Axiom ingest API and forwards to Axiom works. - OpenTelemetry Lambda layer. Use the OpenTelemetry Lambda layer as a replacement for the Axiom Lambda Extension, and configure its exporter to forward to your collector. For more information, see Send OpenTelemetry data to Axiom.
Use Amazon CloudWatch as the buffer
If you prefer not to run collector infrastructure, use AWS-native tooling to decouple delivery. Keep CloudWatch logging turned on (skip the turn-off step above) and ship logs with the Axiom CloudWatch Forwarder. CloudWatch durably stores the logs, and the forwarder delivers them to Axiom fully decoupled from your functions, at the cost of CloudWatch pricing and some added latency.Troubleshooting
- Ensure the Axiom API token has permission to ingest data into the dataset.
- Check the function logs on the AWS console. The Axiom Lambda Extension logs any errors with setup or ingest.
PANIC_ON_API_ERR environment variable to true. This means that the Axiom Lambda Extension crashes if it can’t connect to Axiom.