Pulumi now supports Bun as a complete runtime environment, not just a package manager, enabling faster TypeScript execution and improved CI/CD performance for infrastructure as code workflows.
Pulumi has announced full runtime support for Bun, the increasingly popular JavaScript runtime, marking a significant expansion beyond its previous role as merely a package manager option within the infrastructure as code platform. The integration, delivered through Pulumi 3.227.0, allows developers to specify runtime: bun in their Pulumi.yaml configuration and execute entire infrastructure programs using Bun without requiring Node.js installation.
Bun's journey from a performance-focused alternative to Node.js to a comprehensive JavaScript ecosystem has been remarkable. Created by Jarred Sumner and first previewed in May 2021, Bun reached version 1.0 in September 2023. The runtime differentiates itself through its architecture built with the Zig programming language and powered by JavaScriptCore, Apple's WebKit engine, rather than the V8 engine used by Node.js and Deno. This architectural choice contributes to its performance advantages, with Bun delivering 4x faster startup times (5–15ms versus 60–120ms) and 6–35x faster package installs compared to Node.js.
The acquisition by Anthropic in 2024 provided significant institutional backing while maintaining Bun's open-source MIT license status. Anthropic already uses Bun for deploying Claude Code, demonstrating confidence in the runtime's production capabilities.
Three capabilities make Bun particularly attractive for Pulumi users. First, native TypeScript execution allows Bun to run TypeScript files directly without requiring ts-node or a separate compile step, eliminating historical friction in Pulumi TypeScript workflows. Second, faster dependency installation accelerates the bootstrapping of infrastructure programs in CI/CD pipelines, a critical consideration for teams practicing infrastructure as code at scale. Third, Bun aims for 100% Node.js compatibility, meaning the npm packages already used with Pulumi should work out of the box without modification.
When runtime: bun is configured, Pulumi uses Bun for both running programs and managing packages, removing the need to configure a separate package manager option. A new project template is available via pulumi new bun, simplifying the onboarding process for teams adopting this runtime.
One notable ergonomic improvement concerns async code patterns. In CommonJS Pulumi programs, awaiting a data source before declaring resources required wrapping the program in an async entrypoint function. With Bun's full ESM support, top-level await works at the module level without any wrapper, simplifying program structure considerably and making code more readable.
Teams with existing Node.js-based Pulumi projects can migrate by updating the runtime field in Pulumi.yaml, adjusting tsconfig.json to use Bun's recommended compiler options, including module: "Preserve" and moduleResolution: "bundler", and adding "type": "module" to package.json to opt into ESM.
The release does carry two notable limitations. Pulumi's callback functions, sometimes called magic lambdas, are not supported under the Bun runtime because they rely on function serialization that depends on Node.js v8 and inspector modules not fully available in Bun. Dynamic providers are similarly unsupported for the same reason. Teams that rely on either of these features should remain on runtime: nodejs, though they can still benefit from Bun's faster package management by setting packagemanager: bun in their Node.js runtime configuration.
Bun runtime support requires Bun 1.3 or later and Pulumi 3.227.0 or later. The integration was among the most requested features in Pulumi's GitHub issue tracker since Bun's 1.0 release, reflecting strong community demand for this capability.
This development represents a broader trend in the infrastructure as code ecosystem toward embracing modern JavaScript runtimes that offer performance advantages and improved developer experience. As organizations increasingly adopt TypeScript for infrastructure definition and seek to optimize their CI/CD pipelines, the ability to leverage Bun's performance characteristics within Pulumi workflows provides a compelling option for teams looking to modernize their infrastructure development practices.

For teams considering migration, the decision ultimately depends on their specific use cases and whether they rely on the unsupported callback functions or dynamic providers. However, for many Pulumi users, the combination of faster startup times, improved TypeScript support, and accelerated dependency management makes Bun an attractive runtime choice that could meaningfully improve their infrastructure development workflow.


Comments
Please log in or register to join the discussion