# 100-hours-a-week/ktb4-2nd-cloud architecture

> Architecture diagram of the GitHub repository 100-hours-a-week/ktb4-2nd-cloud, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/100-hours-a-week/ktb4-2nd-cloud
- Repository: https://github.com/100-hours-a-week/ktb4-2nd-cloud

## Overview

KTB4-2nd-Cloud manages Yeodam’s AWS infrastructure and CI/CD, as described in the README. Its operational scope includes legacy and v2 staging infrastructure, release/deployment tooling, monitoring, and alarm forwarding. The tree also contains load-generation scenarios, shown here as a distinct operational capability. Source excerpts are limited to the alarm-forwarding Lambda, so infrastructure and deployment relationships are not inferred from filenames; the Lambda’s input and external calls are visible in its excerpt.

Main entry points: [`lambda/discord_alarm_forwarder.py`](https://github.com/100-hours-a-week/ktb4-2nd-cloud/blob/main/lambda/discord_alarm_forwarder.py) (Alarm forwarding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_infra["AWS infrastructure"]
  node_legacy["Legacy AWS stack"]
  node_v2["V2 staging stack"]
  node_mysql["MySQL replication"]
  node_ecs["ECS services<br/>[ecs-services.tf]"]
end

subgraph group_deploy["Release operations"]
  node_release["Release deployment<br/>[deploy-release.sh]"]
  node_rollback["Release rollback"]
  node_stagingdeploy["Staging deployment"]
end

subgraph group_observability["Monitoring and alerts"]
  node_metrics["Staging metrics"]
  node_alarm["Alarm forwarding"]
end

subgraph group_load["Load generation"]
  node_loadgen["Load scenarios"]
  node_loadtools["Load tooling"]
end

node_operator(("Cloud operator"))
node_sns["SNS notification"]
node_ssm[("AWS Parameter Store")]
node_discord(("Discord webhook"))

node_sns -->|"delivers records"| node_alarm
node_alarm -->|"reads webhook"| node_ssm
node_alarm -->|"posts alert"| node_discord

click node_legacy "https://github.com/100-hours-a-week/ktb4-2nd-cloud/tree/main/terraform"
click node_v2 "https://github.com/100-hours-a-week/ktb4-2nd-cloud/tree/main/terraform/v2/staging"
click node_mysql "https://github.com/100-hours-a-week/ktb4-2nd-cloud/blob/main/terraform/v2/staging/mysql-replication-link.tf"
click node_ecs "https://github.com/100-hours-a-week/ktb4-2nd-cloud/blob/main/terraform/v2/staging/ecs-services.tf"
click node_release "https://github.com/100-hours-a-week/ktb4-2nd-cloud/blob/main/scripts/deploy-release.sh"
click node_rollback "https://github.com/100-hours-a-week/ktb4-2nd-cloud/blob/main/scripts/rollback-release.sh"
click node_stagingdeploy "https://github.com/100-hours-a-week/ktb4-2nd-cloud/blob/main/scripts/deploy-v2-staging-frontend.sh"
click node_metrics "https://github.com/100-hours-a-week/ktb4-2nd-cloud/tree/main/monitoring/v2-staging"
click node_alarm "https://github.com/100-hours-a-week/ktb4-2nd-cloud/blob/main/lambda/discord_alarm_forwarder.py"
click node_loadgen "https://github.com/100-hours-a-week/ktb4-2nd-cloud/tree/main/tests/load/scenarios"
click node_loadtools "https://github.com/100-hours-a-week/ktb4-2nd-cloud/tree/main/tests/load/lib"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_legacy,node_v2,node_mysql,node_ecs toneBlue
class node_release,node_rollback,node_stagingdeploy,node_ssm toneAmber
class node_metrics,node_alarm,node_discord toneMint
class node_loadgen,node_loadtools toneRose
class node_operator,node_sns toneIndigo
```

## Components

### AWS infrastructure

- [Legacy AWS stack](https://github.com/100-hours-a-week/ktb4-2nd-cloud/tree/main/terraform): `terraform`
- [V2 staging stack](https://github.com/100-hours-a-week/ktb4-2nd-cloud/tree/main/terraform/v2/staging): `terraform/v2/staging`
- [MySQL replication](https://github.com/100-hours-a-week/ktb4-2nd-cloud/blob/main/terraform/v2/staging/mysql-replication-link.tf): `terraform/v2/staging/mysql-replication-link.tf`
- [ECS services](https://github.com/100-hours-a-week/ktb4-2nd-cloud/blob/main/terraform/v2/staging/ecs-services.tf): `terraform/v2/staging/ecs-services.tf`

### Release operations

- [Release deployment](https://github.com/100-hours-a-week/ktb4-2nd-cloud/blob/main/scripts/deploy-release.sh): `scripts/deploy-release.sh`
- [Release rollback](https://github.com/100-hours-a-week/ktb4-2nd-cloud/blob/main/scripts/rollback-release.sh): `scripts/rollback-release.sh`
- [Staging deployment](https://github.com/100-hours-a-week/ktb4-2nd-cloud/blob/main/scripts/deploy-v2-staging-frontend.sh): `scripts/deploy-v2-staging-frontend.sh`

### Monitoring and alerts

- [Staging metrics](https://github.com/100-hours-a-week/ktb4-2nd-cloud/tree/main/monitoring/v2-staging): `monitoring/v2-staging`
- [Alarm forwarding](https://github.com/100-hours-a-week/ktb4-2nd-cloud/blob/main/lambda/discord_alarm_forwarder.py): `lambda/discord_alarm_forwarder.py`

### Load generation

- [Load scenarios](https://github.com/100-hours-a-week/ktb4-2nd-cloud/tree/main/tests/load/scenarios): `tests/load/scenarios`
- [Load tooling](https://github.com/100-hours-a-week/ktb4-2nd-cloud/tree/main/tests/load/lib): `tests/load/lib`

### Other components

- **Cloud operator**
- **SNS notification**
- **AWS Parameter Store**
- **Discord webhook**

## Connections

- SNS notification → Alarm forwarding: delivers records (evidence: `lambda/discord_alarm_forwarder.py`)
- Alarm forwarding → AWS Parameter Store: reads webhook (evidence: `lambda/discord_alarm_forwarder.py`)
- Alarm forwarding → Discord webhook: posts alert (evidence: `lambda/discord_alarm_forwarder.py`)
