Skip to main content

CDK Architecture Diagrams

Version: 2.0.0 | Last Updated: 2026-02-02 Spec Reference: specs/aws-sandbox/spec.md (Section 13) Plan Reference: specs/aws-sandbox/plan.md (Section 2.4)


Overviewโ€‹

This document provides architecture diagrams for the aws-sandbox npm package. Diagrams are generated using the Python diagrams library with native AWS icons for consistent, professional rendering across all platforms.

Diagram Generation:

  • Source: docs/sandbox/diagrams/*.py
  • Output: static/images/architecture/*.png
  • Regenerate: cd docs/docs/sandbox/diagrams && python generate_all.py

1. AWS Architecture (4-Stack Overview)โ€‹

Shows the relationship between AccountPoolStack, IDCStack, DataStack, and ComputeStack across Hub Account and IDC Account.

AWS 4-Stack Architecture

Stacks:

  • AccountPoolStack (Hub): AWS Organizations + OU management
  • IDCStack (IDC Account): IAM Identity Center configuration
  • DataStack (Hub): S3 Audit bucket, DynamoDB Registry
  • ComputeStack (Hub): API Gateway + Lambda functions

2. Consumer E2E Flow (5-Layer Validation)โ€‹

Shows the 5-layer validation process for consumer package testing.

Consumer E2E Flow

Layers:

LayerDescriptionValidation
L1npm pack & installPackage integrity
L2CLI version checkEntrypoint works
L3synth --allCDK synthesis
L4deploy --localstackCloudFormation deploy
L5list-stacksCREATE_COMPLETE

3. 3-Tier Testing Pipelineโ€‹

Shows the testing progression: Snapshot โ†’ LocalStack โ†’ Phase 3.5 โ†’ AWS.

3-Tier Testing Pipeline

Tiers:

TierTestsTimeCostCoverage
Tier 1: Snapshot292-3 sec$070-80%
Tier 2: LocalStack1130-60 sec$0+15-20%
Phase 3.5: Consumer E2E5 Layers1-2h$0BLOCKING
Tier 3: AWS SandboxAll5-10 min~$50/mo+5-10%

4. Deployment Sequence (Phase-Based)โ€‹

Shows the phased deployment order with dependencies.

Deployment Sequence

Phases:

  1. Phase 1: AccountPoolStack (Organizations)
  2. Phase 2: IDCStack (requires AccountPoolOuId export)
  3. Phase 3: DataStack + ComputeStack (parallel, require IdentityStoreId)

5. npm Package Structureโ€‹

Shows the package contents and consumer usage flow.

npm Package Structure

Package Contents:

aws-sandbox-0.3.18.tgz
โ”œโ”€โ”€ bin/cli.js (entrypoint)
โ”œโ”€โ”€ lib/ (compiled TypeScript)
โ”œโ”€โ”€ source/infrastructure/dist/app.cjs (~58MB)
โ”œโ”€โ”€ source/lambdas-bundled/*.zip
โ””โ”€โ”€ source/frontend/dist/ (React build)

6. ADLC 6+1 Phase Lifecycleโ€‹

Shows the release workflow: PLAN โ†’ BUILD โ†’ TEST โ†’ Phase 3.5 โ†’ RELEASE.

ADLC Lifecycle

Phases:

  1. PLAN: spec.md โ†’ plan.md โ†’ tasks.md (HITL Gate)
  2. BUILD: npm run build โ†’ build:consumer-app โ†’ app.cjs
  3. TEST: Tier 1 Snapshot โ†’ Tier 2 LocalStack
  4. Phase 3.5: Consumer E2E (L1-L5) - BLOCKING
  5. RELEASE: npm pack โ†’ HITL Approval โ†’ npm publish

7. Stack Resource Mappingโ€‹

7.1 DataStack Resources (19 Resources)โ€‹

DataStack Resources

ResourceTypePurpose
S3 BucketStorageAudit logs (7yr SOX retention)
DynamoDBDatabaseLeaseTable, Registry
AppConfigManagementFeature flags
KMS KeySecurityEncryption at rest

7.2 ComputeStack Resources (26 Resources)โ€‹

ComputeStack Resources

ResourceTypePurpose
API GatewayNetworkHTTP API + JWT auth
Lambda (AccountVending)ComputePython 3.12
Lambda (AccountCleaner)ComputeContainer-based
EventBridgeIntegrationDaily cleanup schedule
CloudWatchManagementLogs and alarms

Cross-Referencesโ€‹

DiagramRelated DocumentSection
4-Stack OverviewARCHITECTURE.mdSection 1
Consumer E2E Flowtasks.mdT3.3 Flow of Events
3-Tier Testingspec.mdSection 3.2 NFR
Deployment SequenceARCHITECTURE.mdSection 3
npm Package Structurespec.mdFR-003
ADLC Lifecycleplan.mdSection 3
Stack ResourcesARCHITECTURE.mdSection 2

Diagram Generationโ€‹

Prerequisitesโ€‹

pip install diagrams

Generate All Diagramsโ€‹

cd docs/docs/sandbox/diagrams
python generate_all.py

Individual Scriptsโ€‹

ScriptOutput
01_aws_4stack_architecture.py4-Stack overview
02_consumer_e2e_flow.pyConsumer validation flow
03_testing_pipeline.py3-Tier testing
04_deployment_sequence.pyPhase-based deployment
05_npm_package_structure.pyPackage contents
06_adlc_lifecycle.pyRelease workflow
07_datastack_resources.pyData stack resources
08_computestack_resources.pyCompute stack resources

Version: 2.0.0 Created: 2026-02-02 Diagram Library: Python diagrams (mingrammer) v0.25.1 ADLC Phase: 1.2 (Technical Feasibility Assessment) Constitutional Compliance: CHK050 (SOPs Defined), RQ4 (Architecture Diagrams)