Deploying Langfuse on AWS with the Terraform module

The official langfuse-terraform-aws module stands up self-hosted Langfuse in your AWS account. This page covers what it provisions, how to reuse existing VPCs and databases, and what your team owns afterward.

On this page

Deploying Langfuse on AWS with the Terraform module: when it fits

A platform or security team that must keep LLM traces inside its own AWS account, and wants the deployment described in code that can be reviewed, versioned and rebuilt, is the reader this route is written for. The official langfuse-terraform-aws module is a Terraform route to production Langfuse on AWS. Langfuse documents Terraform-based AWS deployments as a production option, while Docker Compose on a single VM is documented for testing only and carries no high availability.

A self-hosted Langfuse deployment runs two application containers, Langfuse Web (UI and APIs) and Langfuse Worker (asynchronous event processing), alongside PostgreSQL, ClickHouse, Redis or Valkey, and S3-compatible blob storage. The module is meant to stand up that full set in your account, so the question is less whether you need each component and more whether you want AWS-managed or self-run versions of them, and whether your organization already runs VPCs, databases or buckets that the stack should reuse. Those choices shape the fit more than anything else.

Confirm three things before choosing this route: that your team can own a Terraform codebase after the first apply, that your landing zone rules allow the networking and managed services the module creates, and that you have reviewed the module's current variables and the Langfuse version it deploys. Check the release notes of both the module and Langfuse, since the module tracks the platform and the platform's supported versions change over time. If your organization is not on AWS, the Langfuse self-hosting guide lists the other supported deployment paths.

How the module's AWS parts connect

The diagram starts with users and instrumented applications sending requests to the load balancer, which hands them to Langfuse Web. Langfuse Worker processes asynchronous events, and both containers reach PostgreSQL, ClickHouse, Redis or Valkey and the S3 buckets inside the VPC. SES handles outbound email, and the customer's identity provider handles SSO. Check that every store and the email path sit inside the boundary you approve, and confirm which of these components the module creates and which it reuses.

Request, worker and data store paths inside the customer's AWS account.

Which deployment path fits your AWS estate

In a greenfield account, you hand the module an empty or near-empty AWS account and let it provision the surrounding infrastructure. This is the path with the least integration work, and it suits teams that have no existing VPC, database or cache intended for Langfuse. The trade-off is that the module's network and data layout become your baseline, which you must review against your own network standards before production use.

  • Network: The module creates the VPC, subnets and routing that the Langfuse services run in.
  • Data stores: It provisions the managed PostgreSQL, Redis or Valkey, ClickHouse and S3 resources that Langfuse needs.
  • Identity and DNS: It creates the IAM roles and the load balancer and certificate setup your chosen domain requires.
  • You supply: The AWS account, a domain and the inputs your own standards require, such as tagging and encryption choices.
  • Main trade-off: Fastest to stand up, but the default network and naming may not match your landing zone, so plan a review.

Confirm the exact provisioned resources and input variables in the module repository before you commit to this path.

Configuration choices in the module and when each fits

This table compares the main choices the langfuse-terraform-aws module leaves open, from network and database placement to storage, email and domain setup. Read each row against your existing AWS landing zone and the sizing minimums in Langfuse's scaling guide, then confirm the items in the last column with your platform team before you write the variables.

