Skip to content

Commit 0d790e0

Browse files
Merge pull request #2 from javaBin/docs/platform-updates
Update platform overview: Lambdas, tags, budget, RDS
2 parents 57c34ca + e25443b commit 0d790e0

1 file changed

Lines changed: 33 additions & 6 deletions

File tree

platform-overview.md

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ Seven Terraform sub-modules manage shared resources:
3333
|--------|-----------|
3434
| **networking** | VPC, public/private subnets across 3 AZs, NAT gateway, security groups |
3535
| **ingress** | ALB, ACM wildcard certificate for `*.javazone.no`, Route53 DNS |
36-
| **iam** | GitHub OIDC provider, per-app CI roles, permission boundary |
36+
| **iam** | GitHub OIDC provider, per-team CI roles (ABAC), permission boundary |
3737
| **compute** | ECS Fargate cluster (`javabin-platform`), ECR base config |
3838
| **monitoring** | SNS topics, EventBridge rules, AWS Config, GuardDuty, Security Hub |
39-
| **lambdas** | 6 Lambda functions for alerts, cost reporting, compliance, cleanup |
39+
| **lambdas** | 11 Lambda functions for alerts, cost reporting, compliance, budget enforcement, resource tagging, team provisioning |
4040
| **identity** | Cognito user pools (internal + external). Internal pool connected to Google IdP. Identity Center is in `terraform/org/` (deployed) |
4141

4242
### Reusable Modules (`terraform/modules/`)
4343

44-
Twelve Terraform modules that app repos source via `git::` URLs. The key one is `app-stack`, the golden path module that reads `app.yaml` and creates all infra for a service (ECR, ECS service, ALB routing, IAM role, optional S3/DynamoDB/SQS/Secrets Manager).
44+
Twelve Terraform modules that app repos source via `git::` URLs. CI generates expanded Terraform from `app.yaml` using `expand-modules.py` + `registry.py`. Supported resources: ECR, ECS service, ALB routing, IAM role (configurable for ECS/EC2/Lambda), S3, DynamoDB, RDS PostgreSQL, SQS, Secrets Manager. Cross-service access is auto-wired via `access_policy_json` outputs.
4545

4646
### Reusable Workflows (`.github/workflows/`)
4747

@@ -60,11 +60,16 @@ App repos call `javaBin/platform/.github/workflows/javabin.yml` as their CI entr
6060
| Function | Trigger | Purpose |
6161
|----------|---------|---------|
6262
| `slack-alert` | SNS subscription | Routes security/cost events to Slack with LLM analysis |
63-
| `cost-report` | Weekly schedule (Mon 08:00 UTC) | Cost breakdown with LLM narrative |
64-
| `daily-cost-check` | Daily schedule (08:00 UTC) | Spike detection, silent if no anomalies |
63+
| `cost-report` | Weekly schedule (Mon 08:00 UTC) | Cost breakdown with LLM narrative, per-team attribution |
64+
| `daily-cost-check` | Daily schedule (08:00 UTC) | Spike detection with team breakdown, silent if no anomalies |
6565
| `compliance-reporter` | EventBridge (resource create/run) | Reports untagged resources to Slack |
66+
| `resource-tagger` | EventBridge (all AWS create/run) | Auto-tags created-by + commit from CI session names |
67+
| `budget-enforcer` | SNS (AWS Budgets 200%) | Scales team's ECS services to zero, posts Slack alert |
6668
| `override-cleanup` | Hourly schedule | Deletes stale SSM override tokens |
67-
| `team-provisioner` | Registry merge | Syncs Google Groups, GitHub teams, AWS Budgets, Cognito, Identity Center. Also handles hero provisioning (Workspace accounts, aliases, group membership) |
69+
| `team-provisioner` | Registry merge | Syncs Google Groups, GitHub teams, AWS Budgets, Cognito, Identity Center, hero provisioning |
70+
| `apply-gate` | CI invocation | Credential broker for gated Terraform apply with risk verification |
71+
| `securityhub-summary` | Weekly schedule (Mon 08:00 UTC) | HIGH/CRITICAL Security Hub findings summary |
72+
| `password-set` | Function URL | Self-service password set for new hero accounts |
6873

6974
## How Apps Get CI/CD
7075

@@ -91,6 +96,28 @@ The [registry](https://github.com/javaBin/registry) serves two purposes:
9196

9297
Changes to `groups/` trigger provisioning: Google Workspace account creation, group membership sync, email aliases, and Cognito/Identity Center sync where configured. Heroes are synced from a yearly Google Sheets application process.
9398

99+
## Tag Schema
100+
101+
Every AWS resource gets 7 tags — 5 static (Terraform-managed) and 2 dynamic (auto-applied by the resource-tagger Lambda):
102+
103+
| Tag | Source | Example | Purpose |
104+
|-----|--------|---------|---------|
105+
| `team` | app.yaml / default_tags | `web-team` | ABAC, cost attribution, budgets |
106+
| `service` | app.yaml / default_tags | `moresleep` | Cost breakdown within team |
107+
| `repo` | app.yaml / default_tags | `javaBin/moresleep` | Link resource to source code |
108+
| `environment` | default_tags | `production` | Multi-env support |
109+
| `managed-by` | default_tags | `terraform` | Distinguish TF vs console |
110+
| `created-by` | resource-tagger Lambda | `alice` | Who created (set once) |
111+
| `commit` | resource-tagger Lambda | `abc12345` | Which commit (set once) |
112+
113+
Cost allocation tags are activated in AWS, so Cost Explorer can group by `team` and `service`.
114+
115+
## Budget Enforcement
116+
117+
Teams get a monthly budget (default 500 NOK). Two thresholds:
118+
- **80%** — SNS alert to #javabin-cost-alerts
119+
- **200%**`budget-enforcer` Lambda scales the team's ECS services to `desired_count=0` (not destroyed, easy recovery)
120+
94121
## AWS Account
95122

96123
- **Account**: (private — see platform repo)

0 commit comments

Comments
 (0)