# ebellavance/aws-cdk-examples architecture

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

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

## Overview

##### Project Type Analysis
This is an Infrastructure as Code (IaC) project using AWS CDK in TypeScript, specifically focused on deploying a static website with associated DNS and certificate management capabilities.

##### Main Components

A. Infrastructure Layer:
- AWS CDK Stack (WebsiteStack)
- Cross-account DNS management
- Certificate validation
- Static website hosting infrastructure

B. Code Organization:
- Infrastructure definition
- Lambda functions
- Static content
- Configuration

**┌─────────────────────────────────────────────┐**
- CDK Application                │
- ┘

- ┌───────────┴───────────┐
- ▼                       ▼
**┌───────────────┐      ┌───────────────┐**
- WebsiteStack  │      │  DNS Functions │
- ┘      └───────────────┘

**┌─────────────────────────────────────────────────────┐**
- AWS Cloud                         │
- ┌─────────────┐    ┌──────────┐    ┌──────────┐   │
- S3 Bucket │    │CloudFront│    │   ACM    │   │
- (Static Site)│◄───│          │◄───│Certificate│   │
- ┘    └──────────┘    └──────────┘   │
- ▲                                ▲         │

- ┌──────────┐                    ┌──────────┐    │
- Route53 │                    │  Lambda  │    │
- DNS    │◄───────────────────│Functions │    │
- ┘                    └──────────┘    │
- ┘

##### Important Elements to Highlight

a. Infrastructure Components:
- S3 Bucket for static website hosting
- CloudFront distribution
- ACM Certificate
- Route53 DNS records
- Lambda functions for cross-account DNS management

b. Control Flow:
- Deployment flow from CDK code to AWS resources
- DNS validation flow
- Content delivery path

##### Relationships to Emphasize
- Cross-account DNS management
- Certificate validation process
- Static content deployment pipeline
- CDK stack dependencies

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "CDK Application"
        Main["Main Application Entry"]
        Config["Infrastructure Configuration"]
        Models["Infrastructure Models"]
        Stack["Website Stack"]
    end

    subgraph "AWS Cloud Infrastructure"
        subgraph "DNS Management"
            Route53["Route53 DNS"]
            CrossAccountLambda["Cross-Account DNS Lambda"]
            CertValidationLambda["DNS Certificate Validation Lambda"]
        end

        subgraph "Content Delivery"
            S3["S3 Bucket<br/>(Static Site)"]
            CF["CloudFront Distribution"]
            ACM["ACM Certificate"]
        end

        subgraph "Static Content"
            WebContent["Static Website Content"]
        end
    end

    Main --> Stack
    Config --> Stack
    Models --> Stack
    Stack --> S3
    Stack --> CF
    Stack --> ACM
    Stack --> Route53
    Stack --> CrossAccountLambda
    Stack --> CertValidationLambda
    
    CF --> S3
    ACM --> CF
    WebContent --> S3
    
    CrossAccountLambda --> Route53
    CertValidationLambda --> Route53
    CertValidationLambda --> ACM

    %% Click events for component mapping
    click Stack "https://github.com/ebellavance/aws-cdk-examples/blob/main/src/infra/stacks/WebsiteStack.ts"
    click Config "https://github.com/ebellavance/aws-cdk-examples/blob/main/src/infra/constants.ts"
    click Models "https://github.com/ebellavance/aws-cdk-examples/blob/main/src/infra/model.ts"
    click Main "https://github.com/ebellavance/aws-cdk-examples/blob/main/src/infra/main.ts"
    click CrossAccountLambda "https://github.com/ebellavance/aws-cdk-examples/blob/main/src/functions/crossaccountdnsrecords.ts"
    click CertValidationLambda "https://github.com/ebellavance/aws-cdk-examples/blob/main/src/functions/dnscertificatevalidation.ts"
    click WebContent "https://github.com/ebellavance/aws-cdk-examples/blob/main/src/dist/index.html"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef lambda fill:#ff9900,stroke:#333,stroke-width:2px
    classDef aws fill:#232F3E,stroke:#333,stroke-width:2px,color:white
    classDef content fill:#87CF3E,stroke:#333,stroke-width:2px
    classDef cdk fill:#147EBA,stroke:#333,stroke-width:2px,color:white

    class CrossAccountLambda,CertValidationLambda lambda
    class S3,CF,ACM,Route53 aws
    class WebContent content
    class Main,Config,Models,Stack cdk
```
