Skip to content

Instantly share code, notes, and snippets.

@podhmo
Last active July 17, 2021 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save podhmo/7e9a6d947a49651de6c2088a621c46d9 to your computer and use it in GitHub Desktop.
Save podhmo/7e9a6d947a49651de6c2088a621c46d9 to your computer and use it in GitHub Desktop.
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
# https://diagrams.mingrammer.com/docs/getting-started/examples
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_main = RDS("userdb")
db_main - [RDS("userdb ro")]
memcached = ElastiCache("memcached")
dns >> lb >> svc_group
svc_group >> db_main
svc_group >> memcached
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
def draw(name: str, *, show: bool = False) -> None:
with Diagram(name):
dns = Route53()
lb = ELB()
with Cluster() as Services:
web1 = ECS()
web2 = ECS()
web3 = ECS()
with Cluster() as DBCluster:
userdb = RDS()
userdb_ro = RDS()
userdb - [userdb_ro]
memcached = ElastiCache()
dns >> lb >> Services
Services >> DBCluster
Services >> memcached
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment