from diagrams.aws.compute import EC2 from diagrams.k8s.network import Ingress from diagrams.k8s.network import Service from diagrams.k8s.compute import Pod from diagrams.onprem.iac import Terraform from diagrams.onprem.ci import GitlabCI from diagrams.aws.storage import S3 with Diagram("EKS Cluster", show=False, direction="LR"): ssl_certificate = ACM("SSL cert") dns_name = Route53("DNS domain") load_balancer = ELB("Load balancer") with Cluster("Custom VPC"): with Cluster("Public network"): public_subnets = [ PublicSubnet("Subnet zone a"), PublicSubnet("Subnet zone b"), PublicSubnet("Subnet zone c"), PublicSubnet("Subnet zone d"), ] nat_gateway = NATGateway("NAT gateway") with Cluster("Private network"): private_subnets = [ PrivateSubnet("Subnet zone a"), PrivateSubnet("Subnet zone b"), PrivateSubnet("Subnet zone c"), PrivateSubnet("Subnet zone d"), ] with Cluster("Kubernetes cluster"): autoscaling_group = AutoScaling("Autoscaling group") autoscaling_group_instances = [
from diagrams import Cluster, Diagram from diagrams.aws.compute import EC2 from diagrams.aws.network import VPC, PublicSubnet, PrivateSubnet, ELB, Route53 with Diagram("Load Balancer in front of an application", show=True, direction="TB"): dns = Route53("DNS") with Cluster("VPC"): VPC() with Cluster("Public Subnet"): PublicSubnet() lb = ELB("Application\nLoad Balancer") with Cluster("Private Subnet"): PrivateSubnet() svc_group = [EC2("app%s" % idx) for idx in [1, 2, 3]] dns >> lb lb >> svc_group
from diagrams.aws.compute import ElasticContainerServiceService from diagrams.aws.database import Aurora from diagrams.aws.database import AuroraInstance from diagrams.onprem.iac import Terraform from diagrams.onprem.ci import Circleci from diagrams.onprem.container import Docker from diagrams.aws.storage import S3 with Diagram("Notejam Cloud Infrastructure", show=False, direction="LR"): ssl_certificate = ACM("SSL Cert") dns_name = Route53("DNS Domain") load_balancer = ELB("Load Balancer") with Cluster("VPC"): with Cluster("Public Network"): public_subnets = [ PublicSubnet("Subnet a"), PublicSubnet("Subnet b"), PublicSubnet("Subnet c"), ] nat_gateways = [ NATGateway("NAT Gateway a"), NATGateway("NAT Gateway b"), NATGateway("NAT Gateway c"), ] bastion_host = EC2("Bastion Host") with Cluster("Private Network"): private_subnets = [ PrivateSubnet("Subnet a"), PrivateSubnet("Subnet b"), PrivateSubnet("Subnet c"), ]
graph_attr={ "pencolor": "#60193C", "bgcolor": "#E587B5" }): # one cluster defined but with overwritten attributes Custom("Chassis", "./resources/ovn.png") Server("strix") with VirtualPrivateCloud(""): with PrivateSubnet("Private"): with SecurityGroup("web sg"): with AutoScalling(""): with EC2Contents("A"): d1 = Crio("Container") with ServerContents("A1"): d2 = Crio("Container") with PublicSubnet("Public"): with SecurityGroup("elb sg"): lb1 = ELB() with Region("chassis 5", graph_attr={ "pencolor": "#60193C", "bgcolor": "#E587B5" }): # one cluster defined but with overwritten attributes Custom("Chassis", "./resources/ovn.png") Server("otus") with VirtualPrivateCloud(""): with PrivateSubnet("Private"): with SecurityGroup("web sg"): with AutoScalling(""): with EC2Contents("A"): d3 = Crio("Container")
} node_attr = { "margin": "1000", "fontsize": "15", } with Diagram("VPC Public and Private Subnet", show=False, filename="VPC_public_Private", graph_attr=graph_attr, node_attr=node_attr): with Cluster("AWS"): with Cluster("VPC"): vpc = VPC('custom-vpc') out_inter = InternetAlt1('Internet') with Cluster("Public"): sub_public = PublicSubnet('Public Subnet') web = EC2("Bastion-Host") nat = NATGateway("NAT_Gateway") igw = InternetGateway('pubic-IGW') sub_public >> web out_inter >> igw >> sub_public >> nat with Cluster("Private"): sub_private = PrivateSubnet('Private Subnet') priv_ec2 = [EC2("app1"), EC2("app2")] out_inter >> igw >> sub_public >> nat >> priv_ec2 sub_private >> priv_ec2 web >> Edge(label='SSH') >> priv_ec2 vpc >> sub_public vpc >> sub_private User('TOM') >> web