Skip to main content

Lightweight AWS Diagram Automation

Project description

draws: lightweight AWS Diagram Automation

draws is a dependency-free tool for automating AWS architecture diagram creation.

Example AWS architecture diagram generated by draws from AppSync GraphQL DynamoDB template Example AWS architecture diagram generated by draws from S3 trigger template Example AWS architecture diagram generated by draws from serverless backend stack template

Install

pip install draws

Example Usage (from cdk app)

Add Diagrams.of(app) before app.synth().

app.py:

from aws_cdk import App

from draws import Diagrams
from infra.api_to_s3_stack import ApiToS3Stack
from infra.s3_bucket_stack import S3BucketStack

app = App()

bucket_stack = S3BucketStack(app, f"draws-dev-bucket", public_prefix="public")
docs_ui_stack = ApiToS3Stack(app, f"draws-dev-docs-ui", bucket=bucket_stack.bucket)

# Pass the cdk app into Diagrams.of() (directory defaults to app.py location)
Diagrams.of(app, directory="examples/output")

app.synth()

Run cdk ls to generate diagrams for each stack.

output:

$ cdk ls
Diagram saved to: examples/output/draws-dev-bucket.diagram.svg
Diagram saved to: examples/output/draws-dev-docs-ui.diagram.svg

Example Usage (from template)

import os
from pathlib import Path

from draws import Diagram


if __name__ == "__main__":
    curr_dir = Path(os.path.abspath(os.path.dirname(__file__)))
    templates_dir = curr_dir / "cdk.out"

    D = Diagram.from_template(
        filename=templates_dir / "my-stack.template.json",
        title="My AWS Stack",
    )

    D.to_svg()

Example Usage (manual)

import os
from pathlib import Path

from draws import Diagram, Elem


if __name__ == "__main__":
    with Diagram(title="My AWS Stack") as D:
        rest_api = Elem("AWS::ApiGateway::RestApi", "Rest API")
        lambda_func = Elem("AWS::Lambda::Function", "Lambda")
        bucket = Elem("AWS::S3::Bucket", "Bucket")

        rest_api >> lambda_func
        rest_api << lambda_func
        lambda_func >> bucket

        D.to_svg()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

draws-1.0.0a3.tar.gz (390.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

draws-1.0.0a3-py3-none-any.whl (534.8 kB view details)

Uploaded Python 3

File details

Details for the file draws-1.0.0a3.tar.gz.

File metadata

  • Download URL: draws-1.0.0a3.tar.gz
  • Upload date:
  • Size: 390.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for draws-1.0.0a3.tar.gz
Algorithm Hash digest
SHA256 99af3208bc82d3597f47dbd94cee034e4ae49333a114477664d336fb045e2a86
MD5 088386010e1d96b9fca363e8e80c9ca8
BLAKE2b-256 a450c2f50b7f1c238ea3b070b302fbb3bb1fbf2057af4d9e57c671936904ae46

See more details on using hashes here.

File details

Details for the file draws-1.0.0a3-py3-none-any.whl.

File metadata

  • Download URL: draws-1.0.0a3-py3-none-any.whl
  • Upload date:
  • Size: 534.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for draws-1.0.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 d79e86964f80f6dc9a1980d235a3729ad8cd272ac582fd37681f772d5e61ec98
MD5 65e90e643c614888744daf36568b23d2
BLAKE2b-256 1b01c5cd94ac35d195be336fe705dd008d0c848cf59f9cae541f985bdfd701d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page