Python
Diagram as Code
Lim Seung Hyun
2023. 3. 7. 14:02
Diagrams
- Python 코드로 다이어그램을 작성할 수 있는 라이브러리.
- 라이브러리 링크: https://diagrams.mingrammer.com/
Diagrams · Diagram as Code
Diagram as Code
diagrams.mingrammer.com
Installation
- python 3.6 버전 이상 환경
- pip3 install diagrams
- brew install graphviz (Mac 의 Brew 환경에서 설치)
Features
- 다양한 클라우드 서비스 제공 업체의 아이콘 사용가능
- 클러스터도 표현 가능
- 간단한 코드로 다이어그램 작성 가능
- Python 언어 제공
How to Use
from diagrams import Diagram # 다이어그램
# 다이어그램에 표시할 대상
from diagrams.aws.compute import ElasticContainerService as ECS
from diagrams.aws.database import RDS
with Diagram("newDiagram", filename="newDiagram.png"): # 다이어그램 이름 및 저장 파일명
db = RDS("DB")
web = ECS("Web")
web << db # 화살표로 방향을 표시
db << web
Reference
728x90