# non-97/aws-cdk-alb-cognito-okta-saml-authentication architecture

> Architecture diagram of the GitHub repository non-97/aws-cdk-alb-cognito-okta-saml-authentication, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/non-97/aws-cdk-alb-cognito-okta-saml-authentication
- Repository: https://github.com/non-97/aws-cdk-alb-cognito-okta-saml-authentication

## Overview

##### Project type and purpose
- This is an AWS CDK (Cloud Development Kit) project written in TypeScript. Its purpose is to define and deploy a set of AWS infrastructure resources (VPC, ALB, AutoScaling Group, Certificate, Hosted Zone, SAML authentication) via IaC (Infrastructure as Code).

##### File structure
- bin/saml-app.ts: Entry point that loads the CDK app and instantiates the stack.
- lib/saml-app-stack.ts: Top-level CDK Stack that orchestrates all constructs.
- lib/construct/*: Each file here is a reusable “construct” encapsulating one AWS resource or related group:
- network-construct.ts → VPC, subnets, route tables
- alb-construct.ts → Application Load Balancer & listeners
- asg-construct.ts → EC2 Auto Scaling Group
- certificate-construct.ts → ACM Certificate
- hosted-zone-construct.ts → Route 53 Hosted Zone
- saml-auth-construct.ts → SAML Identity Provider integration
- lib/ec2-settings/user-data/default.sh: EC2 bootstrap script for instances in the ASG.
- parameter/index.ts: Parameter definitions (e.g., domain names, certificate ARNs).
- test/saml-app.test.ts: Unit tests validating your CDK constructs.

##### README
- Confirms this is a blank CDK TypeScript starter, runnable with `npm run build`, `cdk deploy`, etc.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Client and DNS
    Client["Client"]:::external
    Route53DNS["Route 53 DNS\n(Hosted Zone)"]:::dns
    click Route53DNS "https://github.com/non-97/aws-cdk-alb-cognito-okta-saml-authentication/blob/main/lib/construct/hosted-zone-construct.ts"
    Client -->|resolves| Route53DNS

    %% Application Load Balancer and SAML IdP
    ALB["Application Load Balancer"]:::alb
    click ALB "https://github.com/non-97/aws-cdk-alb-cognito-okta-saml-authentication/blob/main/lib/construct/alb-construct.ts"
    Route53DNS -->|HTTPS| ALB

    subgraph "SAML Identity Provider (External)"
      SAML["SAML Identity Provider"]:::external
      click SAML "https://github.com/non-97/aws-cdk-alb-cognito-okta-saml-authentication/blob/main/lib/construct/saml-auth-construct.ts"
    end
    ALB -->|authentication request| SAML

    %% CDK Stack Boundary
    subgraph "CDK Stack"
      direction TB

      %% VPC and Subnets
      subgraph "VPC\n(lib/construct/network-construct.ts)" 
        VPC_NW["VPC"]:::network
        click VPC_NW "https://github.com/non-97/aws-cdk-alb-cognito-okta-saml-authentication/blob/main/lib/construct/network-construct.ts"

        subgraph "Public Subnets"
          ALB
        end

        subgraph "Private Subnets"
          ASG["Auto Scaling Group\n(EC2 Instances)"]:::compute
          click ASG "https://github.com/non-97/aws-cdk-alb-cognito-okta-saml-authentication/blob/main/lib/construct/asg-construct.ts"
          UD["User-Data Script\ndefault.sh"]:::script
          click UD "https://github.com/non-97/aws-cdk-alb-cognito-okta-saml-authentication/blob/main/lib/ec2-settings/user-data/default.sh"
        end
      end

      %% Certificate and Parameters
      Cert["ACM Certificate"]:::cert
      click Cert "https://github.com/non-97/aws-cdk-alb-cognito-okta-saml-authentication/blob/main/lib/construct/certificate-construct.ts"
      Param["Parameter Definitions"]:::param
      click Param "https://github.com/non-97/aws-cdk-alb-cognito-okta-saml-authentication/blob/main/parameter/index.ts"
    end

    %% Connections inside CDK Stack
    ALB -->|forwards to| ASG
    ALB -->|uses cert| Cert

    %% CDK App Entry and Tests
    CDKApp["CDK App Entry Point\n(bin/saml-app.ts)"]:::code
    click CDKApp "https://github.com/non-97/aws-cdk-alb-cognito-okta-saml-authentication/blob/main/bin/saml-app.ts"
    Stack["CDK Stack Orchestration\n(lib/saml-app-stack.ts)"]:::code
    click Stack "https://github.com/non-97/aws-cdk-alb-cognito-okta-saml-authentication/blob/main/lib/saml-app-stack.ts"
    Test["Unit Tests\n(test/saml-app.test.ts)"]:::code
    click Test "https://github.com/non-97/aws-cdk-alb-cognito-okta-saml-authentication/blob/main/test/saml-app.test.ts"

    CDKApp --> Stack
    Stack --> VPC_NW

    %% Styling
    classDef network fill:#e0f7fa,stroke:#0288d1,color:#01579b;
    classDef alb fill:#e8f5e9,stroke:#43a047,color:#1b5e20;
    classDef compute fill:#c8e6c9,stroke:#2e7d32,color:#1b5e20;
    classDef cert fill:#fff9c4,stroke:#f9a825,color:#f57f17;
    classDef dns fill:#e1bee7,stroke:#8e24aa,color:#4a148c;
    classDef script fill:#ffecb3,stroke:#fbc02d,color:#f57f17;
    classDef param fill:#f3e5f5,stroke:#6a1b9a,color:#4a148c;
    classDef code fill:#cfd8dc,stroke:#546e7a,color:#263238;
    classDef external fill:#ffcdd2,stroke:#e53935,color:#b71c1c;
```
