Curso-lenguaje-python/catch-all/07_diagrams_as_code/02_cluster_web.py
2024-08-13 01:43:53 +02:00

29 lines
695 B
Python

#! /usr/bin/env python
from diagrams import Cluster, Diagram
from diagrams.aws.compute import ECS
from diagrams.aws.database import ElastiCache, RDS
from diagrams.aws.network import ELB
from diagrams.aws.network import Route53
with Diagram("Clustered Web Services", show=False):
dns = Route53("dns")
lb = ELB("lb")
with Cluster("Services"):
svc_group = [
ECS("web1"),
ECS("web2"),
ECS("web3")
]
with Cluster("DB Cluster"):
db_primary = RDS("userdb")
db_primary - [RDS("userdb ro")]
memcached = ElastiCache("memcached")
dns >> lb >> svc_group
svc_group >> db_primary
svc_group >> memcached