# aws-containers/ecsworkshop architecture

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

- Interactive diagram: https://gitdiagram.com/aws-containers/ecsworkshop
- Repository: https://github.com/aws-containers/ecsworkshop

## Overview

##### Main Components
- Content Source: The “content” directory holds all the Markdown files that represent the workshop’s lessons and documentation (e.g., advanced scheduling, blue/green deployments, microservices, networking). This is the primary data source for the website.
- Static Site Generator: Hugo is the core engine (configured via “config.toml” and deployed using “npm run server”) that processes Markdown content using layouts and templates (found in “layouts” and “themes”) into a static website.
- Frontend Assets: The “static” directory comprises CSS, JavaScript, and images used by the site. These assets are part of the final rendered pages.
- Build & Deployment Pipeline:
- Build Scripts: Files like “buildspec.yml” and “codebuild-deploy.sh” define the build and deploy process.
- CI/CD Pipeline: Auto-deployment is configured to trigger on commits to the main branch. The build server (AWS CodeBuild) picks up changes using the provided buildspec commands.
- Infrastructure as Code: The “terraform” folder holds .tf files that configure and provision AWS resources (such as CloudFront, S3, Route53, IAM roles, and even CodeBuild settings) necessary for hosting and serving the static site.
- Version Control: The git repository (with .gitignore, .gitmodules) manages the source code – including the site content, Hugo configuration, themes, node dependencies (package.json/package-lock.json), and infrastructure code.

##### Relationships and Data Flow
- Local Development: Developers clone the repository, initialize Hugo (and the submodule for themes), and install node packages. This is the starting point for making changes.
- Static Site Generation: Hugo processes content (Markdown files) using layouts and themes to produce HTML/CSS/JS files. The transformation process is an essential pipeline component.
- Continuous Integration and Delivery: Commits to the main branch trigger the CI/CD pipeline (as defined in buildspec.yml and executed via CodeBuild). This pipeline builds the static site, possibly runs tests (via “npm run test”), and then deploys the generated site.
- Deployment on AWS: Terraform scripts provision and configure AWS resources such as S3 (for hosting static assets), CloudFront (for content delivery and caching), and Route53 (for DNS). This ensures robust hosting and global distribution.

##### Architectural Patterns and Technologies
- Static Site Architecture: Emphasize the separation between content (Markdown) and presentation (layouts/themes). The build process translates sources into a production-ready website.
- CI/CD Pipeline: Clearly show the automated build and deployment triggered on code repos, highlighting AWS CodeBuild integration.
- Infrastructure as Code: Use Terraform to manage the resource provisioning on AWS. This includes the use of modules or multiple .tf files to separate concerns (e.g., networking, IAM, CloudFront configurations).
- Tools and Technologies: Include Hugo, NodeJS (npm scripts), AWS services (S3, CloudFront, Route53, CodeBuild), Terraform, and Git for version control and collaboration.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Environment
    DEV["Developer Environment"]:::development

    %% Source & Content Layer
    subgraph "Source & Content"
        GIT["Git Repository"]:::development
        CC["Content Directory (Markdown)"]:::development
        CONFIG["config.toml"]:::development
        LAYOUTS["layouts Directory"]:::development
        THEMES["themes/learn Directory"]:::development
        STATIC["Frontend Assets (static)"]:::development
        VC1[".gitignore"]:::development
        VC2[".gitmodules"]:::development
    end

    %% Build & Deployment Layer
    subgraph "Build & Deployment"
        CI["CI/CD Pipeline (CodeBuild)"]:::deployment
        NPM["NodeJS Tools (npm)"]:::deployment
        HS["Static Site Generation (Hugo)"]:::deployment
        %% Build Scripts sub-group
        subgraph "Build Scripts"
            BS1["buildspec.yml"]:::deployment
            BS2["buildspec-fullcycle.yml"]:::deployment
            BS3["codebuild-deploy.sh"]:::deployment
        end
    end

    %% Deployment & Infrastructure Layer
    subgraph "Deployment & Infrastructure"
        TF["Terraform Infrastructure"]:::production
        AWS["AWS Deployment (S3, CloudFront, Route53)"]:::production
    end

    %% Relationships - Data Flow
    DEV --> DEVgit[GIT]
    DEV --> NPM
    DEV --> HS
    GIT -->|"contains"| CC
    GIT -->|"contains"| CONFIG
    GIT -->|"contains"| LAYOUTS
    GIT -->|"contains"| THEMES
    GIT -->|"contains"| STATIC
    GIT -->|"contains"| VC1
    GIT -->|"contains"| VC2
    GIT -->|commits trigger| CI
    CI --> BS1
    CI --> BS2
    CI --> BS3
    BS1 --> HS
    BS2 --> HS
    BS3 --> HS
    HS --> AWS
    TF --> AWS
    CI --> TF

    %% Styles
    classDef development fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef deployment fill:#90ee90,stroke:#000,stroke-width:2px;
    classDef production fill:#ffcc99,stroke:#000,stroke-width:2px;

    %% Click Events
    click CC "https://github.com/aws-containers/ecsworkshop/tree/main/content"
    click CONFIG "https://github.com/aws-containers/ecsworkshop/blob/main/config.toml"
    click LAYOUTS "https://github.com/aws-containers/ecsworkshop/tree/main/layouts"
    click THEMES "https://github.com/aws-containers/ecsworkshop/tree/main/themes/learn"
    click STATIC "https://github.com/aws-containers/ecsworkshop/tree/main/static"
    click BS1 "https://github.com/aws-containers/ecsworkshop/blob/main/buildspec.yml"
    click BS2 "https://github.com/aws-containers/ecsworkshop/blob/main/buildspec-fullcycle.yml"
    click BS3 "https://github.com/aws-containers/ecsworkshop/blob/main/codebuild-deploy.sh"
    click TF "https://github.com/aws-containers/ecsworkshop/tree/main/terraform"
    click VC1 "https://github.com/aws-containers/ecsworkshop/blob/main/.gitignore"
    click VC2 "https://github.com/aws-containers/ecsworkshop/blob/main/.gitmodules"
```
