The Simplest Way to Make Pulumi and Ubuntu Work Like They Should
Teams use pulumi and ubuntu together to build and update Linux servers with code. Pulumi sends cloud calls to boot the server and run startup scripts on the host. This pair lets developers treat server setup like normal app code. You write logic in a standard coding language, and the tool builds the Linux box. When the host starts, the operating system takes over and runs local setup steps. How pulumi and ubuntu share data and keys The workflow moves through two clear steps during a server b
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Teams use pulumi and ubuntu together to build and update Linux servers with code. Pulumi sends cloud calls to boot the server and run startup scripts on the host.
This pair lets developers treat server setup like normal app code. You write logic in a standard coding language, and the tool builds the Linux box. When the host starts, the operating system takes over and runs local setup steps.
How pulumi and ubuntu share data and keys
The workflow moves through two clear steps during a server build. First, the build tool talks to your cloud provider API using an cloud role. It asks the cloud to create a new virtual machine using an Ubuntu image.
During this step, the build tool passes startup data to the cloud API. This data includes public SSH keys, disk rules, and a boot script. The cloud provider attaches this data to the new instance metadata service.
Second, the Linux kernel boots up and starts its built-in initialization tool. This local tool reads the startup script from the instance metadata service. It creates local user accounts, writes authorized SSH keys, and installs system packages.
If the build tool needs to run more tasks after boot, it uses SSH. It reads a private key from its state secret store to log in. Then it sends files or runs shell commands on the running Linux host.
Common failure modes and how to scope roles
Many teams fail by using one shared SSH key for every server build. When a developer leaves the team, rotating that shared key breaks the build state. Others pass raw database passwords or API tokens inside plain startup scripts.
Any local user on the Linux host can read the instance metadata service. If you put plain secrets in the startup script, local apps can read them. Broad cloud roles also cause risk when the build runner has full admin rights.
Pulumi Policy as Code + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
To fix this, keep plain secrets out of your boot scripts at all times. Have the Linux host use its own machine role to fetch secrets after boot. Scope the build runner role so it can only create the needed server resources.
Lock down network paths between your build runner and the target Linux hosts. Do not open SSH ports to the public internet just so builds can finish. Run your deployment jobs inside a private network subnet with strict firewall rules.
Create separate Linux user accounts for automated build tools and human engineers. Limit the sudo rights of the build account to only the commands it needs. Log every command that the build runner executes on the host for audit checks.
Managing host updates and state drift
Once a Linux server is running, local package updates can cause state drift. A developer might log in and install a package or change a system file. The next time the code runs, the build tool might overwrite those manual changes.
You can stop drift by choosing a clear boundary for your server updates. Use the build tool to set up the base disk, network, and boot script. Better yet, build immutable machine images and replace the whole server on every update.
Replacing the server ensures that the running Ubuntu host always matches your code. It also removes the need for long-lived SSH keys on your production hosts. Your team gets a clean, predictable Linux server on every single deployment run.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
How does Pulumi run scripts on a new Ubuntu server?
It passes a startup script to the cloud provider during the server build. The Ubuntu boot process reads this script and runs it as the root user.
Should I store SSH private keys in my Pulumi state file?
Yes, if you use encrypted secret values within the state store. Still, using short-lived machine roles instead of static SSH keys is much safer.
How do I handle OS patches on Ubuntu hosts managed by code?
Bake new system packages into a fresh machine image on a set schedule. Then run your deployment tool to swap the old servers with the new image.
Related guides
In this post