Curso-lenguaje-python/catch-all/07_diagrams_as_code/03_event_aws.py

33 lines
860 B
Python
Raw Normal View History

2024-08-13 01:43:53 +02:00
#! /usr/bin/env python
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