DecisionWhen it fitsTrade-offWhat to confirm
New VPCNo existing landing zone network, or a dedicated account for LangfuseThe module builds network layers you must review against your routing, DNS and egress standardsCIDR ranges, subnet layout, NAT and egress paths, and who owns route tables
Existing VPCYour organization already runs shared networking, peering or a managed transit layerYour subnets, security groups and routing constrain the module, and changes need coordination with the network ownerAvailable private subnets in at least two availability zones, free IP space, and allowed traffic between components
New PostgreSQLNo approved database service exists for Langfuse and you want the module to manage the instanceYou take on backup, patching and failover policy decisions for a database Langfuse depends on for transactional dataMinimum of 2 CPU and 4 GiB for PostgreSQL, PostgreSQL 15 or later for v4, backup retention and restore testing
Existing PostgreSQLYour database team already operates a managed instance with backup, monitoring and access controlsConnection limits, parameter groups and maintenance windows are set by another team and can affect Langfuse upgradesEngine version, connection limits, network path from the Langfuse subnets, and a dedicated database and user for Langfuse
Redis or Valkey inside the moduleYou want the cache and queue layer provisioned with the rest of the stackAnother component to monitor, and the module's defaults must be checked against the noeviction and version requirementsMinimum of 1 CPU and 1.5 GiB, Redis 7.0 or later, and that the eviction policy is noeviction
Existing Redis or ValkeyA shared cache service already meets Langfuse's version and eviction requirementsA shared cluster can compete for memory with other applications, and eviction settings are outside your Langfuse change controlVersion, TLS settings, cluster or single-node mode, eviction policy, and capacity headroom
ClickHouse hosted by the moduleA single-team deployment where you want the analytical store provisioned with the stackSizing and upgrades for ClickHouse stay with your team, and the minimum of 2 CPU and 8 GiB is a floor, not a production targetMemory of at least 16 GiB for larger deployments, disk headroom for growth, and backup and restore procedure
Separately managed ClickHouseYour data platform team already runs ClickHouse with replication, backup and monitoringIntegration work is needed to connect Langfuse to an external cluster, and ownership of upgrades must be written downClickHouse 25.12 or later for v4 (26.4 recommended), network access from Langfuse tasks, and credentials scoped to Langfuse
Create a new S3 bucketLangfuse should own its event, media and export buckets with dedicated lifecycle rulesThe module manages bucket policy and encryption choices that your security team may want to reviewBucket encryption settings, public access block, lifecycle rules, and the IAM role Langfuse tasks will use
Reuse an existing S3 bucketYour organization centralizes storage with approved encryption, logging and retention controlsShared buckets need prefix separation and careful IAM scoping so Langfuse does not affect other dataBucket name and region, prefix layout, IAM permissions for Langfuse, and versioning or replication settings
SES sender identityYour account already sends mail through SES with verified domainsSending limits and sandbox status belong to the account, and a verified identity must exist before invitations workVerified sender domain or address, production access status, and the sender address your users will see
SMTP for emailYour mail provider or relay is outside AWS or SES is not approved for this accountYou manage relay credentials and connection settings, and test delivery from the private networkSMTP host, port, TLS mode, credential storage, and whether the Langfuse subnets can reach the relay
Custom domain with TLSUsers reach Langfuse at a company domain, and certificates come from AWS Certificate Manager or your certificate processCertificate and DNS records must be in place before first login, and renewals need an ownerDomain name, hosted zone ownership, certificate region requirements, and the NEXTAUTH_URL value Langfuse will use
Default AWS domainShort-lived evaluation in a non-production accountNot suited to user-facing production access or SSO redirect URIs that your identity provider will checkWhether the endpoint is reachable only from approved networks and whether it will be replaced before go-live

Setup sequence for the Terraform module on AWS

