Deploying Langfuse on Google Cloud with Terraform for production control
For a platform team that needs LLM tracing inside its own Google Cloud project, the official Terraform module on GKE is the production path. Langfuse documents Kubernetes deployments with Helm or Terraform on AWS, Azure and GCP for production, and Docker Compose on a single VM is documented for testing only, without high availability. Self-hosted Langfuse runs two application containers, Langfuse Web (the UI and APIs) and Langfuse Worker (asynchronous event processing), alongside PostgreSQL, ClickHouse, Redis or Valkey, and S3-compatible blob storage. On Google Cloud, those stores map to services in your project that you own, size and back up, which is why the module suits teams that must answer for every data path.
Choose a single VM when the goal is a short evaluation with no uptime expectations, and choose the Langfuse Cloud service when your data residency, security review and operating model allow a vendor-hosted tenant. The Terraform path fits when trace data, prompts and evaluation records must stay in a project you control, or when your organization already runs GKE and wants Langfuse managed the same way as other workloads. Before you start, confirm with your platform and security teams which data stores may live in which regions, who holds the Terraform state and service account keys, and whether your organization's Google Cloud landing zone already provides the VPC, DNS and logging you intend to reuse. These decisions shape the module inputs more than any other choice.
Use the module as a starting point, not as a finished landing zone. Check the current module README and the self-hosting documentation for the minimum resources the components need, because the scaling guide sets 2 CPU and 4 GiB 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. Confirm that your chosen Langfuse version supports the database versions you plan to run, since the v4 upgrade guide requires PostgreSQL 15 or later and Redis 7.0 or later. Plan ownership early: someone must review each Terraform plan, own upgrades between major versions, and keep the stack patched after the initial build.
How Langfuse components map onto Google Cloud services
The diagram starts at users and SDK clients outside the project and enters through a public HTTPS load balancer into the project's VPC. Inside, Langfuse Web and Langfuse Worker run on GKE, and both connect to Cloud SQL for PostgreSQL, ClickHouse, Redis or Valkey, and Cloud Storage buckets over private addresses. The trust boundary is the project's VPC: only the load balancer is public-facing. Check which components the module provisions and which you supply, and confirm where ClickHouse and Redis or Valkey run in your chosen design, since those choices change the boundary.
Public edge at the load balancer, with Langfuse components and data stores inside the client's project.
Which Google Cloud layout fits your landing zone
This table compares four ways to place Langfuse in an existing Google Cloud estate, from a dedicated project to reuse of existing networking, databases, clusters and ClickHouse. Read each row for when the option fits and what your team will own afterward. The main takeaway is that the more existing shared infrastructure you reuse, the more of the module's defaults you must reconcile with your own controls.
| Layout | When it fits | What you own afterward |
|---|---|---|
| New dedicated project, module as-is | No shared network or cluster is required for Langfuse, and the team wants a self-contained stack to review | The full stack, including GKE, Cloud SQL, Cloud Storage and networking, sits in one project your team patches and monitors |
| Reuse existing VPC and private service access | Your landing zone already has a hub network, firewall policy and private service connections to Google-managed services | Subnet ranges, routes and firewall rules must not overlap with shared networks, and you own changes to peering and DNS |
| Bring existing Cloud SQL instance | A central PostgreSQL platform already meets Langfuse's PostgreSQL version and connection needs | Backups, maintenance windows, instance sizing and database users are shared with other teams and need agreed change control |
| Bring existing GKE cluster | Your platform team already runs a hardened cluster with admission policies, logging and ingress standards | Namespace quotas, node pools, workload identity and upgrades of the cluster must accommodate Langfuse Web and Worker |
| ClickHouse in-cluster | You accept running an analytical store on your cluster and have storage, backup and upgrade skills in the platform team | Replication, disk headroom, backups and version upgrades become your operational work, sized against your ingestion volume |
| ClickHouse managed or operator-run | You want replication and upgrades handled by a defined operator or service that your team can support | Operator licensing or service fees, if any, plus the skills to run the operator; confirm terms and support scope before choosing |
Setup sequence for the GCP Terraform deployment
This sequence takes a Google Cloud project from license and version decisions to a verified Langfuse instance that accepts a test trace over OTLP. Each step ends with a check so the platform team can confirm the previous step held before moving on.
Confirm license and version targets
The platform owner confirms which Langfuse edition and version the deployment will run, and whether any Enterprise features are needed. Enterprise features such as project-level RBAC, audit logs and data retention policies require a license key, while the MIT-licensed core runs without one. Check the release you plan to deploy against the GitHub releases page and the v3 to v4 upgrade guide. Version 4 requires ClickHouse 25.12 or later (26.4 recommended), PostgreSQL 15 or later and Redis 7.0 or later, so confirm those versions are available on the Google Cloud services you intend to use. Done when the target version and its minimum data store versions are written down and signed off.
Plan the network and IAM
The network and security team decides the VPC layout, subnets for GKE pods and services, private service access for Cloud SQL, and which service accounts Langfuse workloads will use to reach Cloud Storage. Decide whether the module creates a new VPC or attaches to an existing landing zone network, and who approves firewall and DNS changes. Record the CIDR ranges, the project and region, and the role bindings for the Terraform runner. Done when the network diagram and IAM design have been reviewed against your landing zone policies and no range overlaps an existing peering or VPN route.
Configure module inputs and remote state
The engineer who owns the infrastructure code sets the module inputs for project, region, network references, database sizing, bucket names and the domain for ingress. Store Terraform state in a remote backend, such as a Cloud Storage bucket with versioning and restricted access, and keep secrets such as database passwords and the Langfuse salt and encryption key out of plain variable files. Run a plan and review every resource it will create, especially IAM bindings and public exposure. Done when the plan completes with no unexpected deletions, the state lock works for a second operator, and the secrets are sourced from a secret store.
Apply the Terraform configuration
An authorized operator runs the apply from the reviewed plan, ideally through the same pipeline the team will use for later changes. The apply provisions the GKE cluster, Cloud SQL for PostgreSQL, the Cloud Storage buckets and the supporting network and identity resources, and then the Kubernetes workloads that run Langfuse Web, Langfuse Worker, ClickHouse and Redis or Valkey, depending on how the module is configured. Capture the apply output and the state version. Done when the apply finishes without errors and the outputs list the cluster, database endpoint and bucket names that the next steps will check.
Verify GKE workloads and Cloud SQL connectivity
The operator checks that the Langfuse pods are running and ready, and that the web and worker containers can reach PostgreSQL on Cloud SQL through the private address. Review pod logs for migration messages, since database migrations run automatically at startup, and confirm the web container starts without connection errors. Confirm that the Cloud SQL instance accepts connections only from the expected private network. Done when all pods report ready, the migrations complete in the logs, and a connection test from inside the cluster succeeds.
Verify bucket access and ingress
The operator confirms that the Langfuse workloads can write to and read from the Cloud Storage buckets for events, media and exports, using the service account bindings from the plan. Then check ingress: the load balancer or ingress resource should have the intended hostname, a valid TLS certificate, and access limited to the network paths your policy allows. Load the Langfuse login page through that hostname from an approved location. Done when a test object round trips through the bucket, the TLS certificate validates, and the UI loads only from the intended path.
Send a test trace over OTLP
The engineer creates a project and API keys in the new instance, then sends a small OpenTelemetry trace to the /api/public/otel endpoint from a machine inside the approved network, using an OTLP exporter from a sample application or the OpenTelemetry SDK. Open the trace in the Langfuse UI and confirm its name, timing and attributes match what was sent. If the trace does not appear, check the worker logs and the ingress rules before retrying. Done when the test trace is visible in the project, which confirms ingestion, the worker path and the storage path work end to end.
How private networking and landing zones shape the module
Private networking decides most of what the module can do unchanged in your project. The module's default posture (a GKE cluster, a Cloud SQL instance and Cloud Storage buckets wired together for Langfuse Web and Langfuse Worker) only works cleanly if the cluster nodes can reach Cloud SQL over private IP, if the pods can reach the storage endpoints, and if the firewall and organization policies allow the traffic those paths need. In a shared VPC, the subnet ranges for nodes, pods and services usually belong to a host project owned by the networking team, so the first decision is whether the module creates networking or consumes subnets you already have. Confirm with the networking team which subnet and secondary ranges are assigned, whether private Google access is enabled on them, and which DNS zones resolve Google APIs and any private Cloud SQL addresses.
Organization policies and firewall rules are where deployments most often stall. Confirm whether policies restrict external IP addresses on nodes, require private clusters, limit which service accounts can be created or bound to workloads, or force customer-managed encryption keys on storage and databases. Check that egress rules allow the Langfuse pods to reach any model providers or identity provider you have configured, and that health checks and ingress from your load balancer or proxy are permitted. Keep the module's Workload Identity wiring and private Cloud SQL connection logic unless policy forces a change, and change the network inputs, naming, labels and firewall resources to match your landing zone. Record every deviation from the upstream module so that upgrades can be reviewed as a diff against your fork or wrapper.
Before running terraform apply, get written answers on five points: the host project and subnet IDs, the secondary range names used for pods and services, the DNS zones and their owners, the org policy constraints that apply to the target folder, and the change process for firewall rules. Run a plan against a non-production project in the same folder structure first, because policy violations often appear only at apply time. Ask the networking team to review the plan output for new routes, peerings, firewall rules and private service connections, since those changes outlive the Langfuse deployment and affect other workloads on the same network.
Security controls to plan on Google Cloud
A Langfuse deployment on Google Cloud holds prompts, traces and user data that often include personal information, so identity, secrets, keys and logging need decisions before the first apply. The cards below cover the controls to design in the Terraform code and the platform settings to confirm once Langfuse is running.
Scope service account roles tightly
Each workload, including GKE nodes, the Langfuse pods and any job that manages Cloud SQL or Cloud Storage, should run as its own service account with only the roles it needs. Avoid broad project-level editor or owner roles on the deployment identity. Review the bindings the module creates against your landing zone policy, and confirm which identities can read the event and export buckets.
Keep secrets out of state and code
Database passwords, the NextAuth secret, salts and encryption keys should be held in Secret Manager or your approved vault rather than written into tfvars files or committed to version control. Check whether the Terraform state bucket is encrypted, access-controlled and versioned, because state can contain generated credentials. Confirm who can read secret versions and how rotation will be performed.
Decide on customer-managed encryption keys
Google Cloud encrypts data at rest by default, but regulated teams often need customer-managed encryption keys in Cloud KMS for Cloud SQL, Cloud Storage and GKE disks. Decide who owns key rotation, key destruction and access logging before provisioning, because changing keys later can require data movement. Ask the module maintainers and your security team which resources accept customer-managed keys in your configuration.
Set up SSO through an Auth.js provider
Self-hosted Langfuse supports SSO through Auth.js providers, including Google and Microsoft Entra ID, and can disable password sign-in or enforce SSO for specific email domains. Plan the OAuth client, redirect URL and the domains that must sign in through SSO before the instance is shared with users. Confirm which administrator account remains available if the identity provider is unavailable.
Authentication and SSO docsEnable audit logs and cloud logging
Langfuse audit logs are an Enterprise license feature, so teams without a key need another record of administrative actions. Route GKE, Cloud SQL and Cloud Storage audit logs to a locked log bucket with a retention period set by your compliance team. Confirm who can view and export these logs, and test that a sample administrative change appears in the destination.
Tie masking and RBAC to the license
Project-level RBAC roles, data retention policies and server-side data masking need an Enterprise license key in self-hosted Langfuse. If your design depends on them, record that dependency in the scope and the buyer's quote. Without a key, document compensating controls such as restricting who can send traces and limiting which projects hold sensitive data.
License key docsQuestions teams ask before deploying Langfuse on Google Cloud
What drives the cost of deploying Langfuse on Google Cloud?
The cost is driven mostly by the labor to design and build the landing zone integration, plus the Google Cloud resources the stack runs on. The main cost components are the GKE cluster, Cloud SQL for PostgreSQL, the ClickHouse data store, Memorystore or another Redis-compatible cache, Cloud Storage buckets, load balancing and logging. Effort rises when the network design, IAM model and sizing need review by your security team. Ask any quote to separate one-time build work from recurring cloud spend and from any ongoing support retainer. The sizing guidance from Langfuse lists minimum resources for web, worker, PostgreSQL, Redis or Valkey and ClickHouse, so ask the vendor to show how those minimums map to the machine types and storage it proposes. Use the Langfuse scaling guide as the baseline for that review.
Can our in-house platform team deploy Langfuse on Google Cloud alone?
Yes, a team with working knowledge of Kubernetes, Terraform, Cloud SQL and Google Cloud networking can do it, and the official Terraform module gives them a documented starting point. The harder part is operating the result: ClickHouse, PostgreSQL backups, Redis availability, certificate renewal and version upgrades all become your responsibility. Assess the team against those day-two tasks, not only the first deployment. A partner is most useful when the team lacks one of these skills, needs a second pair of hands on the landing zone fit, or wants the build and handover documented for auditors. Whichever path you choose, the team needs to own the Terraform state and the data stores from day one.
How long does a Langfuse deployment on Google Cloud take?
The duration depends mainly on how much of the landing zone already exists and how many controls must be reviewed. A greenfield project with a standard network, a clear IAM model and no custom identity work is the shortest path. Timelines grow when you need to reuse an existing VPC, align with organization policies, add private service connectivity for Cloud SQL, integrate SSO with your identity provider, or produce evidence for a compliance review. Ask for a written timeline tied to a fixed scope, and confirm which items are blocked on your teams, such as DNS delegation, certificate issuance and project approvals. Duration figures from any source should be checked against your own environment before you plan around them.
What must we provide before the deployment starts?
Before work begins, you should prepare several inputs that the build cannot invent:
- A Google Cloud project, or an agreed project structure, with billing linked and organization policies documented
- IAM roles for the deploying identity and a clear owner for Terraform state and service accounts
- A DNS zone for the Langfuse hostname and the ability to create records
- A certificate approach, either managed certificates or certificates from your internal authority
- The SSO provider details, redirect URIs and the email domains that must be forced onto SSO
- An SMTP or email path for invitations and password resets
- Network ranges that do not overlap with existing subnets
Confirm each item in writing so that gaps surface during scoping rather than during the build.
Do we need an Enterprise license key for Langfuse on Google Cloud?
No, a self-hosted deployment runs the core features and APIs under the MIT-licensed open source version without limits, and Langfuse states that self-hosted deployments use the same codebase as Langfuse Cloud. An Enterprise license key is needed only for specific features, including project-level RBAC roles, protected prompt labels, data retention policies, audit logs, server-side data masking, UI customization, organization creators, and the SCIM and instance management APIs. Decide which of these your governance team requires before the build, because they influence configuration and sign-off. Check the license terms in the repository, since code under the ee/ directories falls under a separate enterprise license.
How are Langfuse upgrades handled on a Google Cloud deployment?
Updates within a major version are non-disruptive, and Langfuse applies database migrations automatically at startup. Major upgrades, such as v3 to v4, change infrastructure and data models, so they need a planned migration with the dedicated guide. The v3 to v4 guide requires ClickHouse 25.12 or later, PostgreSQL 15 or later and Redis 7.0 or later, and it advises roughly 3x ClickHouse disk headroom when backfilling historic data. Terraform-managed stacks also need the module version pinned and tested against the new Langfuse release. Ask whoever runs the build how Terraform changes, database snapshots and rollback steps will be handled in each upgrade, and whether that work is covered by a retainer.
Can the Terraform module fit into our existing Google Cloud landing zone?
It can, but the module assumes a set of resources and naming choices that you must reconcile with your landing zone. Review which parts it creates, such as the network, GKE cluster, Cloud SQL instance and storage buckets, and which parts you can supply from existing infrastructure. Check how it handles service accounts, workload identity, private IP for Cloud SQL, firewall rules and label standards. Adapting the module usually means forking or wrapping it, which creates an ongoing maintenance cost that should be stated in the scope. Confirm this review with the engineers who will own the code after handover.
What a Google Cloud deployment of Langfuse involves for your team
The core split is simple to state and easy to get wrong: your team owns the Google Cloud project, the Terraform state and every decision about what runs in it after go-live, while a partner can take on the design, the build and the handover. Whoever runs the Terraform state owns the stack. The state file records which GKE cluster, Cloud SQL instance, Cloud Storage buckets and networking resources exist and how they relate. Before any work starts, decide where that state lives, who can read and write it, how it is locked, and which identity runs terraform apply in each environment. Those answers determine whether an in-house team or a partner is the right owner for the first year, not the initial build alone.
Upgrades are the ongoing cost that organizations most often underestimate. Langfuse applies database migrations automatically at startup for updates within a major version, but major upgrades change infrastructure and data models and follow dedicated migration guides, so they need a planned window, a tested rollback path and someone accountable for the ClickHouse and PostgreSQL versions the release requires. If you use a community Terraform module or a fork, you also own its maintenance when the upstream changes. Ask any partner to state in writing which upgrades, Terraform module updates and state migrations are included in the fixed scope and which are offered as a retainer.
When you compare in-house deployment with an implementation partner, the questions to answer are concrete: how many engineers can own Terraform, Kubernetes and Cloud SQL operations after handover, who is on call when ingestion stops, and whether landing zone policies such as organization constraints, shared VPCs and logging sinks will be enforced by your platform team or reviewed by a partner. Confirm these with your own cloud governance team and in the written scope before deciding, because they shape the handover document, the access model and the retest plan that a partner should deliver.
How DeployOpen scopes and delivers Langfuse on Google Cloud
DeployOpen plans, builds, tests and hands over self-hosted Langfuse inside your own Google Cloud projects, starting from a written scope. The work is adapted to your landing zone, networking and existing data stores, and it ends with documentation your platform team can run without us.
How we scope
- Confirm the target Google Cloud projects, regions, and whether the stack is greenfield or added to an existing landing zone.
- Agree which Langfuse edition, license key features and SSO provider are in scope before any infrastructure is written.
- Record in the written scope how Cloud SQL, Cloud Storage, GKE and networking choices map to your existing standards.
How we build
- Adapt the official Terraform module to your naming, IAM, private networking and state management conventions.
- Configure web, worker, PostgreSQL, Redis or Valkey, ClickHouse and Cloud Storage buckets with the sizing agreed in scope.
- Test ingestion, login, backups and restores in a non-production project before the production cutover.
How we hand over
- Deliver the Terraform code, variable files, runbooks and a record of every deviation from the upstream module.
- Walk your platform and security teams through access paths, secrets rotation, backup and restore steps.
- Document the upgrade path for Langfuse, its data stores and the Terraform module so ownership after handover is clear.
How we support
- Offer ongoing support, upgrades and continuous testing as a retainer if you do not want to run the stack alone.
- Plan Langfuse major upgrades, including ClickHouse and PostgreSQL version requirements, as a separate scoped piece of work.
- Scope retesting after changes to the landing zone, identity provider or Langfuse version through the same written process.

