The Simplest Way to Make Dagster and Pulumi Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use dagster and pulumi together to build cloud resources and run data pipelines. Pulumi creates the cloud servers and databases, while Dagster runs the daily data jobs. This pairing lets engineers define both cloud systems and data workflows in Python. When you link them well, your data jobs always have the exact resources they need. You avoid manual setup steps in the cloud console. Your team can ship new data tables faster and with fewer errors. How dagster and pulumi share roles and

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 dagster and pulumi together to build cloud resources and run data pipelines. Pulumi creates the cloud servers and databases, while Dagster runs the daily data jobs.

This pairing lets engineers define both cloud systems and data workflows in Python. When you link them well, your data jobs always have the exact resources they need. You avoid manual setup steps in the cloud console. Your team can ship new data tables faster and with fewer errors.

How dagster and pulumi share roles and data

In a standard setup, Pulumi runs first to set up the cloud resources. It creates storage buckets, compute clusters, and database roles for the data team. Then it writes those resource names and role details to a shared state output.

Dagster reads those outputs when it starts a pipeline run. The orchestrator uses the role from Pulumi to log in to the cloud database. Each Dagster worker pod gets its own cloud identity to read and write data. Data flows from raw storage buckets into clean tables during each scheduled job.

Sometimes, a Dagster job also triggers a Pulumi update during a run. For example, a pipeline might spin up a big compute cluster for a heavy task. Once the job finishes, the pipeline tells Pulumi to remove that temporary cluster. This pattern keeps cloud bills low while giving big jobs the power they need.

Common failure modes and how to scope access

Many teams make the mistake of using one shared service account for both tools. They give this single account broad admin rights across the whole cloud account. If a bad actor steals that key, they can delete databases and read sensitive data. Broad tokens also make it hard to see which person or job changed a table.

Another common issue is leaving database queries and state changes unlogged. When a pipeline fails, engineers often log in with shared admin keys to fix it. They run manual commands against production databases with no audit trail. Plus, raw query results might return personal data like emails, phone numbers, or card numbers.

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, give Pulumi and Dagster separate, narrow roles in your cloud setup. Pulumi should only have rights to create the specific services your data pipelines need. Dagster workers should only have read and write rights on specific data tables. Never let a data pipeline use the same admin role that builds the cloud network.

You should also lock down the network paths between your runners and your databases. Keep your data stores in private subnets that block public web traffic. Make sure every action from a worker or an engineer goes into a central log. If engineers inspect live data, apply data masking to rewrite national IDs and emails in results.

Best practices for ongoing state and job changes

Keep your cloud setup code and your pipeline code in separate folders or repos. This split stops a simple SQL change from triggering a full cloud network update. Run your Pulumi updates through an automated build pipeline after a team code review. Let Dagster pull the latest resource names from a read-only state store at start time.

Test your roles and permissions in a staging account before you push to production. Check that your alerts fire when a job tries to read an unauthorized bucket. Regular checks keep your data jobs safe and stable as your team grows.

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

Should Pulumi deploy Dagster or should Dagster run Pulumi?

Most teams use Pulumi first to deploy the Dagster web server, workers, and storage. Only call Pulumi from inside a Dagster job if you need short-lived compute clusters.

How do we pass database keys from Pulumi to Dagster safely?

Do not pass raw keys in plain text outputs. Have Pulumi write the secret into a cloud secret store, and let Dagster read it using a scoped role.

How can we prevent pipelines from exposing personal data in logs?

Set up your logging rules to strip out sensitive fields before saving run logs. Use data masking to rewrite emails, phone numbers, and card numbers in query results.

The query runs. The emails stay hidden.