GraphIaC
Early Alpha — Experimental Software GraphIaC is in early alpha. APIs will change, features are incomplete, and it has not been tested in production. Use at your own risk.
A graph-based Infrastructure-as-Code framework for AWS. Model your cloud infrastructure as a directed graph — nodes are AWS resources, edges are the connections and permissions between them.
The Problem
Tools like Terraform and Pulumi make it easy to define individual resources. The hard part is wiring them together: IAM policies, invoke permissions, service integrations. That boilerplate is repetitive, error-prone, and the main source of permission debugging in real projects. Most IaC tools treat it as an afterthought, burying it inside resource definitions in ways that make the code hard to read and impossible to reuse.
The Approach
GraphIaC promotes connections to first-class citizens. When you add a LambdaToDynamoEdge, the edge already knows what IAM policies are required. It queries the graph for the relevant ARNs and provisions everything itself. You declare the connection; the edge handles the boilerplate.
Because AWS permission patterns are stable, that knowledge gets written once into the edge class and reused everywhere. Nodes stay clean and self-contained, which means they're also easy to copy across projects.
A secondary benefit: because the infrastructure is a graph, you can render it as a diagram at any time — always up to date, no manual documentation required.
Key Concepts
- Nodes — AWS resources (Lambda, DynamoDB table, IAM role, API Gateway, etc.), each a Pydantic model with
read,create,update, anddeletemethods - Edges — the connections between resources; each edge knows what it takes to wire two nodes together (IAM policies, invoke permissions, etc.)
- State reconciliation — on every
plan(), GraphIaC diffs live AWS state against a local SQLite DB and produces a list ofCREATE,UPDATE,DELETE, orIMPORToperations run()— executes the plan in the correct order
Install
pip install GraphIaC
For development (editable install with test dependencies):
pip install -e ".[dev]"
GraphIaC can export infrastructure diagrams via Graphviz. To enable that, install pygraphviz:
pip install --config-settings="--global-option=build_ext" \
--config-settings="--global-option=-I$(brew --prefix graphviz)/include/" \
--config-settings="--global-option=-L$(brew --prefix graphviz)/lib/" \
pygraphviz
Usage
import sqlite3
import boto3
import GraphIaC
from GraphIaC.aws.dynamodb import DynamoTable, DynamoKey
from GraphIaC.aws.lambda_func import LambdaFunction
session = boto3.Session(profile_name="my-profile")
db_conn = sqlite3.connect("my-infra.db")
state = GraphIaC.init(session, db_conn)
table = DynamoTable(g_id="users_table", table_name="users", partition_key=DynamoKey(name="pk", attr_type="S"))
GraphIaC.add_node(state, table)
# plan() shows what will change; run() applies it
GraphIaC.plan(state)
GraphIaC.run(state)
CLI
GraphIaC ships a command-line interface so you can run infra operations without writing a script.
python -m GraphIaC <aws-profile> --infra_file <path/to/infra.py> <command>
Commands
| Command | What it does |
|---|---|
plan |
Diffs live AWS state against the local DB and prints the changes that would be applied |
run |
Applies the plan — creates, updates, and deletes resources |
diagram |
Renders the infrastructure graph as a Graphviz PNG |
import |
Imports existing AWS resources into local state |
Examples
# Preview changes for a profile named my-aws-profile
python -m GraphIaC my-aws-profile --infra_file infra.py plan
# Apply changes
python -m GraphIaC my-aws-profile --infra_file infra.py run
# Render a diagram
python -m GraphIaC my-aws-profile --infra_file infra.py diagram
The SQLite state DB is created automatically next to the infra file (e.g. infra.py → infra.db). Your infra file must expose an infra(state) function that builds the graph:
# infra.py
def infra(state):
table = DynamoTable(g_id="users_table", ...)
GraphIaC.add_node(state, table)
# add more nodes and edges...
Running Tests
Tests mirror the source tree (tests/aws/ covers src/GraphIaC/aws/, and so on for future providers).
AWS integration tests hit real AWS and require credentials. Set AWS_PROFILE to the profile you want to use, then run:
AWS_PROFILE=your-profile pytest tests/aws/
Tests generate randomized resource names on every run and clean up after themselves, including on failure. Resources are created in us-east-2 by default.
Run a specific test file:
AWS_PROFILE=your-profile pytest tests/aws/test_dynamodb.py -v
Skip AWS tests (e.g. in CI without credentials) — omit AWS_PROFILE or unset it. Any test that needs AWS will be skipped automatically.
License
MIT — see LICENSE.
Metadata
Release files for GraphIaC 0.0.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| graphiac-0.0.13.tar.gz | 39.8 kB | Without provenance | Details for graphiac-0.0.13.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| graphiac-0.0.13-py3-none-any.whl | Python 3 | none | any | Details for graphiac-0.0.13-py3-none-any.whl |
Total release size: 86.6 kB
Release files / graphiac-0.0.13.tar.gz
| Download URL | graphiac-0.0.13.tar.gz |
|---|---|
| Size | 39.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
737cf9c38600f7dc8f92156b680c4fd524af31d90221761a5a2ade7202647ef5
|
|
BLAKE2b-256 checksum How to use checksums |
b62260f11ef6d49cd531e7801c19a19665ed2843a14d0654b942d1d285c851e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / graphiac-0.0.13-py3-none-any.whl
| Download URL | graphiac-0.0.13-py3-none-any.whl |
|---|---|
| Size | 46.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4214428af3e8c27968c94548b3ae472121d280363a79e5d297f8edc60610a628
|
|
BLAKE2b-256 checksum How to use checksums |
cedfbbb0c2ede9ef1f1390efa5e0407c30139fe5f06850c7b479e5877754582b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Security for GraphIaC 0.0.13
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.