# dhruvmaradiya/aws-examples architecture

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

- Interactive diagram: https://gitdiagram.com/dhruvmaradiya/aws-examples
- Repository: https://github.com/dhruvmaradiya/aws-examples

## Overview

##### Project Type and Purpose
- This is an “AWS-Examples” mono-repository containing dozens of self-contained AWS service reference examples (S3, Lambda, API Gateway, CloudFormation patterns, CI/CD pipelines, etc.).
- Its purpose is to showcase infrastructure-as-code (IaC) and sample application code for AWS Certification study courses.

##### High-Level File Structure Analysis
- Top-level directories are named after AWS services or service families (e.g., “s3/…”, “lambda/…”, “cloudwatch/…”, “codepipeline/…”, “cfn/…”, etc.).
- IaC definitions (CloudFormation templates: `.yaml` / `.json`, SAM templates, Terraform files, CDK code)
- Sample application or helper scripts (Python, Ruby, JS, Java, Kotlin)
- `bin/` scripts for build/deploy/lint
- README or guide files
- Cross-cutting configs at root: devcontainer, GitHub Actions / Dependabot, Gitpod, `.gitignore`.

Treat the repo as a product that organizes and delivers AWS reference patterns to developers via version control and CI/CD.

a) Main Components
- Developers & Local IDE (VS Code with devcontainer / Gitpod)
- Source Code Repository (GitHub)
- CI/CD Orchestration (GitHub Actions, custom `bin/` scripts)
- IaC Engines (CloudFormation, AWS SAM, Terraform, CDK)
- AWS Cloud (Account(s) hosting deployed example stacks)
- Optional Local Emulators (LocalStack reference under `api/localstack`)

b) Relationships & Interactions
1. Developers clone the repo → build/test examples locally (via devcontainer, docker)
2. Commits pushed to GitHub → triggers CI pipelines (lint/build/deploy scripts under `bin/`)
3. CI invokes the appropriate IaC engine (SAM CLI, CloudFormation, Terraform, CDK) per example module
4. IaC engine provisions isolated stacks or resources in AWS (per service example)
5. Sample application code interacts with provisioned AWS services

c) Architectural Patterns & Principles
- Modularization: One folder per AWS service, each self-contained, enabling developers to pick and run isolated examples.
- Infrastructure-as-Code: Multi-tool approach—CloudFormation, AWS SAM, Terraform, CDK—demonstrating IaC best practices.
- CI/CD Integration: Uniform `bin/` scripts to build, lint, deploy each example.
- Developer Onboarding: devcontainer.json, Gitpod config for zero-touch environment setup.

