2021年2月18日
Diagrams(draw.io):使用图表描述云系统架构原型
使用Diagrams可以用Python代码绘制云系统架构。它的诞生是为没有任何设计工具的新系统架构设计提供原型。您还可以描述或可视化现有的系统架构。图表目前支持六个主要供应商:AWS,Azure,GCP,Kubernetes,Alibaba Cloud和Oracle Cloud。现在,它还支持On-Premise节点。
Diagram as Code还使您可以跟踪任何版本控制系统中的体系结构图更改。
注意:它不控制任何实际的云资源,也不会生成云形式或本地形式的代码。它仅用于绘制云系统架构图。
事件处理架构图:
from diagrams import Cluster, Diagram from diagrams.aws.compute import ECS, EKS, Lambda from diagrams.aws.database import Redshift from diagrams.aws.integration import SQS from diagrams.aws.storage import S3 with Diagram(“Event Processing”, show=False): source = EKS(“k8s source”) with Cluster(“Event Flows”): with Cluster(“Event Workers”): workers = [ECS(“worker1”), ECS(“worker2”), ECS(“worker3”)] queue = SQS(“event queue”) with Cluster(“Processing”): handlers = [Lambda(“proc1”), Lambda(“proc2”), Lambda(“proc3”)] store = S3(“events store”) dw = Redshift(“analytics”) source >> workers >> queue >> handlers handlers >> store handlers >> dw |
有状态架构图:
from diagrams import Cluster, Diagram from diagrams.k8s.compute import Pod, StatefulSet from diagrams.k8s.network import Service from diagrams.k8s.storage import PV, PVC, StorageClass with Diagram(“Stateful Architecture”, show=False): with Cluster(“Apps”): svc = Service(“svc”) sts = StatefulSet(“sts”) apps = [] for _ in range(3): pod = Pod(“pod”) pvc = PVC(“pvc”) pod – sts – pvc apps.append(svc >> pod >> pvc) apps << PV(“pv”) << StorageClass(“sc”) |