Run Cerbos Natively Inside AWS Lambda | Cerbos

Run Cerbos natively inside AWS Lambda

Serverless architectures bring speed and agility, but authorization often remains a weak point. With this release, you can now run Cerbos PDP inside AWS Lambda - either as a standalone Lambda function or as a Lambda extension layer, and pair it with Cerbos Hub as the central control plane for policy and audit-log management.

This dual-layer model means you get a unified policy platform via Cerbos Hub, and a distributed decision engine in Lambda, giving you consistent authorization everywhere, from containers and VMs to serverless Lambdas.

Documentation.

Two flexible deployment options

Lambda function

Deploy Cerbos as its own Lambda function (cerbosfunc). Ideal when you want a central authorization service that many functions or micro-services call into.

Lambda extension (Layer)

Deploy Cerbos as an extension layer (cerbosext) that runs alongside your application function. This gives you the “sidecar style” enforcement inside the same execution environment.

Comparison: Function vs extension

If you are comparing the two deployment patterns, here’s how they differ:

In both cases, policies are authored and managed in Cerbos Hub, then distributed to each PDP (whether function or extension) via the Hub’s control plane.

Use cases for Cerbos in AWS Lambda

Event-driven microservices with dynamic access checks

When you build a serverless architecture using AWS Lambda, functions often process events (API requests, S3 uploads, DynamoDB streams). Teams we’ve spoken with often embed authorization logic inside each handler, leading to duplicated logic, inconsistent enforcement, and slow change cycles.

By deploying Cerbos in Lambda (either as a function or an extension) and using Cerbos Hub for central policy management, you can:

Multi-tenant serverless platforms

If you operate a serverless platform where each tenant runs Lambda functions, you’ll often need per-tenant policies, policy isolation, and audit-trail capability.

In this scenario:

Serverless APIs with externalized authorization

When teams build APIs via Lambda + API Gateway, often the authorization logic is tightly coupled inside each handler (“if user.role == ‘admin’ then …”). Over time, this leads to inconsistencies and error-prone code.

With Cerbos PDP + Cerbos Hub:

Hybrid serverless + containerized workloads

Many organisations operate mixed environments: some services in Kubernetes/ECS, some in Lambda. A common problem is “authorization drift” - policy enforcement logic differs between environments.

Using Cerbos:

Low-latency / edge / regional workloads

Some architectures deploy Lambdas in multiple regions or need ultra-low latency (e.g., personalization, fraud detection, IoT ingestion). In such cases:

What we hear from Cerbos users

“We’ve seen more teams adopt Lambda for edge and event-driven workloads,” said Alex Olivier, CPO of Cerbos. “Now you can bring the same policy-as-code model to those environments without external dependencies or vendor lock-in.”

Key takeaways

FAQ

How do I run Cerbos in AWS Lambda?

Does using a PDP in Lambda add latency?

Is Cerbos suitable for event-driven/background processing in Lambdas?