mirror of https://github.com/mingrammer/diagrams
parent
c93af91f75
commit
62a2441401
@ -0,0 +1,104 @@
|
|||||||
|
from diagrams import Cluster
|
||||||
|
from diagrams.aws.compute import EC2, ApplicationAutoScaling
|
||||||
|
from diagrams.aws.network import VPC, PrivateSubnet, PublicSubnet
|
||||||
|
|
||||||
|
class Region(Cluster):
|
||||||
|
# fmt: off
|
||||||
|
_default_graph_attrs = {
|
||||||
|
"shape": "box",
|
||||||
|
"style": "dotted",
|
||||||
|
"labeljust": "l",
|
||||||
|
"pencolor": "#AEB6BE",
|
||||||
|
"fontname": "Sans-Serif",
|
||||||
|
"fontsize": "12",
|
||||||
|
}
|
||||||
|
# fmt: on
|
||||||
|
|
||||||
|
class AvailabilityZone(Cluster):
|
||||||
|
# fmt: off
|
||||||
|
_default_graph_attrs = {
|
||||||
|
"shape": "box",
|
||||||
|
"style": "dashed",
|
||||||
|
"labeljust": "l",
|
||||||
|
"pencolor": "#27a0ff",
|
||||||
|
"fontname": "sans-serif",
|
||||||
|
"fontsize": "12",
|
||||||
|
}
|
||||||
|
# fmt: on
|
||||||
|
|
||||||
|
class VirtualPrivateCloud(Cluster):
|
||||||
|
# fmt: off
|
||||||
|
_default_graph_attrs = {
|
||||||
|
"shape": "box",
|
||||||
|
"style": "",
|
||||||
|
"labeljust": "l",
|
||||||
|
"pencolor": "#00D110",
|
||||||
|
"fontname": "sans-serif",
|
||||||
|
"fontsize": "12",
|
||||||
|
}
|
||||||
|
# fmt: on
|
||||||
|
_icon = VPC
|
||||||
|
|
||||||
|
class PrivateSubnet(Cluster):
|
||||||
|
# fmt: off
|
||||||
|
_default_graph_attrs = {
|
||||||
|
"shape": "box",
|
||||||
|
"style": "",
|
||||||
|
"labeljust": "l",
|
||||||
|
"pencolor": "#329CFF",
|
||||||
|
"fontname": "sans-serif",
|
||||||
|
"fontsize": "12",
|
||||||
|
}
|
||||||
|
# fmt: on
|
||||||
|
_icon = PrivateSubnet
|
||||||
|
|
||||||
|
class PublicSubnet(Cluster):
|
||||||
|
# fmt: off
|
||||||
|
_default_graph_attrs = {
|
||||||
|
"shape": "box",
|
||||||
|
"style": "",
|
||||||
|
"labeljust": "l",
|
||||||
|
"pencolor": "#00D110",
|
||||||
|
"fontname": "sans-serif",
|
||||||
|
"fontsize": "12",
|
||||||
|
}
|
||||||
|
# fmt: on
|
||||||
|
_icon = PublicSubnet
|
||||||
|
|
||||||
|
class SecurityGroup(Cluster):
|
||||||
|
# fmt: off
|
||||||
|
_default_graph_attrs = {
|
||||||
|
"shape": "box",
|
||||||
|
"style": "dashed",
|
||||||
|
"labeljust": "l",
|
||||||
|
"pencolor": "#FF361E",
|
||||||
|
"fontname": "Sans-Serif",
|
||||||
|
"fontsize": "12",
|
||||||
|
}
|
||||||
|
# fmt: on
|
||||||
|
|
||||||
|
class AutoScalling(Cluster):
|
||||||
|
# fmt: off
|
||||||
|
_default_graph_attrs = {
|
||||||
|
"shape": "box",
|
||||||
|
"style": "dashed",
|
||||||
|
"labeljust": "l",
|
||||||
|
"pencolor": "#FF7D1E",
|
||||||
|
"fontname": "Sans-Serif",
|
||||||
|
"fontsize": "12",
|
||||||
|
}
|
||||||
|
# fmt: on
|
||||||
|
_icon = ApplicationAutoScaling
|
||||||
|
|
||||||
|
class EC2Contents(Cluster):
|
||||||
|
# fmt: off
|
||||||
|
_default_graph_attrs = {
|
||||||
|
"shape": "box",
|
||||||
|
"style": "",
|
||||||
|
"labeljust": "l",
|
||||||
|
"pencolor": "#FFB432",
|
||||||
|
"fontname": "Sans-Serif",
|
||||||
|
"fontsize": "12",
|
||||||
|
}
|
||||||
|
# fmt: on
|
||||||
|
_icon = EC2
|
@ -0,0 +1,15 @@
|
|||||||
|
from diagrams import Cluster
|
||||||
|
from diagrams.onprem.compute import Server
|
||||||
|
|
||||||
|
class ServerContents(Cluster):
|
||||||
|
# fmt: off
|
||||||
|
_default_graph_attrs = {
|
||||||
|
"shape": "box",
|
||||||
|
"style": "rounded,dotted",
|
||||||
|
"labeljust": "l",
|
||||||
|
"pencolor": "#A0A0A0",
|
||||||
|
"fontname": "Sans-Serif",
|
||||||
|
"fontsize": "12",
|
||||||
|
}
|
||||||
|
# fmt: on
|
||||||
|
_icon = Server
|
After Width: | Height: | Size: 67 KiB |
@ -0,0 +1,26 @@
|
|||||||
|
from diagrams import Diagram, Edge
|
||||||
|
from diagrams.aws.cluster import *
|
||||||
|
from diagrams.aws.compute import EC2
|
||||||
|
from diagrams.onprem.container import Docker
|
||||||
|
from diagrams.onprem.cluster import *
|
||||||
|
from diagrams.aws.network import ELB
|
||||||
|
|
||||||
|
with Diagram(name="", direction="TB", show=True):
|
||||||
|
with Cluster("AWS"):
|
||||||
|
with Region("eu-west-1"):
|
||||||
|
with AvailabilityZone("eu-west-1a"):
|
||||||
|
with VirtualPrivateCloud(""):
|
||||||
|
with PrivateSubnet("Private"):
|
||||||
|
with SecurityGroup("web sg"):
|
||||||
|
with AutoScalling(""):
|
||||||
|
with EC2Contents("A"):
|
||||||
|
d1 = Docker("Container")
|
||||||
|
with ServerContents("A1"):
|
||||||
|
d2 = Docker("Container")
|
||||||
|
|
||||||
|
with PublicSubnet("Public"):
|
||||||
|
with SecurityGroup("elb sg"):
|
||||||
|
lb = ELB()
|
||||||
|
|
||||||
|
lb >> Edge(forward=True, reverse=True) >> d1
|
||||||
|
lb >> Edge(forward=True, reverse=True) >> d2
|
Loading…
Reference in new issue