AWS

Deployment Pipeline

#!/usr/bin/env python3

from diagrams import Diagram, Cluster
from diagrams.aws.compute import EC2

with Diagram("Deployment", show=False, direction="TB") as diag:
    with Cluster("Github"):
        EC2("Github Actions") >> EC2("Build Image") >> EC2("Push to ECR") >> EC2("Helm Chart") >> EC2("Add Secrets") >> EC2("Deploy to EKS Cluster")

diag
Warning: node 'cb4b822c6bd24c8f906e3a3596ce2f6b', graph 'Deployment' size too small for label
../_images/aws_2_1.png

Cloud Infrastructure

#!/usr/bin/env python

from diagrams import Cluster, Diagram
from diagrams.aws.database import RDS, ElastiCache
from diagrams.aws.network import ELB, Route53
from diagrams.aws.compute import EC2, ElasticKubernetesService
from diagrams.saas.cdn import Cloudflare


with Diagram("opsZero Architecture", show=False) as diag:
    dns = Cloudflare("Cloudflare DNS")

    with Cluster("VPC"):
        with Cluster("Public Subnet"):
            lb = ELB("NLB")

            bastion = EC2("Bastion")

        with Cluster("Private Subnet"):
            with Cluster("EKS"):
                eks = ElasticKubernetesService("EKS")
                with Cluster("Node Groups"):
                    svc_group = [
                        EC2("nodes (nodegroup)"),
                        EC2("nodes (karpenter)"),
                        EC2("nodes (ASG)")
                    ]

            with Cluster("RDS"):
                db_master = RDS("Leader")
                db_follower = RDS("Follower")
                db_master - [db_follower]

            redis = ElastiCache("Redis")

    

    dns >> lb >> eks >> svc_group
    bastion >> db_follower
    svc_group >> db_master
    svc_group >> redis

diag
Warning: node 'd4a30e5f7b994cdba4d0ba571f8b7965', graph 'opsZero Architecture' size too small for label
Warning: node '7e5a48c5326140039d28445f667f6375', graph 'opsZero Architecture' size too small for label
../_images/aws_5_1.png

Kubernetes

#!/usr/bin/env python

from diagrams import Cluster, Diagram
from diagrams.k8s.clusterconfig import HPA
from diagrams.k8s.compute import Deployment, Pod, ReplicaSet, Cronjob
from diagrams.k8s.network import Ingress, Service

with Diagram("EKS Nodes", show=False) as diag:
    with Cluster("EKS Nodes"):
        net = Ingress("EKS") >> Service("Nginx (NLB)") >> Deployment("Nginx Controller (HPA)")

        with Cluster("App (Helm)"):
            net >> Service("App (ClusterIP)") >> [
                Deployment("App (HPA)"),
            ]
            Cronjob("App")

diag
Warning: node 'db3e85bf4cb54000b71897573cf01df5', graph 'EKS Nodes' size too small for label
../_images/aws_7_1.png