The Simplest Way to Make Lambda and Pulumi Work Like They Should
Teams use lambda and pulumi together to build and ship serverless apps with code. Pulumi sets up the cloud rules and roles, while Lambda runs the app logic. This pair lets developers write their cloud setup and app code in one language. You do not need to switch between old text files and your main code. Instead, you define your functions, cloud roles, and network rules in the same project. When you push an update, the tool builds the package and updates the cloud. How lambda and pulumi share
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 lambda and pulumi together to build and ship serverless apps with code. Pulumi sets up the cloud rules and roles, while Lambda runs the app logic.
This pair lets developers write their cloud setup and app code in one language. You do not need to switch between old text files and your main code. Instead, you define your functions, cloud roles, and network rules in the same project. When you push an update, the tool builds the package and updates the cloud.
How lambda and pulumi share roles and data
To make lambda and pulumi work well, you must link two distinct phases. The first phase is the deploy step, where Pulumi talks to the cloud API. Your deploy tool needs a cloud role that can create functions and attach rules. It zips your app code, sends it to the cloud, and sets up triggers.
The second phase is the run step, when the function wakes up and works. Pulumi creates a separate cloud role and hands it to the Lambda function. When an event starts the function, Lambda uses that role to read databases. Data flows into the function from web requests, queues, or storage buckets.
Pulumi also passes settings and secret references into the function during the deploy step. The function reads those settings when it starts up so it can find databases. Separating the deploy role from the run role keeps your cloud setup much safer. A bug in your function code cannot change your cloud setup or delete buckets.
Common mistakes with roles and network paths
Fast deploys often lead teams to take risky shortcuts with cloud permissions. A common mistake is using one giant admin key for all Pulumi deploys. When every developer shares that key, you cannot tell who changed a live function. Another bad habit is giving functions broad permissions to read every table or bucket.
Teams also put plain text database passwords right inside the function settings. Anyone who can read the function setup in the cloud console sees those passwords. If a function talks to a database without logs, you miss bad queries. You have no record of what data the function changed during a run.
Lambda Execution Roles + Pulumi Policy as Code: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
You can fix these issues by scoping roles down to the bare minimum. Give each function its own cloud role that only touches one specific resource. Put your functions inside a private network so they do not sit open. Force all database traffic through private subnets and check every request with strict rules.
How to manage state and updates across teams
As your team grows, putting all functions in one project causes slow deploys. One small code change makes the tool check hundreds of cloud resources at once. If two developers run an update at the same time, their changes can clash. A failed update can leave a function with new code but old network rules.
Break your projects into small stacks to keep updates fast and safe. Put your shared network and databases in a base stack that rarely changes. Put your active functions in smaller stacks that belongs to specific product teams. Each stack gets its own lock so two runs never collide at once.
Use stack outputs to share resource names between the base stack and app stacks. The base stack exports the network ID, and the function stack reads that value. Run all live updates from an automated build pipeline instead of developer laptops. This rule keeps local mistakes from breaking live functions during the work day.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
How should Pulumi package code for a Lambda function?
Let your build pipeline compile the code and dependencies into a clean folder first. Pulumi then zips that folder, checks the file hash, and uploads changes to the cloud.
Should developers run Pulumi updates from their own laptops?
Allow local runs only for personal test stacks in a separate sandbox account. Run all production updates through an automated build pipeline with a scoped deploy role.
How do functions get database secrets without exposing them in state files?
Store the raw secret in a cloud secret store instead of the project files. Pass only the secret name through Pulumi so the function fetches it at run time.
Related guides
In this post