56 lines
2.1 KiB
Python
56 lines
2.1 KiB
Python
from diagrams.aws.general import InternetAlt2, GenericFirewall
|
|
from diagrams.generic.network import VPN
|
|
from diagrams.aws.database import RDS
|
|
from diagrams.aws.compute import EC2
|
|
from diagrams import Diagram, Cluster, Edge
|
|
from diagrams.aws.network import (
|
|
VPC,
|
|
VPCRouter,
|
|
InternetGateway,
|
|
NATGateway,
|
|
PrivateSubnet,
|
|
PublicSubnet,
|
|
ALB,
|
|
RouteTable
|
|
)
|
|
|
|
with Diagram(".NET API with RDS Backend", show=False, direction="TB", graph_attr={"fontname": "Times"}):
|
|
with Cluster("us-east-1", graph_attr={"fontname": "Times"}):
|
|
internet = InternetAlt2("Internet")
|
|
|
|
with Cluster("Production-vpc", graph_attr={"fontname": "Times"}):
|
|
with Cluster(".NET Backend", graph_attr={"fontname": "Times"}):
|
|
PrivateSubnet("10.8.32.0/24")
|
|
ec2_windows = EC2("Windows Server 2019")
|
|
windows_sg = GenericFirewall("Production-windows-sg")
|
|
|
|
with Cluster("Database Cluster", graph_attr={"fontname": "Times"}):
|
|
nat_gw = NATGateway("NAT Gateway")
|
|
vpn = VPN("10.1.0.0/16")
|
|
rds_sg = GenericFirewall("Production-database-sg")
|
|
with Cluster("us-east-1a", graph_attr={"fontname": "Times"}):
|
|
rds_cluster_a = RDS("production-rds-db")
|
|
PrivateSubnet("10.8.32.0/24")
|
|
with Cluster("us-east-1b", graph_attr={"fontname": "Times"}):
|
|
rds_cluster_b = RDS("production-rds-db")
|
|
PrivateSubnet("10.8.33.0/24")
|
|
|
|
with Cluster("Frontend", graph_attr={"fontname": "Times"}):
|
|
igw = InternetGateway("Internet Gateway")
|
|
alb = ALB("yourapi-com")
|
|
public_subnet = PublicSubnet(
|
|
"Public Subnet\n10.8.0.0/24\n10.8.1.0/24")
|
|
|
|
alb - Edge(color="darkgreen") - igw
|
|
public_subnet - Edge(color="darkgreen") - alb
|
|
ec2_windows - Edge(color="darkgreen") - windows_sg
|
|
windows_sg - Edge(color="darkgreen") - alb
|
|
|
|
vpn - Edge(color="blue") - rds_sg
|
|
rds_cluster_a - Edge(color="darkgreen") - rds_sg
|
|
rds_cluster_b - Edge(color="darkgreen") - rds_sg
|
|
rds_sg - Edge(color="darkgreen") - nat_gw
|
|
|
|
nat_gw - Edge(color="darkgreen") - internet
|
|
igw - Edge(color="darkgreen") - internet
|