CodeAsDiagram
코드로 만드는 diagram
code로 무엇인가를 만들어내는 것은 아름다운 일인것 같다
install
sudo apt update
sudo apt install python3
# pip install
sudo apt update
sudo apt install python3-pip
# using pip (pip3)
pip install diagrams
# using pipenv
pipenv install diagrams
# poetry 설치
curl -sSL https://install.python-poetry.org | python3 - --git https://github.com/python-poetry/poetry.git@main
sudo apt install python3-venv
# using poetry
poetry add diagrams
Quick Start
diagram.py
from diagrams import Diagram
from diagrams.aws.compute import EC2
from diagrams.aws.database import RDS
from diagrams.aws.network import ELB
with Diagram("Web Service", show=False):
ELB("lb") >> EC2("web") >> RDS("userdb")
This code generates below diagram.
image viewer로 파일생성 이후 바로보는 방법은 아랫줄에 코드 한줄 추가 하면 된다 (feh 나 imgmagick 같은 툴을 설치 해야함)
subprocess.call(["feh", "Web Service.png" ])
excute
python diagram.py
list는 여기서 확인
Last updated