mingrammer / diagrams

:art: Diagram as Code for prototyping cloud system architectures
https://diagrams.mingrammer.com
MIT License
37.48k stars 2.45k forks source link

Add Security Groups for AWS #162

Open trov-madisonhope opened 4 years ago

trov-madisonhope commented 4 years ago

Would probably pair well with #128

leandrodamascena commented 4 years ago

AWS represents SecurityGroup as a "general" group icons.. Makes sense to add it in network resource to draw a full security solution.

image

clayms commented 3 years ago

See this answer. https://github.com/mingrammer/diagrams/issues/279#issuecomment-722004811

You can simply change the Cluster "icon" to be whatever you wanted, then change each individual Clusters graph_attr.

See below:

from diagrams.aws.compute import SAR, EKS, EC2

graph_attr = {
    "layout":"neato",
    }

AWS_graph_attr = {
    "style":"solid",
    "bgcolor":"transparent",
    "pencolor":"orange",
    "penwidth":"4.0",
    "fontcolor":"orange",
    "fontname":"Helvetica bold",
    "fontsize":"15.0",
    "labelloc":"t",
    "labeljust":"l",
}

EKS_graph_attr = {
    "style":"rounded",
    "bgcolor":"beige",
    "pencolor":"chartreuse",
    "penwidth":"2.0",
    "fontcolor":"blue",
    "fontname":"Helvetica bold",
    "fontsize":"10.0",
    "labelloc":"t",
    "labeljust":"l",
}

with Diagram("\nAWS", show=False, graph_attr=graph_attr) as diag:
    with Cluster(f"\n{' '*10}AWS Cloud", graph_attr=AWS_graph_attr):
        Node(label="", shape="plaintext", pin="true", pos="0,0" )
        Node(label="", shape="plaintext", pin="true", pos="4,4" )
        aws_cloud = SAR(
            label="", fontsize="6", loc="t",
            fixedsize="true", width="0.6", height="0.7", 
            pin="true", pos="-0.35,5")        

    with Cluster(f"\n\n{' '*20}EKS", graph_attr=EKS_graph_attr):
        Node(label="", shape="plaintext", pin="true", pos="1,1" )
        Node(label="", shape="plaintext", pin="true", pos="3,3" )        
        aks_cluster = EKS(
            label="", fontsize="6", loc="t",
            fixedsize="true", width="0.5", height="0.8", 
            pin="true", pos="0.8,3.8")
        cont1 = EC2("Pod", pin="true", pos="2,2")

diag

image