Skip to main content

infrasketch

Draw Azure and AWS architecture diagrams as SVG. The package uses the official resource icons and lays the diagram out itself, so Graphviz is not required.

from infrasketch import Diagram
from infrasketch.azure import FrontDoor, FunctionApp, Redis, ResourceGroup

with Diagram("Orders", "orders.svg"):
    with ResourceGroup("rg-app"):
        web = FrontDoor("Frontend")
        api = FunctionApp("API")
        cache = Redis("Sessions")
    web >> api >> cache

That writes orders.svg when the block ends. The icon says which service it is. The label is your name for that piece of the system, and the caption under it is the service name.

Azure resources come from infrasketch.azure. AWS resources come from infrasketch.aws:

from infrasketch import Diagram
from infrasketch.aws import APIGateway, CloudFront, DynamoDB, Lambda, S3, Users, VPC

with Diagram("Orders", "orders.svg"):
    with VPC("vpc-orders"):
        api = APIGateway("Orders")
        checkout = Lambda("Checkout")
        orders = DynamoDB("Orders")
        images = S3("Images")
    Users("Customers") >> CloudFront("Entry") >> api >> checkout
    checkout >> [orders, images]

Install

pip install infrasketch

Documentation

The guide and the searchable icon browser are published at antsticky.github.io/infrasketch.

Draw a diagram

Resources only exist inside a diagram. Groups are context managers too, so the indentation is the architecture:

from infrasketch import Diagram, Https, Private
from infrasketch.azure import (
    ResourceGroup, VNet, Subnet, PrivateNetwork,
    Users, FrontDoor, StaticWebApp, AppService, Redis, SQLDatabase, KeyVault,
)

with Diagram("Web, API, and Redis", "platform.svg", subtitle="Production · West Europe"):
    customers = Users("Customers")
    with ResourceGroup("rg-edge"):
        door = FrontDoor("Entry")
    with ResourceGroup("rg-app"):
        with VNet("vnet-app"):
            with Subnet("snet-web"):
                web = StaticWebApp("Storefront")
            with Subnet("snet-api"):
                api = AppService("Orders API")
            with PrivateNetwork("data"):
                cache = Redis("Sessions")
                database = SQLDatabase("Orders")
                vault = KeyVault("Secrets")

    customers >> Https() >> door >> web >> api
    api >> [cache, database]
    api >> Private("secrets") >> vault

direction="TB" flows top to bottom. spacing is "compact", "regular", or "relaxed". Pass autosave=False when you want the SVG string yourself:

with Diagram("Orders", autosave=False) as diagram:
    ...
svg = diagram.svg()
diagram.save("orders.svg")

Connectors

Code Result
a >> b Arrow from a to b
a >> [b, c] Arrow from a to each target
[a, b] >> c Arrow from each source to c
a << b Arrow pointing back at a
a - b Line with no arrowhead
a >> Edge("SQL", style="dashed") >> b Labelled connector
a >> Https() >> b Azure-blue HTTPS
a >> Async("enqueue") >> b Dashed queue or event
a >> Private() >> b Dashed Private Link

style is "solid", "dashed", or "dotted". color is a hex color such as "#0078D4".

Boundaries

Group Use it for
Subscription("sub") A subscription
ResourceGroup("rg-app") A resource group
Region("West Europe") A region
VNet("vnet-app") A virtual network
Subnet("snet-api") A subnet
PrivateNetwork("data") Private endpoints or Private Link
Group("Workers") Anything else

Inside a boundary, connected resources flow in the diagram direction. Resources at the same step stack, which is what you want for a cache beside its database. arrange="row" forces a single row, arrange="column" a single column, and arrange="grid" with columns=3 a grid.

Finding an icon

Common Azure names, imported from infrasketch.azure: FunctionApp, ContainerApp, ACR, AKS, Redis, ManagedRedis, SQLDatabase, CosmosDB, PostgreSQL, StorageAccount, KeyVault, FrontDoor, ApplicationGateway, ServiceBus, StaticWebApp.

