コード例 #1
0
from diagrams.aws.network import InternetGateway, RouteTable, VPCRouter
from diagrams.aws.security import KMS, IAMRole
from diagrams.generic.network import Firewall
from diagrams.onprem.network import Internet

graph_attr = {
    "pad": "0",
    "bgcolor": "transparent"
}

with Diagram("template-08", show=False, direction="LR", filename="diagram-08", graph_attr=graph_attr):
    internet = Internet("Public Internet")
    with Cluster("Vpc 10.0.0.0/16"):
        internet_gateway = InternetGateway("Igw")
        internet - internet_gateway
        routeTable = RouteTable("RouteTable")
        routeTable >> Edge(label="0.0.0.0/0", style="dashed") >> internet_gateway
        with Cluster("Subnet 10.0.0.0/24"):
            router = VPCRouter("Router\n10.0.0.1")
            router - Edge(style="dashed") - routeTable
            router - internet_gateway
            ec2 = EC2("ec2\n10.0.0.x")
            ec2 - Edge(style="dashed") - router
            sg = Firewall("SG: 22/tcp")
            ec2 - sg - router
    KMS("KeyPair") - ec2
    ec2Role = IAMRole("Ec2InstanceRole") - ec2

    cw = Cloudwatch("CloudWatch")
    cw - internet
コード例 #2
0
from diagrams import Diagram, Cluster
from diagrams.aws.network import PrivateSubnet, RouteTable

with Diagram("AWS VPC Subnets", show=False, direction="TB"):

    route_table = RouteTable("route table")

    with Cluster("vpc"):

        route_table << [
            PrivateSubnet("subnet a"),
            PrivateSubnet("subnet b"),
            PrivateSubnet("subnet c")
        ]

コード例 #3
0
             filename="diagram-11",
             graph_attr=graph_attr):
    cw = Cloudwatch("CloudWatch")
    deployment_bucket = S3("DeploymentBucket")

    internet = Internet("Public Internet")

    internet - cw
    internet - deployment_bucket

    internet_gateway = InternetGateway("Igw")

    internet_gateway - internet

    with Cluster("Vpc 10.0.0.0/16"):
        publicRouteTable = RouteTable("PublicRouteTable")
        publicRouteTable >> Edge(label="0.0.0.0/0",
                                 style="dashed") >> internet_gateway
        privateRouteTable = RouteTable("PrivateRouteTable")
        with Cluster("AZ1 (eu-central-1a)"):
            with Cluster("PublicSubnet 10.0.0.0/24"):
                publicSubnetRouter = VPCRouter("Router\n10.0.0.1")
                publicSubnetRouter - internet_gateway
                publicSubnetRouter - Edge(style="dashed") - publicRouteTable
                ec2 = EC2("ec2\n10.0.0.x")
                webSg = Firewall("SG: 8080/tcp")
                ec2 - Edge(style="dashed") - publicSubnetRouter
                ec2 - webSg - publicSubnetRouter
            with Cluster("PrivateSubnetA 10.0.8.0/24"):
                privateSubnetARouter = VPCRouter("Router\n10.0.8.1")
                privateSubnetARouter - Edge(style="dashed") - privateRouteTable
コード例 #4
0
ファイル: gen_diagram.py プロジェクト: tpai/terraform-demo
from diagrams.custom import Custom
from diagrams.generic.network import Switch, VPN

azure_url = "https://cdn.wccftech.com/wp-content/uploads/2016/05/Azure_.png"
azure_icon = "azure.png"
urlretrieve(azure_url, azure_icon)

with Diagram(""):
    azure = Custom("Azure", azure_icon)
    dns = Route53("dns")
    office = Switch("office")
    with Cluster("odhk-data-vpc"):
        cf = CloudFront("odhk-data-cf")
        waf = WAF("odhk-data-waf")
        s3 = S3("odhk-data-s3")
        rt = RouteTable("odhk-data-rt")
        natrt = RouteTable("odhk-data-nat-rt")
        igw = InternetGateway("odhk-data-igw")
        with Cluster("odhk-data-gw-subnet"):
            natgw = NATGateway("odhk-data-nat-gw")
        with Cluster("data-public-subnet"):
            elb = ELB("data-pipeline-elb")
            with Cluster("data-pg-sg"):
                ppg = RDS("pipeline-pg")
                wpg = RDS("warehouse-pg")
        with Cluster("data-pipeline-subnet"):
            eks = EKS("data-pipeline-eks")
            with Cluster("data-pipelie-eks-ng"):
                ng = EC2("data-pipelie-eks-node")
        with Cluster("data-pipelie-redis-sg"):
            ec = ElastiCache("data-pipeline-ec")