# joosangkim/aws-sam architecture

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

- Interactive diagram: https://gitdiagram.com/joosangkim/aws-sam
- Repository: https://github.com/joosangkim/aws-sam

## Overview

##### Main Components

a) AWS Components:
- AWS Lambda Functions
- CloudFront Distribution
- API Gateway (implied by the Lambda setup)
- IAM Roles and Permissions

b) Application Components:
- Distribution Module
- Invalidation Module
- Events Handler
- Configuration Management

**Client/Trigger → API Gateway → Lambda Functions → CloudFront**

##### Specific Elements

- Blue: AWS Services (Lambda, CloudFront)
- Green: Application Modules
- Yellow: Configuration Files
- Gray: Event Triggers

b) Flow Directions:

##### Implementation Details

Tier 1 - External Interface:
**[API Gateway] → [Lambda Function Container]**

Tier 2 - Lambda Functions:
**[Distribution Function] ↔ [Invalidation Function]**

Tier 3 - Internal Components:
**[distributions.py] [invalidation.py]**
- ↑                    ↑
**[environments.json]  [events.json]**

Deployment process:
**[Local Development] → [SAM CLI] → [AWS Cloud]**

Remember to include:
- Error handling flows
- Configuration management
- Local development setup
- Deployment pipeline

This will give a comprehensive view of both the runtime architecture and the development/deployment process.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "External Interface"
        API[API Gateway]
        CF[CloudFront Distribution]
    end

    subgraph "Lambda Functions"
        LF[Lambda Function Container]
        DF["Distribution Function"]
        IF["Invalidation Function"]
    end

    subgraph "Application Layer"
        DM["Distribution Module"]
        IM["Invalidation Module"]
        EP["Entry Point"]
    end

    subgraph "Configuration Layer"
        EJ1["Distribution Events"]
        EJ2["Invalidation Events"]
        ENV["Environment Config"]
        TEMP["Infrastructure Template"]
        DEP["Deployment Config"]
        REQ["Dependencies"]
    end

    %% Connections
    API --> LF
    LF --> DF & IF
    DF & IF --> CF
    DF --> DM
    IF --> IM
    DM & IM --> EP
    EJ1 -.-> DF
    EJ2 -.-> IF
    ENV -.-> DF & IF
    TEMP -.-> LF
    DEP -.-> LF
    REQ -.-> EP

    %% Click Events
    click DM "https://github.com/joosangkim/aws-sam/blob/dev/devops/app/distributions.py"
    click IM "https://github.com/joosangkim/aws-sam/blob/dev/devops/app/invalidation.py"
    click EJ1 "https://github.com/joosangkim/aws-sam/blob/dev/devops/events/distribution/events.json"
    click EJ2 "https://github.com/joosangkim/aws-sam/blob/dev/devops/events/invalidation/events.json"
    click ENV "https://github.com/joosangkim/aws-sam/blob/dev/devops/events/distribution/environments.json"
    click TEMP "https://github.com/joosangkim/aws-sam/blob/dev/devops/template.yaml"
    click EP "https://github.com/joosangkim/aws-sam/blob/dev/devops/main.py"
    click DEP "https://github.com/joosangkim/aws-sam/blob/dev/devops/samconfig.toml.sample"
    click REQ "https://github.com/joosangkim/aws-sam/blob/dev/devops/requirements.txt"

    %% Styling
    classDef aws fill:#FF9900,stroke:#232F3E,stroke-width:2px
    classDef module fill:#81B1DB,stroke:#2C3E50,stroke-width:2px
    classDef config fill:#FFE873,stroke:#B58900,stroke-width:2px
    classDef entry fill:#85B09A,stroke:#2C3E50,stroke-width:2px

    class API,CF,LF aws
    class DM,IM module
    class EJ1,EJ2,ENV,TEMP,DEP,REQ config
    class EP entry

    %% Legend
    subgraph Legend
        AWS[AWS Services]:::aws
        MOD[Application Modules]:::module
        CONF[Configuration Files]:::config
        ENT[Entry Points]:::entry
        FLOW["--> Direct Flow"]
        CONF_FLOW["-.-> Config Dependency"]
    end
```