Common AWS names, imported from infrasketch.aws: Lambda, EC2, S3, DynamoDB, APIGateway, CloudFront, SQS, EKS.

Search when you need the rest:

python -m infrasketch search private endpoint
python -m infrasketch search container registry
python -m infrasketch categories
from infrasketch import search

for hit in search("cosmos"):
    print(hit.import_line)
from infrasketch.azure.networking import Bastions
from infrasketch.aws.compute import AWSLambda

FunctionApp("Orders") labels the box "Orders" and captions it "Function App". FunctionApp() uses the service name as the only label. caption=False hides the caption.

A resource with no icon draws a neutral placeholder. Pass icon="path/to.svg" to use your own artwork. Azure icons are never recoloured or stretched.

Examples

Script What it shows
examples/azure_web_api.py Front Door, static web app, API, Redis, SQL, Key Vault
examples/azure_container_apps.py ACR, Container Apps, private endpoints
examples/azure_functions.py API Management, functions, Service Bus, Cosmos DB, storage
examples/azure_aks.py AKS, ACR, PostgreSQL, managed Redis
examples/azure_ai.py Static web app, Azure OpenAI, AI Search, storage
examples/azure_data.py Event Hubs, Logic Apps, Data Factory, SQL
examples/azure_network.py Firewall, Application Gateway, Bastion, a jump host
examples/aws_orders.py CloudFront, API Gateway, Lambda, DynamoDB, and S3 in a VPC

Web, API, and Redis

Container Apps

License

The package license expression is MIT AND LicenseRef-Microsoft-Azure-Architecture-Icons AND LicenseRef-AWS-Architecture-Icons.

The Python code is MIT. See LICENSE.

The SVG files in src/infrasketch/data/icons are official cloud artwork. They are not MIT. Azure icons are LicenseRef-Microsoft-Azure-Architecture-Icons. AWS icons, under src/infrasketch/data/icons/aws, are LicenseRef-AWS-Architecture-Icons. Microsoft allows the Azure icons in architecture diagrams, training materials, and documentation. AWS allows customers and partners to use the AWS icons in architecture diagrams, and in whitepapers, presentations, datasheets, and posters. Do not use either set as a logo or to represent your own product. The terms travel with the files in NOTICE, src/infrasketch/data/icons/LICENSE.txt, and src/infrasketch/data/icons/aws/LICENSE.txt.

Metadata

Release files for infrasketch 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for infrasketch 1.0.0
File Size Uploaded Provenance Actions
infrasketch-1.0.0.tar.gz 962.0 kB With provenance Details for infrasketch-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for infrasketch 1.0.0
File Interpreter ABI Platform Actions
infrasketch-1.0.0-py3-none-any.whl Python 3 none any Details for infrasketch-1.0.0-py3-none-any.whl

Total release size: 2.4 MB

Release files / infrasketch-1.0.0.tar.gz

Download URL infrasketch-1.0.0.tar.gz
Size 962.0 kB
Tags Source
SHA-256 checksum
How to use checksums
296bf52f8be4b25b0638948245b5250a67477c1973dc49f033eecc8c8e635897
BLAKE2b-256 checksum
How to use checksums
de6128411ce3ce470f2d9a2b103702872a41d0639c621372773987c131c22b75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / infrasketch-1.0.0-py3-none-any.whl

Download URL infrasketch-1.0.0-py3-none-any.whl
Size 1.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
52adb2ff4354f33a2eb90a248ea59a9fa1cc2c4dfd9aff5cc21d87bbc11137a8
BLAKE2b-256 checksum
How to use checksums
a6cffb58fab8f5bb1737a834dc859d406b12f012674d56cb24cc0ef2704e4675
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Security for infrasketch 1.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for infrasketch-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page