# ipspace/pubcloud architecture

> Architecture diagram of the GitHub repository ipspace/pubcloud, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ipspace/pubcloud
- Repository: https://github.com/ipspace/pubcloud

## Overview

##### Project type and purpose
- This repository is an *infrastructure-as-code* sample library for demonstrating public-cloud networking. It is not a traditional full-stack app but a set of Terraform modules, Ansible playbooks, CLI/PowerShell/Bash scripts and CloudFormation/ARM templates targeting AWS and Azure networks.

##### File structure
- Top-level components:
- AWS/ – advanced AWS networking scenarios (IP multicast, VPC peering, WAF, NLB, Transit Gateway)
- Azure/ – Azure networking scenarios (route server, virtual WAN with multiple test-beds)
- Deployment/ – “consumers” of those modules: step-by-step AWS & Azure deployments via Terraform, Ansible, CLI, CloudFormation/ARM
- install/ & Vagrantfile – scripts and Vagrant to spin up a local Ubuntu dev VM
- Under each cloud directory you see a typical Terraform module layout (modules/* with compute/network/… tf files), scenario definitions, and in Deployment you see playbooks (Ansible tasks/steps), CLI scripts, and IaC templates.

##### README for additional insights
- The README confirms these are *provisioning & automation examples* for public-cloud networking courses and demos.
- No pre-drawn architecture; we must illustrate how pieces fit.

1. Developer Environment
- Vagrant VM
- install/ scripts
2. Code Repository
- AWS examples (IP-multicast, VPC-peering, WAF, NLB, TGW)
- Azure examples (route-server, virtual-wan)
- Deployment orchestrators (Terraform, Ansible, CLI, CloudFormation/ARM)
3. Provisioning Engines
- Terraform CLI
- Ansible Engine
- AWS CLI & Azure CLI scripts
- CloudFormation & Azure Resource Manager
4. Target Clouds
- AWS account(s)
- Azure subscription(s)
- From Developer Environment → Code Repository (git pull / edit)
- Developer runs Provisioning Engines locally (Terraform, Ansible, CLI) against code in repo
- Provisioning Engines call Cloud Provider APIs
- Cloud Provider APIs create/modify Networking resources in AWS/Azure
c. Architectural patterns & design principles:
- *Modular IaC*: reusable modules for compute, network, peering, WAF, transit
- *Separation of concerns*: cloud-agnostic orchestration (Deployment/) separated from cloud-specific modules (AWS/, Azure/)
- *Layered approach*: root configurations delegate to nested modules, testbed scenarios invoke common modules
d. Key technologies/frameworks:
- Terraform (HCL modules, variables, outputs)
- Ansible playbooks & inventory
- AWS CloudFormation / Azure Resource Manager templates
- Bash/PowerShell + AWS CLI / Azure CLI

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Environment
    subgraph "Developer Environment"
        DE_VM("Vagrant VM"):::devEnv
        DE_Install("install/ scripts"):::devEnv
    end

    %% Code Repository
    subgraph "Code Repository"
        subgraph "AWS Modules"
            AWS_IM("IP-multicast"):::aws
            AWS_VPC("VPC-peering"):::aws
            AWS_WAF("WAF"):::aws
            AWS_NLB("Network Load Balancer"):::aws
            AWS_TGW("Transit Gateway"):::aws
        end
        subgraph "Azure Modules"
            AZ_RS("Route Server"):::azure
            AZ_VWAN("Virtual WAN"):::azure
        end
        subgraph "Deployment Orchestrators"
            subgraph "AWS Deployment"
                DEP_A_ANS("Ansible Playbooks"):::deploy
                DEP_A_CLI("AWS CLI Scripts"):::deploy
                DEP_A_CF("CloudFormation Templates"):::deploy
                DEP_A_TF("Terraform Configs"):::deploy
            end
            subgraph "Azure Deployment"
                DEP_Z_ANS("Ansible Playbooks"):::deploy
                DEP_Z_CLI("Azure CLI Scripts"):::deploy
                DEP_Z_ARM("ARM Templates"):::deploy
                DEP_Z_TF("Terraform Configs"):::deploy
            end
            DEP_VM("VM Provisioning"):::deploy
        end
    end

    %% Provisioning Engines
    subgraph "Provisioning Engines"
        ENG_TF("Terraform CLI"):::tool
        ENG_ANS("Ansible Engine"):::tool
        ENG_CLI("AWS/Azure CLI"):::tool
        ENG_CFARM("CloudFormation & ARM"):::tool
    end

    %% Target Clouds
    subgraph "Target Clouds"
        AWS_Cloud("AWS Accounts"):::cloud
        AZ_Cloud("Azure Subscriptions"):::cloud
    end

    %% Connections
    DE_VM -->|"provisions/dev sandbox"| DE_Install
    DE_Install -->|"configures"| DE_VM
    DE_VM -->|"git pull/edit"| AWS_IM
    DE_VM -->|"git pull/edit"| AZ_RS
    AWS_IM -->|"in repo"| ENG_TF
    AWS_VPC -->|"in repo"| ENG_TF
    AWS_WAF -->|"in repo"| ENG_TF
    AWS_NLB -->|"in repo"| ENG_TF
    AWS_TGW -->|"in repo"| ENG_TF
    AZ_RS -->|"in repo"| ENG_TF
    AZ_VWAN -->|"in repo"| ENG_TF

    DEP_A_ANS -->|"uses modules"| AWS_IM
    DEP_A_ANS -->|"uses modules"| AWS_VPC
    DEP_A_CLI -->|"uses modules"| AWS_TGW
    DEP_A_CF -->|"uses modules"| AWS_WAF
    DEP_A_TF -->|"uses modules"| AWS_NLB

    DEP_Z_ANS -->|"uses modules"| AZ_RS
    DEP_Z_ARM -->|"uses modules"| AZ_VWAN
    DEP_Z_TF -->|"uses modules"| AZ_VWAN

    ENG_TF -->|"calls API"| AWS_Cloud
    ENG_TF -->|"calls API"| AZ_Cloud
    ENG_ANS -->|"executes playbooks"| AWS_Cloud
    ENG_ANS -->|"executes playbooks"| AZ_Cloud
    ENG_CLI -->|"runs scripts"| AWS_Cloud
    ENG_CLI -->|"runs scripts"| AZ_Cloud
    ENG_CFARM -->|"deploys templates"| AWS_Cloud
    ENG_CFARM -->|"deploys templates"| AZ_Cloud

    %% Click Events - Developer Environment
    click DE_VM "https://github.com/ipspace/pubcloud/tree/master/Vagrantfile"
    click DE_Install "https://github.com/ipspace/pubcloud/tree/master/install/"

    %% Click Events - AWS Modules
    click AWS_IM "https://github.com/ipspace/pubcloud/tree/master/AWS/IP-multicast/"
    click AWS_VPC "https://github.com/ipspace/pubcloud/tree/master/AWS/VPC-peering/"
    click AWS_WAF "https://github.com/ipspace/pubcloud/tree/master/AWS/WAF/"
    click AWS_NLB "https://github.com/ipspace/pubcloud/tree/master/AWS/network-load-balancer/"
    click AWS_TGW "https://github.com/ipspace/pubcloud/tree/master/AWS/transit-gateway/"

    %% Click Events - Azure Modules
    click AZ_RS "https://github.com/ipspace/pubcloud/tree/master/Azure/route-server/"
    click AZ_VWAN "https://github.com/ipspace/pubcloud/tree/master/Azure/virtual-wan/"

    %% Click Events - AWS Deployment
    click DEP_A_ANS "https://github.com/ipspace/pubcloud/tree/master/Deployment/AWS/Ansible/"
    click DEP_A_CLI "https://github.com/ipspace/pubcloud/tree/master/Deployment/AWS/CLI/steps/"
    click DEP_A_CF "https://github.com/ipspace/pubcloud/tree/master/Deployment/AWS/CloudFormation/"
    click DEP_A_TF "https://github.com/ipspace/pubcloud/tree/master/Deployment/AWS/Terraform/"

    %% Click Events - Azure Deployment
    click DEP_Z_ANS "https://github.com/ipspace/pubcloud/tree/master/Deployment/Azure/Ansible/"
    click DEP_Z_CLI "https://github.com/ipspace/pubcloud/tree/master/Deployment/Azure/CLI/"
    click DEP_Z_ARM "https://github.com/ipspace/pubcloud/tree/master/Deployment/Azure/ResourceManager/"
    click DEP_Z_TF "https://github.com/ipspace/pubcloud/tree/master/Deployment/Azure/Terraform/"

    %% Click Events - VM Provisioning
    click DEP_VM "https://github.com/ipspace/pubcloud/tree/master/Deployment/VM-Provisioning/"

    %% Styles
    classDef devEnv fill:#D3D3D3,stroke:#333,stroke-width:1px;
    classDef aws fill:#ADD8E6,stroke:#333,stroke-width:1px;
    classDef azure fill:#D8BFD8,stroke:#333,stroke-width:1px;
    classDef deploy fill:#90EE90,stroke:#333,stroke-width:1px;
    classDef tool fill:#FFA500,stroke:#333,stroke-width:1px;
    classDef cloud fill:#AEC6CF,stroke:#333,stroke-width:1px;
```