This sequence takes you from version selection to a verified Langfuse on AWS that has SSO, transactional email and a working OTLP trace path. Each step closes with a check, so the platform owner can sign off before the next step starts.

  1. Confirm the Langfuse and data store versions

    The platform owner picks the Langfuse release to deploy and records it alongside the matching ClickHouse, PostgreSQL and Redis or Valkey versions. For v4, the v3 to v4 upgrade guide requires ClickHouse 25.12 or later (26.4 recommended), PostgreSQL 15 or later and Redis 7.0 or later. The GitHub releases page lists v4.63.0 as the latest release, so confirm which version your module pins and whether it provisions these data stores or expects you to supply them. Done when a signed version matrix exists and matches what the module will create or reuse.

  2. Prepare AWS accounts and the state backend

    The platform team confirms the target AWS account and region, creates a deployment role limited to the permissions the module needs, and sets up remote Terraform state with locking and encryption. If DeployOpen runs the deployment, the role is scoped to that engagement and removed at handover. Done when a test plan runs from the deployment role and writes its state to the remote backend, with no state files left on laptops or build agents.

  3. Decide network, database reuse and domain

    Inventory the existing VPC, subnets, egress paths, PostgreSQL, ClickHouse, Redis or Valkey and S3 buckets. For each component, decide whether the module provisions it or your team supplies it. Reuse requires confirming versions, network reachability from the subnets Langfuse will run in, and how credentials are stored. Choose the public hostname, request a TLS certificate for it, and confirm with the module documentation which region the certificate must be in. Done when a decision record lists each component with its owner, and the certificate is issued.

  4. Review the Terraform plan

    The engineer runs the plan against the saved variables and writes the output to a plan file. Reviewers check every planned create, change and destroy, with attention to public exposure of databases and buckets, security group rules, IAM policies and any change that would replace a stateful resource. Done when the reviewed plan file is saved, the destroy list is empty or each entry is explained, and the security owner has approved the plan in writing.

  5. Apply the approved plan

    The team applies the plan file reviewed in the previous step, so the change matches what was approved. Record the module outputs, including load balancer and database endpoints, and confirm where generated credentials are stored and who can read them. Done when apply finishes without errors, the outputs are recorded in the runbook, and generated secrets sit in your secrets store instead of shared documents.

  6. Verify health and first sign-in

    Check the health endpoint through the public URL and confirm that the web and worker containers are running on the compute platform the module provisions. Sign in with the initial admin account, create an organization and a project, and confirm that the UI and API both respond. Done when the health check passes from outside the network and the admin can open the new project.

  7. Configure SSO and transactional email

    Configure the identity provider in Langfuse using a supported Auth.js provider or generic OIDC, following the authentication and SSO guide. Then test with a non-admin user. Decide whether password sign-in stays enabled or SSO is enforced for your email domains. For email, verify the SES sender identity, confirm which credentials the instance uses to call SES, and send an invitation to a test address. Done when a test user signs in through SSO and the invitation arrives.

  8. Send a test trace through OTLP

    Point a test application, or a framework that emits OpenTelemetry, at the OTLP endpoint at /api/public/otel on your Langfuse URL, using a project API key from the new project. The OpenTelemetry guide covers the exporter setup. Send a trace with a known name and a few nested spans, then find it in the project's trace view. Done when the trace appears with the expected name and structure, and the team records the endpoint and the key owner in the runbook.

How S3 and SES configuration works in the module

The module's job for storage is to give Langfuse access to the buckets it needs, not to hide them. Langfuse writes to three kinds of storage: event data, media uploads and exports. Before you run a plan, confirm with your platform team how many buckets your account will use for these, whether each one gets its own bucket and lifecycle rules, and who owns the bucket policies. Check the module's current input variables for bucket names and region, since the exact names change between module releases and this page does not pin them. The credential chain is the part to get right: Langfuse containers pick up AWS credentials through the default AWS credential chain, so access comes from the IAM role attached to the workload rather than from access keys stored in configuration. Review that role for least privilege, scoped to the specific buckets, and confirm that no long-lived keys end up in variable files or state.

Transactional email covers invitations, password resets and export notifications. With SES, the first decision is the sender identity. Verify the domain or address in the SES region you deploy into, and confirm the sender address Langfuse will use matches what you verified. New SES accounts usually start in the sandbox, which limits sending to verified recipients and caps volume, so confirm your account's sending status with AWS before you promise users that invitations will arrive. Request production access early if you need it, because the review is outside your deployment timeline. Email also needs the same credential path as storage, so the task role must allow the SES send action in that region.

Testing delivery is where private subnets cause surprises. Workers in private subnets reach SES through a NAT gateway or an SES VPC interface endpoint, so the network path must exist before the first invitation is tested. Send a test invitation to a verified mailbox from a container inside the VPC, then check the SES sending statistics and the bounce and complaint notifications. For deeper configuration of object storage and SMTP or SES settings, read the sibling topics on blob storage and transactional email, which cover bucket layouts, path-style access and connection URLs in detail.

Security and identity controls to review before go-live

The Terraform module creates the cloud resources, but the security posture of the stack depends on choices made around it: who can change the infrastructure, what can reach the web endpoint, how secrets are held and how people sign in. Work through these six areas with your security team before any user or trace data arrives.

IAM roles and least privilege

