-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathaws_web_service_db_cluster.py
executable file
·56 lines (46 loc) · 1.48 KB
/
aws_web_service_db_cluster.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python3
# coding=utf-8
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: 2023-04-14 13:54:52 +0100 (Fri, 14 Apr 2023)
#
# https://github.com/HariSekhon/Diagrams-as-Code
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn
# and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/HariSekhon
#
"""
AWS Web Service with DB Cluster
"""
# based on https://diagrams.mingrammer.com/docs/getting-started/examples
__author__ = 'Hari Sekhon'
__version__ = '0.1'
import os
from diagrams import Diagram, Cluster
# ============================================================================ #
# AWS resources:
#
# https://diagrams.mingrammer.com/docs/nodes/aws
#
from diagrams.aws.compute import ECS
from diagrams.aws.database import RDS
from diagrams.aws.network import Route53
# Cluster puts a box around RDS nodes, and can connect outside ECS and Route53 to the primary RDS
with Diagram("AWS Web Service DB Cluster",
show=not bool(os.environ.get('CI', 0)),
filename='images/aws_web_service_db_cluster',
):
dns = Route53("Route53 DNS")
web = ECS("ECS web service")
with Cluster("RDS DB Cluster"):
db_primary = RDS("primary")
# pylint: disable=W0106
db_primary - [RDS("replica2"),
RDS("replica1")]
# pylint: disable=W0104
dns >> web >> db_primary