# rams3sh/aaia architecture

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

- Interactive diagram: https://gitdiagram.com/rams3sh/aaia
- Repository: https://github.com/rams3sh/aaia

## Overview

Key Components to Include:

##### Data Collection Layer
- AWS Collector Component (Aaia_aws_collector.sh)
- Connections to AWS Services (IAM and Organizations)
- Offline data storage component

##### Core Processing Layer
- Main Aaia Application (Aaia.py)
- Data Loading Module
- Module System
- AWS Common Library

##### Storage Layer
- Neo4j Database
- Graph Data Model

##### Integration Layer
- AWS API Interactions
- Neo4j Database Connections

- Collection layer below
- Processing layer in the middle

##### Component Representation

a. External Services (Top):

b. Collection Layer:
- JSON data flow to offline_data storage
- AWS credentials configuration

c. Core Processing Layer (Center):
- Main Aaia.py controller
- Load Data Module (actions/aws/load_data)
- Clean DB Module (actions/aws/clean_db)
- Custom Modules System (modules/aws)
- Aws_common.py library as a shared component

d. Storage Layer (Bottom):
- Neo4j Database container
- Bolt connection (port 7687)
- Web interface connection (port 7474)

##### Important Details
- Configuration file relationship (Aaia.conf)
- Module extension points
- Data flow direction
- API endpoints and ports

Special Considerations:

##### Modular nature
- How custom modules can be added
- Extension points in the architecture

##### Data Flow Patterns
- AWS → Collector → Offline Storage → Loader → Neo4j
- Module System → Neo4j (for queries)

##### Security Components
- AWS Authentication
- Neo4j Authentication
- Configuration Management

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph AWS["AWS Cloud Services"]
        IAM["IAM Service"]
        ORG["Organizations Service"]
    end

    subgraph Collection["Data Collection Layer"]
        COLLECTOR["AWS Collector"]:::collector
        OFFLINE["Offline Storage"]:::storage
        CONFIG["Configuration"]:::config
    end

    subgraph Processing["Core Processing Layer"]
        MAIN["Main Controller"]:::main
        
        subgraph Actions["Actions System"]
            ACTIONS_MAIN["Actions Controller"]:::actions
            
            subgraph LoadData["Data Loading"]
                LOAD_MAIN["Load Main"]:::loader
                LOAD_IAM["IAM Loader"]:::loader
                LOAD_ORG["Organizations Loader"]:::loader
            end
            
            subgraph CleanDB["Database Cleaning"]
                CLEAN_MAIN["Clean Main"]:::cleaner
                CLEAN_IMPL["Clean Implementation"]:::cleaner
            end
        end
        
        subgraph Modules["Module System"]
            MOD_MAIN["Module Controller"]:::module
            MOD_AUDIT["Sample Audit Module"]:::module
        end
        
        AWS_COMMON["AWS Common Library"]:::common
    end

    subgraph Storage["Storage Layer"]
        NEO4J[(Neo4j DB)]:::database
        NEO4J_WEB["Neo4j Web Interface<br/>:7474"]:::interface
    end

    %% Connections
    IAM & ORG --> COLLECTOR
    COLLECTOR --> OFFLINE
    CONFIG --> MAIN
    OFFLINE --> LOAD_MAIN
    
    MAIN --> ACTIONS_MAIN
    MAIN --> MOD_MAIN
    
    ACTIONS_MAIN --> LoadData
    ACTIONS_MAIN --> CleanDB
    
    LOAD_MAIN --> LOAD_IAM & LOAD_ORG
    CLEAN_MAIN --> CLEAN_IMPL
    
    LoadData --> NEO4J
    CleanDB --> NEO4J
    Modules --> NEO4J
    
    NEO4J --- NEO4J_WEB
    
    AWS_COMMON -.- MAIN
    AWS_COMMON -.- Actions
    AWS_COMMON -.- Modules

    %% Click Events
    click COLLECTOR "https://github.com/rams3sh/Aaia/blob/master/Aaia/Aaia_aws_collector.sh"
    click MAIN "https://github.com/rams3sh/Aaia/blob/master/Aaia/Aaia.py"
    click CONFIG "https://github.com/rams3sh/Aaia/blob/master/Aaia/Aaia.conf"
    click LOAD_MAIN "https://github.com/rams3sh/Aaia/blob/master/Aaia/actions/aws/load_data/main.py"
    click LOAD_IAM "https://github.com/rams3sh/Aaia/blob/master/Aaia/actions/aws/load_data/iam.py"
    click LOAD_ORG "https://github.com/rams3sh/Aaia/blob/master/Aaia/actions/aws/load_data/organizations.py"
    click CLEAN_MAIN "https://github.com/rams3sh/Aaia/blob/master/Aaia/actions/aws/clean_db/main.py"
    click CLEAN_IMPL "https://github.com/rams3sh/Aaia/blob/master/Aaia/actions/aws/clean_db/clean.py"
    click AWS_COMMON "https://github.com/rams3sh/Aaia/blob/master/Aaia/lib/aws_common.py"
    click MOD_MAIN "https://github.com/rams3sh/Aaia/blob/master/Aaia/modules/aws/main.py"
    click MOD_AUDIT "https://github.com/rams3sh/Aaia/blob/master/Aaia/modules/aws/iam_sample_audit.py"
    click ACTIONS_MAIN "https://github.com/rams3sh/Aaia/blob/master/Aaia/actions/aws/main.py"

    %% Styles
    classDef aws fill:#2196F3,stroke:#1565C0,color:white
    classDef collector fill:#4CAF50,stroke:#388E3C,color:white
    classDef storage fill:#FFA726,stroke:#F57C00,color:white
    classDef config fill:#90A4AE,stroke:#607D8B,color:white
    classDef main fill:#E91E63,stroke:#C2185B,color:white
    classDef actions fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef loader fill:#00BCD4,stroke:#0097A7,color:white
    classDef cleaner fill:#FF5722,stroke:#E64A19,color:white
    classDef module fill:#8BC34A,stroke:#689F38,color:white
    classDef common fill:#757575,stroke:#616161,color:white
    classDef database fill:#F44336,stroke:#D32F2F,color:white
    classDef interface fill:#3F51B5,stroke:#303F9F,color:white

    class IAM,ORG aws
    class COLLECTOR collector
    class OFFLINE storage
    class CONFIG config
    class MAIN main
    class ACTIONS_MAIN actions
    class LOAD_MAIN,LOAD_IAM,LOAD_ORG loader
    class CLEAN_MAIN,CLEAN_IMPL cleaner
    class MOD_MAIN,MOD_AUDIT module
    class AWS_COMMON common
    class NEO4J database
    class NEO4J_WEB interface
```