The module creates AWS roles and policies that the deployment and running services use. Ask your platform team to read every role and policy the apply creates, and check whether they can be narrowed to the buckets, database and secrets the stack needs. Confirm which identities can run terraform apply and who can assume the roles that reach S3, SES and the databases. Record the review so you can show who holds standing access.

Network exposure of the web endpoint

Decide whether the Langfuse UI and API are reachable from the public internet, from corporate networks only or through a private load balancer with a VPN or identity-aware proxy in front. Check the security group rules, the subnet placement of the web and worker services and whether the ClickHouse and PostgreSQL endpoints are reachable from anywhere other than the application tier. Confirm TLS termination and certificate ownership before users sign in.

Encryption and secrets handling

Confirm that the databases, ClickHouse volumes and the S3 buckets use encryption at rest with keys your organization controls, and that traffic between the services is encrypted where your policy requires it. Check where the database passwords, the Langfuse encryption key and the NextAuth secret are stored, who can read them and how they rotate. Trace data often contains personal data, so treat the stored secrets as the entry point to all of it.

SSO by provider

Self-hosted Langfuse supports SSO through Auth.js providers including Google, GitHub, Azure AD or Entra ID, Okta, Auth0, Keycloak, OneLogin, JumpCloud, Authentik, AWS Cognito and generic OIDC. Choose the provider your workforce already uses, register the callback URL against your public hostname and test a sign-in with an account from a group you did not expect. Confirm how the provider's group membership maps to Langfuse roles.

Langfuse SSO docs

Disabling passwords and enforcing SSO

Once SSO works, you can disable password sign-in and enforce SSO for specific email domains, so that a local account cannot bypass your identity provider. Test the lockout path first, including the account that administers the instance, and keep a documented break-glass procedure that does not depend on a single person. Confirm which domains are enforced before inviting users.

Enterprise features and their license keys

Audit logs, SCIM provisioning, project-level RBAC, data retention policies and server-side masking need an Enterprise license key on self-hosted Langfuse. Decide whether your controls require these features before go-live, because the license decision shapes the design. Ask the vendor for the current terms, and check the license key handling in your secrets process.

License key docs

Who owns the stack after the module is applied

After the module is applied, your team owns the running Langfuse stack, and the first thing to settle is the Terraform state. The state file records every VPC, database, bucket, IAM role and container service the module created, so it should live in a remote backend with locking and access limited to the people who are allowed to change production. Decide who runs terraform plan and terraform apply, how module version pins are updated, and whether any console changes will be reverted or imported. Ask your partner, if you use one, which of these responsibilities they will hold in their own environment and which they will hand over in writing.

Upgrades split into two kinds. Langfuse states that updates within a major version are non-disruptive and apply database migrations automatically at startup, so a minor or patch bump is mostly a module or image version change plus a check of the health endpoints and logs. Major upgrades are different: the v3 to v4 guide requires ClickHouse 25.12 or later, PostgreSQL 15 or later and Redis 7.0 or later, moves to an observations-first ClickHouse data model and advises about 3x ClickHouse disk headroom when backfilling. Those steps have their own migration guide and need a rehearsal in a non-production account. The Helm-specific step of upgrading the bundled chart from v1 to v2 does not apply to this module, which provisions managed services instead.

Backups and capacity stay with your team. Confirm the retention and point-in-time recovery settings on the PostgreSQL instance and the backup plan for ClickHouse data, and test a restore rather than assuming one exists. For load, the scaling guide recommends adding worker containers as CPU load rises, and under heavy ingestion splitting langfuse-web into separate ingestion and user interface deployments. Monitoring is also yours: alarms on web and worker CPU, database and ClickHouse resource use, and Redis availability should exist before users depend on tracing. Scope these items explicitly in any statement of work, because a partner may retain on-call, patching or upgrade execution while your team keeps approvals, state access and the data.

Questions teams ask before deploying Langfuse on AWS with Terraform

What does it cost to run Langfuse on AWS with Terraform?

The Langfuse software is free under the MIT license, so your spend is the AWS infrastructure and the services around it. Your AWS bill grows with the instance sizes for the web, worker, PostgreSQL, Redis or Valkey and ClickHouse components, the managed database and cache services you choose, the storage holding trace data and blobs, and the volume of data you ingest. Langfuse's scaling guide lists minimums of 2 CPU and 4 GiB each for web, worker and PostgreSQL, 1 CPU and 1.5 GiB for Redis or Valkey, and 2 CPU and 8 GiB for ClickHouse, with at least 16 GiB of ClickHouse memory for larger deployments. These are starting floors, so production sizing usually lands higher. Ask for a quote that lists each AWS resource, its size, what scales with load, and which costs recur monthly. Estimate the AWS side with the AWS pricing calculator in your region. Implementation is a one-time professional services cost, and an Enterprise license key is a separate subscription.

How long does a Langfuse deployment on AWS take?

The duration depends on how much of the foundation already exists and how fast the external dependencies respond. A deployment into an empty account takes longer than one that reuses a VPC, a database and a verified mail domain. The main variables are whether the network and IAM design is approved, how quickly DNS records and TLS certificates are issued, whether your identity provider is ready for SSO, how long SES sender verification takes, and how much ClickHouse sizing and load testing you want before go-live. If you are moving existing trace history, the migration path adds its own work. We do not give a duration without a defined scope. Ask for a timeline in the written scope with each milestone, the client decisions it depends on, and the approvals it needs. A fixed-scope agreement sets the schedule before work starts, so compare quotes on that written plan, not on a headline number.

What does our team need to provide for the AWS deployment?

The deployment needs access and decisions from your side before any infrastructure is created. You need one or more AWS accounts with an agreed region and permissions to create networking, compute, databases, storage and IAM resources. You need either an existing VPC with suitable subnets or approval to create one. You need a DNS zone for the Langfuse hostname, a TLS certificate process, and an identity provider for SSO, such as Google, GitHub, Entra ID, Okta, Keycloak, AWS Cognito or a generic OIDC provider. For transactional email, you need SES access, a verified sender domain and production sending approval if your account is still in the SES sandbox. You also need a decision on whether an Enterprise license key is required, and named owners for the security review, the backup policy and the on-call rota. Missing items usually show up as delays, so list them in the scope before the work starts.

Can our own team deploy Langfuse on AWS without a partner?

Yes, a capable platform team can do it alone, since Langfuse documents Terraform-based deployments on AWS for production. The team needs working knowledge of Terraform, AWS networking and IAM, container platforms, PostgreSQL, ClickHouse and object storage. The harder part is usually the work after the first apply: upgrades that change the data model, backup and restore testing, scaling workers under load, monitoring the platform itself and keeping the module current. Decide which of those your team will own for the next several years, and who covers them during an incident. A partner can take the build, the hardening and the documentation under a fixed-scope agreement, or provide an ongoing retainer for support and upgrades. Either way, compare the cost of your team's time against a written quote. DeployOpen does not publish prices, and a quote follows from the agreed scope.

Is the MIT license enough to deploy Langfuse this way?

For the core product, yes. Langfuse's repository is MIT Expat licensed, except for content under the ee/, web/src/ee/ and worker/src/ee/ directories, which falls under a separate enterprise license. Langfuse states that all core features and APIs are available in the MIT-licensed open source version without limits, and that self-hosted deployments run the same codebase as Langfuse Cloud. Read the LICENSE file in the repository and confirm which directories your build includes, since the enterprise paths carry different terms. The MIT license covers the software, not your hosting costs or the work to run it. Keep a record of the exact version you deploy, and check the license again before any change that brings in enterprise code. Your legal team should confirm how the license applies to your internal use and any customer-facing use.

Do we need an Enterprise license key for an AWS deployment?

No, a self-hosted deployment does not need an Enterprise license key to run the core features and APIs. The key is required for specific governance features, including project-level RBAC roles, protected prompt labels, data retention policies, audit logs, server-side data masking, UI customization, organization creators, the org management API with SCIM, and the instance management API. Langfuse's pricing page lists a free open source plan and a custom-priced Self-Hosted Enterprise plan that adds a named support engineer, solutions architect access and a support SLA. If your compliance review needs any of the governance features, add the key to the scope and budget from the start. Ask Langfuse for a quote for the plan you need, and ask what the key covers during upgrades and across environments. Keep the key cost separate from the infrastructure and services quote.

