Pulumi Integrates Bun as a Fully Supported Runtime, Ushering in a New Era of Infrastructure as Code Development

Pulumi has officially announced the full integration of Bun as a supported runtime for its Infrastructure as Code (IaC) platform, a significant evolution from its previous role as an optional package manager. This landmark development, detailed in Pulumi’s latest release, version 3.227.0, empowers developers to configure their infrastructure programs to be executed entirely by Bun by simply setting runtime: bun within their Pulumi.yaml file. This advancement liberates developers from the requirement of having a Node.js installation, streamlining workflows and potentially accelerating deployment times.
The journey of Bun, spearheaded by its creator Jarred Sumner, began with a compelling proposition: a JavaScript runtime engineered for speed, built upon Apple’s JavaScriptCore engine rather than the V8 engine that powers Node.js and Deno. Initially previewed in May 2021 and formally launched as version 1.0 in September 2023, Bun has rapidly expanded its capabilities. It distinguishes itself by consolidating essential developer tools – a package manager, a bundler, and a test runner – into a single, efficient binary. This unification, achieved through development in the Zig programming language, offers a cohesive and performant developer experience.
A pivotal moment in Bun’s trajectory arrived with its acquisition by Anthropic, a leading artificial intelligence company. Anthropic, which already leverages Bun for deploying its sophisticated Claude Code model, affirmed its commitment to the open-source nature of Bun, stating it will remain under the MIT license and continue its development for the broader JavaScript and TypeScript developer community. This acquisition signifies substantial institutional backing and injects further momentum into Bun’s evolution. Performance metrics consistently highlight Bun’s advantages, with reported startup times four times faster than Node.js (ranging from 5-15ms compared to 60-120ms) and package installation speeds that outpace Node.js by a factor of six to thirty-five. These impressive figures are crucial for developers aiming to optimize their CI/CD pipelines and reduce overall project bootstrap times.
The integration of Bun as a first-class runtime within Pulumi was a highly anticipated feature, frequently appearing on Pulumi’s GitHub issue tracker since Bun’s 1.0 release. Several key attributes of Bun make it particularly appealing to Pulumi users. Foremost among these is its native TypeScript execution capability. Unlike traditional Node.js workflows that necessitate ts-node or a separate compilation step, Bun directly executes TypeScript files, eliminating a common point of friction and simplifying the development process for Pulumi programs written in TypeScript.
Secondly, Bun’s accelerated dependency installation directly benefits Pulumi users by significantly reducing the time it takes to set up and run infrastructure code, especially within automated build and deployment environments. This speed advantage is critical for maintaining agile development cycles and ensuring rapid iteration on infrastructure projects.
Thirdly, Bun’s commitment to achieving 100% Node.js compatibility is a cornerstone of its adoption strategy. This ensures that the vast ecosystem of npm packages already utilized within Pulumi projects can seamlessly transition to the Bun runtime without requiring extensive code modifications or compatibility layers. Developers can confidently expect their existing dependencies to function as intended, minimizing the risk and effort associated with migration.
Streamlined Infrastructure Program Execution with Bun
When developers opt for the runtime: bun configuration in their Pulumi.yaml file, Pulumi leverages Bun for both the execution of the infrastructure program itself and the management of its dependencies. This unified approach obviates the need to separately configure a package manager, further simplifying the developer experience. To facilitate the creation of new projects with Bun as the runtime, Pulumi has introduced a dedicated project template, accessible via the command pulumi new bun.
Enhanced Asynchronous Code Handling
A notable ergonomic improvement introduced by Bun’s integration is its enhanced handling of asynchronous code, particularly within the context of Pulumi programs. In previous CommonJS-based Pulumi programs, scenarios involving awaiting data source results before declaring resources necessitated wrapping the entire program within an asynchronous entrypoint function. With Bun’s robust support for ECMAScript Modules (ESM), developers can now utilize top-level await directly at the module level. This eliminates the need for wrapper functions, significantly simplifying program structure and improving code readability. This change aligns Pulumi’s TypeScript workflows with modern JavaScript best practices.
Migration Path for Existing Node.js Projects
Teams managing existing Pulumi projects based on Node.js can transition to the Bun runtime with a well-defined migration path. The primary step involves updating the runtime field in the Pulumi.yaml file to bun. Additionally, developers will need to adjust their tsconfig.json configuration to align with Bun’s recommended compiler options, including setting module: "Preserve" and moduleResolution: "bundler". To fully embrace ESM and benefit from Bun’s features, it is also recommended to add "type": "module" to the project’s package.json file. This sequence of adjustments ensures a smooth transition and allows teams to immediately capitalize on Bun’s performance and developer experience benefits.
Understanding Current Limitations
Despite the extensive capabilities and significant advantages offered by Bun’s integration, the current release does acknowledge two primary limitations. Pulumi’s callback functions, often referred to as "magic lambdas," are not yet supported under the Bun runtime. This is due to their reliance on function serialization mechanisms that are intrinsically tied to Node.js’s v8 and inspector modules, which are not yet fully implemented or compatible within Bun. Similarly, dynamic providers face the same limitation for analogous technical reasons.
For teams that critically depend on either of these features, the recommendation is to continue utilizing the runtime: nodejs configuration. However, it is important to note that even when using the Node.js runtime, developers can still benefit from Bun’s superior package management capabilities by configuring packagemanager: bun within their Pulumi project settings. This offers a hybrid approach, allowing for incremental adoption of Bun’s advantages while maintaining compatibility for specific functionalities.
Technical Prerequisites for Adoption
To leverage the new Bun runtime support within Pulumi, developers will need to ensure they have Bun version 1.3 or later installed on their systems. Concurrently, the Pulumi CLI must be updated to version 3.227.0 or a subsequent release. These version requirements guarantee access to the latest features and bug fixes necessary for seamless integration.
Broader Implications for Infrastructure as Code
The integration of Bun as a fully supported runtime by Pulumi represents a significant step forward in the evolution of Infrastructure as Code tooling. By embracing a faster, more integrated runtime, Pulumi is empowering developers to build and manage their cloud infrastructure with greater efficiency and speed. This move could potentially democratize IaC further by lowering the barrier to entry for new projects and accelerating the development cycles of established teams.
The emphasis on native TypeScript support and top-level await directly addresses common developer pain points, making the process of defining and deploying infrastructure more intuitive and less prone to errors. As Bun continues to mature and its compatibility with Node.js ecosystem grows, its adoption within platforms like Pulumi is likely to become a standard expectation for high-performance IaC development. This trend suggests a future where the speed and developer experience of the underlying runtime become as critical to infrastructure tooling as the core IaC capabilities themselves. The strategic acquisition by Anthropic also signals a strong future for Bun, suggesting continued innovation and support that will benefit a wide range of development workflows, including the critical domain of cloud infrastructure management.
About the Author
Claudio Masolo







