from diagrams import Diagram
from diagrams.aws.compute import EC2
from diagrams.aws.database import RDS
from diagrams.aws.network import ELB

with Diagram("Grouped Workers", show=False, direction="TB"):
    ELB("lb") >> [EC2("worker1"),
                  EC2("worker2"),
                  EC2("worker3"),
                  EC2("worker4"),
                  EC2("worker5")] >> RDS("events")
from diagrams import Diagram, Cluster
from diagrams.aws.compute import ECS, EC2
from diagrams.aws.network import VPC, PublicSubnet
from diagrams.aws.compute import ECR
from diagrams.aws.security import IAMRole

with Diagram("AWS ECS Deployment", show=False, filename="aws_ecs_deployment_diagram"):
    with Cluster("AWS Cloud", ):
        with Cluster("VPC"):
            with Cluster("Availability Zone"):
                with Cluster("Public subnet"):
                    ecs_instance = EC2("ecs-instance")

        ecs_instance >> ECR("Elastic Container Registry") >> ECS("Elastic Container Services Cluster")
        ecs_repo = ECR("ecs-container-repo")
        ecs_role = IAMRole("ecs-task-role")

        ecs_instance - ecs_repo - ecs_role
from diagrams import Diagram, Cluster
from diagrams.aws.compute import EC2
from diagrams.aws.storage import S3
from diagrams.onprem.compute import Server
from diagrams.onprem.client import Users


with Diagram("MLOps System", show=False):
    with Cluster("AWS"):
        fargate = EC2("Fargate Container")
        s3 = S3("S3 Bucket")
        ec2 = EC2("EC2 Instance")
        with Cluster("ML Workflow"):
            processing = Server("Data Processing")
            training = Server("Model Training")
    
    users = Users("Users1")

    # Frontend Fargate container triggered by user action
    users >> fargate

    # Data upload to S3 bucket
    fargate >> s3

    # Data processing and training
    s3 >> processing >> training
    
    # Report data back to S3 bucket
    training >> s3