Which parts of the AWS stack need care after launch?

Day-two ownership covers upgrades, backups, scaling, monitoring and access changes. Within a major version, Langfuse says updates are non-disruptive and apply database migrations automatically at startup. Major upgrades follow dedicated guides and change infrastructure. The v3 to v4 guide requires ClickHouse 25.12 or later, with 26.4 recommended, PostgreSQL 15 or later and Redis 7.0 or later, and advises about 3x ClickHouse disk headroom when backfilling historic data. Langfuse recommends scaling worker containers on CPU load and, under heavy ingestion, splitting langfuse-web into separate ingestion and user interface deployments. Your team owns the Terraform state, the AWS account security settings, database backups and restore tests, and alerting on the platform. Write these owners into the handover document. Review the upgrade guide before choosing a target version, since the migration path is the largest single change to plan.

Can we reuse our existing VPC and databases with the module?

Reuse is often possible, but confirm each input against the module's documentation before you commit to a design. The module can be used to create a new network and services, and reuse decisions depend on the variables it exposes for existing resources in your account. Any existing PostgreSQL instance must meet the v4 requirement of PostgreSQL 15 or later, and any existing Redis or Valkey service must be Redis 7.0 or later. ClickHouse also needs to match the version range for your target release. Check the subnet layout, route tables, security groups, the IAM roles the workloads need, and whether the database has enough connection capacity for the web and worker containers. Document each reused resource and its owner. If an existing database shares other applications, plan a separate schema or instance so Langfuse upgrades cannot affect those workloads.

Where the official Langfuse documentation fits in your review

Treat the official Langfuse documentation as the source of truth for every setting this module ends up configuring. The module is a starting point, and its defaults can lag behind the product. Before you approve the stack, check each container, data store and environment variable against the Langfuse self-hosting documentation, which describes the two application containers, Langfuse Web and Langfuse Worker, and the PostgreSQL, ClickHouse, Redis or Valkey and S3-compatible storage they depend on. Confirm that your reviewers can trace each provisioned resource back to a documented requirement.

Use the Langfuse scaling guide to test the sizing the module chose against the minimum resources the project lists for web, worker, PostgreSQL, Redis or Valkey and ClickHouse. The guide also explains when to scale workers on CPU load and when to split ingestion from the user interface. Record the instance types, node counts and memory values in your review, and ask the module owner which of them you are expected to change for your ingestion volume.

Check licensing and feature scope against the Langfuse license key documentation before you rely on any feature that is gated behind an Enterprise key, such as audit logs, data retention policies or SCIM provisioning. Then read the Langfuse upgrade guide and the version-specific migration guide for the release you plan to run. Major upgrades change infrastructure requirements, so confirm in writing who owns the upgrade plan, the database migration rehearsal and the ClickHouse disk headroom before the first production deployment.

How DeployOpen scopes and delivers a Langfuse deployment on AWS

DeployOpen plans and delivers the AWS deployment of self-hosted Langfuse inside your own account, starting from a written scope. We adapt the official langfuse-terraform-aws module to your VPCs, databases, S3 and SES setup, then document and hand over the stack so your team can run it.

How we scope

  • We confirm whether the module creates new networking or reuses your existing VPCs, subnets and database services.
  • We agree in writing which Langfuse version, data stores, S3 buckets and SES sender identities are in scope.
  • We record who owns each AWS account, state backend, secret and DNS record before any change is made.

How we build

  • We run the Terraform plan in a non-production account first and review every resource it would create or change.
  • We configure PostgreSQL, ClickHouse, Redis or Valkey, S3 and SES settings against the sizing and version requirements in the Langfuse documentation.
  • We test sign-in, trace ingestion, blob uploads and transactional email before the stack is accepted.

How we hand over

  • We deliver the Terraform code, variable files and a runbook covering upgrades, backups and secret rotation.
  • We document which resources the module owns, which were reused, and what your team must change for day-two work.
  • We walk your platform and security teams through restore tests and the steps for a Langfuse version upgrade.

How we support

  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades and continuous testing are available as a retainer, scoped separately from the build.
  • Any change to the module, such as a custom base path or a new data store, is quoted from a written change scope.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.