Bun
Overview
Bun is the fast all-in-one JavaScript runtime, bundler, transpiler, test runner and package manager. It is a drop-in Node.js alternative built for speed. From a single binary, it runs JavaScript and TypeScript directly, installs npm dependencies, bundles your code and runs your tests.
The SecureAnyCloud image installs Bun 1.3.14 system-wide as the bun command for every user. It also includes a worked example project: a small Bun.serve HTTP server, a dependency and a test suite. As a result, bun install, bun test and bun run all work out of the box. This is a command-line product with no web UI.
What you get:
- A system-wide Bun. Bun 1.3.14 is installed at
/usr/local/bin/bun, on PATH for every user. - A worked example project at
/opt/bun/example, with an HTTP server, a dependency and a test file. - A writable copy per user. Every login user gets a copy at
~/bun-example. - A login banner pointing at the example and the user guide.
- An Ubuntu 24.04 LTS base with the latest security patches at build time.
- 24/7 SecureAnyCloud support
Prerequisites
Before you deploy this image, make sure you have an active Azure subscription, an SSH key pair, and a VNet and subnet in the target region.
Standard_B2s (2 vCPU / 4 GiB RAM) is plenty for a Bun development box or CI runner. In the NSG, allow inbound 22/tcp from your management network. The bundled example needs no inbound ports beyond SSH. If you serve an app from Bun and want it reachable externally, open that port in your NSG.
Step 1 - Deploy from the Azure Marketplace
Sign in to the Azure Portal, choose Create a resource, search the Marketplace for Bun by SecureAnyCloud, and select Create.
On Basics, pick your subscription, resource group, region and size. Under Administrator account, choose SSH public key and paste your key. Under Inbound port rules, allow SSH (22). Then choose Review + create, then Create.
Step 2 - Deploy from the Azure CLI
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:bun-ubuntu-24-04:default:latest
az vm create \
--resource-group <your-rg> \
--name bun \
--image sac1647283583153:bun-ubuntu-24-04:default:latest \
--size Standard_B2s \
--admin-username azureuser \
--ssh-key-values ~/.ssh/id_ed25519.pub \
--vnet-name <your-vnet> --subnet <your-subnet> \
--public-ip-sku StandardStep 3 - Connect to your VM
ssh azureuser@<vm-public-ip>Step 4 - Confirm Bun is installed
bun --versionIt reports 1.3.14. Run bun --help to see the full command list, including run, test, install, add, build, x and more.
Step 5 - Get your writable copy of the example
Every login user gets their own writable copy of the worked example. bun install writes a node_modules directory and a lockfile, so the project must be user-writable. Run this command to copy the read-only reference from /opt/bun/example:
[ -d ~/bun-example ] || cp -r /opt/bun/example ~/bun-example cd ~/bun-example && ls -laThe example ships with a package.json (declaring one dependency, left-pad), a server.ts (a small Bun.serve HTTP server) and a server.test.ts test file.
Step 6 - Install dependencies
bun install installs the project's dependencies into node_modules and writes a lockfile. Notice how fast it is compared with npm install:
cd ~/bun-example && bun installBun reports 1 package installed in tens of milliseconds.
Step 7 - Run the tests
bun test is Bun's built-in test runner, so there is no separate test framework to install. It runs the *.test.ts files in the project:
cd ~/bun-example && bun testBoth tests pass with 2 pass / 0 fail.
Step 8 - Run the server and curl it
bun run server.ts starts the bundled Bun.serve HTTP server on port 3000. This block starts it in the background, waits for it to come up, curls two endpoints, then stops it, so the command returns cleanly:
cd ~/bun-example setsid bun run server.ts >/tmp/bun-server.log 2>&1 </dev/null & for i in $(seq 1 20); do curl -fsS "http://localhost:3000/health" >/dev/null 2>&1 && break; sleep 0.5; done curl -s "http://localhost:3000/?name=ada" curl -s "http://localhost:3000/health" pkill -f "bun run server.ts" || trueThe first curl prints Hello, ada! Served by Bun. (the name padded via the left-pad dependency). The health endpoint prints ok.
Step 9 - Run a script directly
Bun runs TypeScript and JavaScript files directly, with no transpile step. Create and run a one-liner:
cd ~/bun-example echo 'console.log("Bun runs TS directly:", 2 ** 10);' > hello.ts bun run hello.tsIt prints Bun runs TS directly: 1024.
Step 10 - Use Bun as your package manager and bundler
Bun is a drop-in replacement for npm, yarn and pnpm, and a fast bundler:
cd ~/bun-example bun add zod
# add a dependency (writes package.json + lockfile) bun build server.ts --target=bun --outfile=dist.js && ls -la dist.jsbun add resolves and installs in milliseconds, and bun build produces a single bundled output file. Use bunx <pkg> to execute a package binary without installing it globally.
Step 11 - Start a new project
Scaffold your own Bun project anywhere on the VM:
mkdir ~/my-app && cd ~/my-app bun init -y bun run index.tsbun init creates a package.json, a tsconfig.json, an entry file and a .gitignore, giving you a ready-to-develop Bun project.
Maintenance
- Reference template. The read-only example lives at
/opt/bun/example, and your writable copy is~/bun-example. - Binary location. Bun is installed at
/usr/local/bin/bunand is on PATH for every user. - Upgrades. Upgrade Bun in place with
sudo bun upgrade, or pin a version withsudo bun upgrade --to <version>. - Global installs.
bun add -g <pkg>installs into~/.bun, which is set byBUN_INSTALL. Add~/.bun/binto your PATH to run global binaries. - Security patches. unattended-upgrades stays enabled, so the OS continues to receive security updates automatically.
Support
SecureAnyCloud provides 24/7 expert support for this image. Contact sales@secureanycloud.com.
Bun is a trademark of Oven, Inc. SecureAnyCloud is not affiliated with or endorsed by Oven, Inc. This image repackages the open source Bun runtime (MIT licensed) for convenient deployment on Azure.
Deploy on Azure
Launch Bun on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.
View this image
Need help?
Our support team is available 24/7.
sales@secureanycloud.com
Overview
This image runs Bun, the fast all-in-one JavaScript and TypeScript toolkit. It is a single native binary that works as a runtime, a bundler, a transpiler, a test runner and an npm-compatible package manager. Bun runs JavaScript and TypeScript files directly, installs packages quickly, bundles for production and runs your tests, all from one command.
The image is a ready-to-use development and runtime workstation. Connect over SSH and start running, building and testing projects with the bun command line immediately, with no setup.
This is a headless command-line image. There is no web interface, no service to log into and no credentials. Run the bun CLI against your own projects, or use Bun.serve to run your own application server. The bun binary is installed at /opt/bun/bin/bun and symlinked onto the system path at /usr/local/bin/bun and /usr/local/bin/bunx. It was verified against the official Bun release checksum at build time.
The Bun global install root and package install cache sit on a dedicated, independently resizable EBS data volume mounted at /var/lib/bun. The login profile exports BUN_INSTALL=/var/lib/bun and BUN_INSTALL_CACHE_DIR=/var/lib/bun/install/cache for every login shell. Packages downloaded by bun install are downloaded once, shared across all your projects, and kept on durable storage rather than the operating system disk.
A self-contained offline demo project ships read-only at /opt/bun/demo. Use it to exercise the toolkit end to end, with no third-party dependencies, the moment you log in.
Prerequisites
Before you deploy this image, make sure you have:
- An Amazon Web Services account where you can launch EC2 instances
- IAM permissions to launch instances, create security groups, and subscribe to AWS Marketplace products
- An EC2 key pair in the target Region for SSH access to the instance
- A VPC and subnet in the target Region, with a security group allowing inbound port 22 from your management network
- The AWS CLI (version 2) installed locally if you plan to deploy from the command line
Launch the instance from the AWS Marketplace
Sign in to the AWS Management Console, open the EC2 service, and select Launch instance. Under Application and OS Images, choose AWS Marketplace AMIs and search for Bun. Select the SecureAnyCloud listing and choose Select, then Continue on the subscription summary.
Pick an instance type of t3.small or larger. Choose your EC2 key pair under Key pair (login). Under Network settings, select your VPC and subnet. Then create or select a security group that opens port 22 from your management network. Leave the root volume at the default size or larger.
Select Launch instance. First boot initialisation takes a few seconds after the instance state becomes Running and the status checks pass.
Launch the instance from the AWS CLI
The following block launches an instance from the SecureAnyCloud Bun Marketplace AMI into an existing subnet and security group. Replace <ami-id> with the AMI ID shown on the Marketplace listing. Replace <key-name> with your EC2 key pair name and <subnet-id> with your subnet ID. Replace <security-group-id> with a security group that opens port 22 from your management network.
aws ec2 run-instances \
--image-id <ami-id> \
--instance-type t3.small \
--key-name <key-name> \
--subnet-id <subnet-id> \
--security-group-ids <security-group-id> \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=bun}]'When the instance reaches the Running state and its status checks pass, note its public IP address or DNS name. Find it in the EC2 console or with aws ec2 describe-instances.
Connect to your instance
Connect over SSH using your key pair. On Ubuntu 24.04, the login user is ubuntu.
ssh -i <key-name>.pem ubuntu@<public-ip>A welcome banner prints the most useful commands. Run sudo cat /root/bun-info.txt to see the full getting-started notes. They cover what is installed, the global install cache path on the data disk, and the location of the offline demo project.
Verify the install
Print the Bun version to confirm the toolchain is installed and on the system path. The version is pinned to Bun 1.3.14 on this image:
bun --versionYou should see 1.3.14 reported. The same bun command exposes the full all-in-one workflow. Run bun --help to list the subcommands. The most important are run, install, build and test. Next, confirm that the binary and its bunx companion both resolve from the system path:
command -v bun bunxBoth resolve under /usr/local/bin. The binary itself lives at /opt/bun/bin/bun, and the image links it onto the system path so it resolves from any login shell.
Run the demo project
A self-contained offline demo project ships read-only at /opt/bun/demo. It uses only Bun's built-in APIs: the Bun.serve HTTP server and the bundled bun:test runner. As a result, bun install, bun test and bun run all work offline, with no third-party dependencies and no cloud credentials. The project pairs a tiny HTTP server with a test, so you can confirm the toolkit works end to end before pointing it at your own code.
Copy the demo somewhere writable and install its dependencies. The demo ships no third-party dependencies, so bun install resolves an empty tree quickly and populates the shared install cache on the data disk:
cp -r /opt/bun/demo ~/bun-demo cd ~/bun-demo bun installbun install prints its version banner and completes in milliseconds. Now run the bundled test suite with Bun's built-in, Jest-compatible test runner:
cd ~/bun-demo bun testbun test discovers server.test.ts, runs the three cases, and ends with 3 pass and 0 fail. This confirms that the runtime, the TypeScript support and the test runner all work.
To exercise the runtime as an application server, start the demo HTTP server with Bun.serve and confirm it answers over the loopback interface. The following block starts the server in the background and waits for it to bind. It then queries the root and health endpoints and stops the server:
cd ~/bun-demo PORT=3000 bun run server.ts & BUN_DEMO_PID=$! sleep 2 curl -s http://127.0.0.1:3000/ curl -s http://127.0.0.1:3000/health kill "$BUN_DEMO_PID"The root endpoint returns a Hello from Bun greeting. The health endpoint returns {"status":"ok","runtime":"bun","version":"1.3.14"}. Together they show that the runtime serves HTTP correctly with only Bun's built-in Bun.serve API.
Use your own projects
To work on your own code, copy or clone your JavaScript or TypeScript project onto the instance and run the same workflow. bun install reads the package.json and lockfiles your team already uses and installs into the shared cache. bun run <script> and bun run <file> execute your scripts and TypeScript files directly, with no separate transpiler step. bun build bundles for production, and bun test runs your test suite.
Bun is npm-compatible, so existing projects work without changes. bunx runs package binaries on demand, the way npx does.
The package install cache lives on the dedicated data volume at /var/lib/bun/install/cache and is exported as BUN_INSTALL_CACHE_DIR for every login shell. Because the cache is shared, the first bun install in any project downloads each package once, and every later project reuses the cached copy. Repeated installs are fast, and the packages stay on durable, resizable storage rather than the operating system disk. Confirm the cache environment is exported in your login shell:
echo "$BUN_INSTALL_CACHE_DIR"That prints /var/lib/bun/install/cache. To run Bun as a long-lived application server, write a systemd unit that runs bun run against your entry point. Alternatively, package your app into a container that copies in the bun binary.
The data volume
The Bun global install root and package install cache live on a dedicated EBS volume mounted at /var/lib/bun. This keeps downloaded packages off the operating system disk and lets you resize or snapshot the volume independently. Confirm the mount with:
df -h /var/lib/bunTo grow the volume, expand the EBS volume in the AWS console. Then grow the filesystem on the instance with sudo resize2fs on the underlying device. The install cache directory is group-writable by the ubuntu login user, so packages downloaded by any project are shared across the whole instance.
Support
SecureAnyCloud publishes and supports this image. Support covers project setup, dependency and lockfile management, bundling and build configuration, the test runner, running Bun as an application server, container packaging, CI integration and upgrade planning. Contact SecureAnyCloud through the support channel listed on the AWS Marketplace listing.
All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
Deploy on AWS
Launch Bun on AWS with 24/7 support from SecureAnyCloud.
View on Marketplace
Need help?
Our support team is available 24/7.
sales@secureanycloud.com