# AWS Lambda customer-managed runtimes and the Bref v4 roadmap

<ArticleHeader
    subTitle="Bref v4 will switch from layers to customer-managed runtimes"
    date="November 20, 2026"
    author="Matthieu Napoli"
    authorGitHub="mnapoli" />

AWS just released [customer-managed runtimes](https://aws.amazon.com/blogs/compute/control-your-aws-lambda-runtimes-with-customer-managed-runtimes/) for AWS Lambda.

Until now, AWS Lambda had two kinds of runtimes: the ones AWS maintains (Node.js, Python, Java…), and "custom runtimes" via AWS Lambda layers (zip files containing PHP), where you bring everything yourself on top of a bare operating system.

[Bref](https://bref.sh/docs) is the open-source way to run Laravel, Symfony or any PHP application on AWS Lambda. And today, Bref uses AWS Lambda layers.

Customer-managed runtimes are now a third option: anyone can publish a runtime, and AWS Lambda runs it like an official one. **For PHP applications, this means a runtime maintained by Bref, delivered like the official ones.**

**Bref v4 will switch to customer-managed runtimes.** Here is what it means for PHP applications:

- faster cold starts
- PHP security patches applied **automatically** to every application, without redeploying
- more PHP extensions supported officially and provided out of the box
- runtimes built on Ubuntu (instead of Amazon Linux), a standard environment for PHP applications
- the same image on AWS Lambda and locally with Docker
- simpler and faster Bref releases

Bref v4 is planned for the end of the year.

I have had the opportunity to test customer-managed runtimes privately with the AWS Lambda service team. Over several months, I built and benchmarked dozens of runtime variants: different Linux distributions, PHP compiled by Bref or installed from packages, small and large sets of extensions, and more. That work also let me be involved in the design of the feature with the AWS Lambda team. Thank you to them for including Bref so early.

Let's dive into the details of Bref v4.

## PHP security patches without redeploying

In October, PHP released a critical security update: [php2shell, two remote code execution vulnerabilities](https://bref.sh/news/06-php-security-release-october-2026) affecting PHP-FPM. We managed to publish the new Bref layers 31 minutes after the PHP release.

But that was only half of the work. Every application then had to update Bref and redeploy to get the patched PHP version. Some applications were updated within the hour, some within the week, and some are probably still running a vulnerable PHP version today.

And it happened again this week: PHP released [another critical security update](https://www.php.net/archive/2026.php#2026-11-19-4) on November 19, and once again every application has to redeploy to get the new Bref layers.

That's how layers work, like Docker images or buildpacks: an application points to a specific layer version (e.g. `php-84:24`), and only gets a new PHP version when someone updates it and redeploys.

With customer-managed runtimes, an application points to a runtime, for example PHP 8.5, and Bref publishes new versions of that runtime. When PHP releases a security fix, Bref publishes a new runtime version (e.g. PHP 8.5.12 → 8.5.13) and **it starts rolling out immediately**: every function picks it up at its next cold start. No `composer update`, no redeploy.

That's how the AWS runtimes for Node.js or Python have always worked: AWS patches them, and your functions get the patch. PHP applications on AWS Lambda will now get the same treatment.

Automatic updates raise fair questions. Some teams will want to pin a runtime version, roll back, test a new version in staging before production, or run the Bref runtime from their own AWS account. Customer-managed runtimes make these possible, and I am exploring what Bref could offer here. If this matters to you (or if it doesn't), tell me on [Slack](https://bref.sh/slack).

## The Bref v4 roadmap

### Customer-managed runtimes instead of layers

Bref v4 runtimes will be published as customer-managed runtimes, one per PHP version, in all the regions Bref supports today.

Customer-managed runtimes are better than layers on all fronts, so they will entirely replace Bref's layers in v4. Container images will still be available for applications deployed as images (PHP is part of the application image there, so PHP updates still require a rebuild).

Dropping layers will simplify how Bref builds and publishes runtimes a lot. Today, every Bref release publishes hundreds of layer versions (every PHP version × x86 and ARM × every region). On top of that, the `bref/bref` package contains the list of layer versions for every region, so a new layer version or a new region requires a new Bref release.

With customer-managed runtimes, a release is one image per PHP version (x86 and ARM in the same image), published as a new runtime version in each region. Functions reference the runtime by name, which doesn't change between releases. That also makes supporting new regions simpler.

If layers matter to you and you see something that customer-managed runtimes don't cover, please tell me on [Slack](https://bref.sh/slack): this is the right moment.

### Ubuntu

I plan to build Bref v4 runtimes on Ubuntu 26.04 LTS instead of Amazon Linux 2023.

Performance doesn't change: I measured the same PHP build on Amazon Linux 2023, Ubuntu and Debian, there is no difference in cold starts or execution time.

But Ubuntu is a much more standard environment for PHP applications:

- it's the base image most PHP developers already know, in Docker and on servers
- system libraries are more recent (for example ICU 78 instead of 67 for `intl`, ImageMagick 7 instead of 6)
- almost every PHP extension has its dependencies available with `apt install`
- Ubuntu 26.04 is supported until 2031

That makes it much easier to compile custom extensions, or to add any tool your application needs, using the same commands as everywhere else. It also makes it easier to run Bref applications outside of AWS Lambda, for example for local development.

PHP will still be compiled by Bref, with many optimizations for AWS Lambda. Compiling PHP ourselves is also what let us ship the php2shell fixes faster than most platforms: we don't depend on anyone else's packages to publish a new PHP version.

### More extensions

Customer-managed runtimes are container images. The image size has very little effect on cold starts: AWS Lambda only loads the files that are actually read.

Bref v4 will ship many more extensions built in, installed but disabled by default. Enable them with one line in `php.ini`: most applications won't need extension layers anymore.

Extensions requested by Bref sponsors and by [Bref Pro and Enterprise](https://bref.sh/support) customers will be prioritized. Other extensions can still be added with custom AWS Lambda layers.

### One image everywhere

The same Bref v4 image will run on AWS Lambda and locally with Docker. It also opens the door to running Bref applications as regular containers, on ECS or any container platform. Let me know if this is something you would be interested in.

### PHP 8.6

Bref v4 will support PHP 8.6, which was released on November 19.

### Under research

I am also working on these, and they could make it into v4 if timing and AWS support allow:

- [SnapStart](https://docs.aws.amazon.com/lambda/latest/dg/snapstart.html): early tests show it doesn't help PHP as much as one might expect, but I am researching other approaches to drastically improve cold starts
- [response streaming](https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html) ([work in progress](https://github.com/brefphp/bref/stack/2260))
- [AWS Lambda Web Functions](https://aws.amazon.com/blogs/aws/announcing-aws-lambda-web-functions-for-fast-consistent-web-app-performance-anywhere/)

## How customer-managed runtimes work

This part is more technical, for those curious about what changes under the hood.

### Today: layers on top of a bare runtime

Bref v3 functions use the `provided.al2023` runtime: Amazon Linux 2023 with nothing in it. Bref adds PHP with layers: zip files that AWS Lambda extracts into `/opt` when it starts a new environment.

Layers are versioned and immutable. A function references a layer version by its ARN, which is why updating PHP requires a redeploy.

### With customer-managed runtimes: images, versions and aliases

A customer-managed runtime is built from a container image: the operating system, PHP, the extensions and the Bref bootstrap. Your code is still deployed the usual way, it is not part of the image.

A runtime has:

- **versions**: each version is an immutable container image
- **aliases**: names that point to a version

A function references a runtime and an alias. When Bref moves the alias to a new version, functions switch to that version at their next cold start.

Bref takes care of that configuration: `serverless.yml` stays the same as in Bref v3.

### Benchmarks

To isolate the effect of the delivery mechanism, I took the official Bref v3 layer for PHP 8.5 and shipped it as a customer-managed runtime, without changing a single binary. Only the delivery changes. And then I compared a Bref v4 prototype to the Bref v3 layer.

<Image className="mt-6 rounded-lg shadow-md border" src={coldStarts} alt="PHP-FPM cold start: 279 ms with a layer vs 197 ms with a customer-managed runtime for the same PHP build, and 240 ms for Bref v3 vs 183 ms for the Bref v4 prototype" />

**With the exact same PHP binaries, the cold start is 29% faster as a customer-managed runtime** (279 ms → 197 ms). Why? AWS Lambda no longer has to download and extract the layer zip in each new environment, the image is cached by AWS Lambda directly and loaded lazily when the files it contains are accessed.

On a Laravel application, the Bref v4 prototype starts around 100 ms faster than Bref v3. It also uses less memory: 59 MB instead of 72 MB for PHP-FPM.

How these numbers were measured:

- ARM64, 1024 MB of memory, `eu-west-1`
- 30 cold starts per variant, interleaved, median total duration (init + first request)
- each comparison was measured in a single run

## What's next

Bref v3 keeps working as usual: nothing changes for existing applications. When Bref v4 is released, the upgrade guide will explain how to switch.

New to Bref? [Get started here](https://bref.sh/docs/setup): start with Bref v3 today, the upgrade to v4 will be documented.

Thank you to the companies that [sponsor and support Bref](https://bref.sh/support): this research took months, and it is possible thanks to them.