d) Key Technologies & Frameworks
- Version Control: GitHub
- Containerized Dev Environment: VSCode devcontainer, Gitpod
- IaC Tools: AWS CloudFormation, AWS SAM, Terraform, AWS CDK
- Languages: Python, Ruby, JavaScript/Node.js, Java, Kotlin
- CI Scripting: Shell, Ruby/Bash helper scripts, SAM CLI, Terraform CLI

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Local Development Environment
    subgraph "Local Development Environment"
        Dev["Developer"]:::dev
        VSCode["VS Code DevContainer"]:::dev
        Gitpod["Gitpod Configuration"]:::dev
        Dev --> VSCode
        Dev --> Gitpod
    end

    %% Source Control & Configuration
    subgraph "Source Control & Config"
        Repo["GitHub Repository"]:::scm
        VSCode -.-> Repo
        Gitpod -.-> Repo
        readme["README.md"]:::scm
        gitignore[".gitignore"]:::scm
        dependabot[".github/dependabot.yml"]:::scm
        Repo --> readme
        Repo --> gitignore
        Repo --> dependabot
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        CI["GitHub Actions"]:::ci
        bin_aws["bin/aws_cli_install.sh"]:::ci
        bin_sam["bin/aws_sam_cli_install.sh"]:::ci
        bin_tf["bin/terraform_cli_install.sh"]:::ci
        CI --> bin_aws
        CI --> bin_sam
        CI --> bin_tf
    end

    %% IaC Engines & Templates
    subgraph "IaC Engines & Templates"
        CFN["CloudFormation"]:::iac
        SAM["AWS SAM"]:::iac
        Terraform["Terraform"]:::iac
        CDK["AWS CDK"]:::iac
    end

    %% Service Modules
    subgraph "Service Example Modules (in Repo)"
        CFNMod["CloudFormation Patterns"]:::module
        APIHTTP["API Gateway HTTP (SAM)"]:::module
        APIREST["API Gateway REST (SAM)"]:::module
        LmbCont["Lambda Container"]:::module
        LmbInline["Lambda Inline"]:::module
        LmbLayers["Lambda Layers"]:::module
        LmbRust["Lambda Rust"]:::module
        S3TF["S3 Terraform"]:::module
        S3CDK["S3 CDK"]:::module
        LocalEmu["LocalStack Emulator"]:::emu
    end

    %% AWS Cloud
    AWSCloud["AWS Cloud (Example Stacks)"]:::aws

    %% Relationships
    Dev -->|clone/push| Repo
    Repo -->|trigger| CI
    CI -->|invoke| CFN
    CI -->|invoke| SAM
    CI -->|invoke| Terraform
    CI -->|invoke| CDK

    CFN --> CFNMod
    SAM --> APIHTTP
    SAM --> APIREST
    SAM --> LmbCont
    SAM --> LmbInline
    SAM --> LmbLayers
    SAM --> LmbRust
    Terraform --> S3TF
    CDK --> S3CDK

    CFNMod --> AWSCloud
    APIHTTP --> AWSCloud
    APIREST --> AWSCloud
    LmbCont --> AWSCloud
    LmbInline --> AWSCloud
    LmbLayers --> AWSCloud
    LmbRust --> AWSCloud
    S3TF --> AWSCloud
    S3CDK --> AWSCloud

    Dev --> LocalEmu
    LocalEmu -->|emulate AWS| CFNMod

    %% Click Events
    click VSCode "https://github.com/dhruvmaradiya/aws-examples/blob/main/.devcontainer/devcontainer.json"
    click Gitpod "https://github.com/dhruvmaradiya/aws-examples/blob/main/.gitpod.yml"
    click readme "https://github.com/dhruvmaradiya/aws-examples/blob/main/README.md"
    click gitignore "https://github.com/dhruvmaradiya/aws-examples/blob/main/.gitignore"
    click dependabot "https://github.com/dhruvmaradiya/aws-examples/blob/main/.github/dependabot.yml"
    click bin_aws "https://github.com/dhruvmaradiya/aws-examples/blob/main/bin/aws_cli_install.sh"
    click bin_sam "https://github.com/dhruvmaradiya/aws-examples/blob/main/bin/aws_sam_cli_install.sh"
    click bin_tf "https://github.com/dhruvmaradiya/aws-examples/blob/main/bin/terraform_cli_install.sh"
    click CFNMod "https://github.com/dhruvmaradiya/aws-examples/tree/main/cfn/"
    click APIHTTP "https://github.com/dhruvmaradiya/aws-examples/blob/main/api-gateway/http/template.yml"
    click APIREST "https://github.com/dhruvmaradiya/aws-examples/blob/main/api-gateway/rest/template.yml"
    click LmbCont "https://github.com/dhruvmaradiya/aws-examples/blob/main/lambda/container/template.yml"
    click LmbInline "https://github.com/dhruvmaradiya/aws-examples/blob/main/lambda/inline/template.yml"
    click LmbLayers "https://github.com/dhruvmaradiya/aws-examples/blob/main/lambda/layers/template.yml"
    click LmbRust "https://github.com/dhruvmaradiya/aws-examples/blob/main/lambda/rust/Readme.md"
    click S3TF "https://github.com/dhruvmaradiya/aws-examples/blob/main/s3/iac/terraform/main.tf"
    click S3CDK "https://github.com/dhruvmaradiya/aws-examples/blob/main/s3/iac/cdk/bin/cdk.ts"
    click LocalEmu "https://github.com/dhruvmaradiya/aws-examples/blob/main/api/localstack/Readme.md"

    %% Styles
    classDef dev fill:#cce5ff,stroke:#004085,color:#004085
    classDef ci fill:#ffe5b4,stroke:#ff8c00,color:#ff8c00
    classDef scm fill:#e2e3e5,stroke:#6c757d,color:#6c757d
    classDef iac fill:#fff3cd,stroke:#856404,color:#856404
    classDef module fill:#d1ecf1,stroke:#0c5460,color:#0c5460
    classDef aws fill:#fff3cd,stroke:#856404,color:#856404
    classDef emu fill:#e2e3e5,stroke:#6c757d,color:#6c757d
```
