Network Architecture
This document details the network topology, virtual network design, peering configuration, and traffic flows.
Network Overview
The platform uses a hub-and-spoke topology with the Control Plane as the hub and tenant Data Planes as spokes:
┌────────────────────────────────────┐
│ Internet / Slack API │
└───────────────┬────────────────────┘
│
▼
┌────────────────────────────────────┐
│ CloudFront / API Gateway │
│ • WAF Protection │
│ • TLS 1.3 Termination │
│ • Rate Limiting │
└───────────────┬────────────────────┘
│
▼
┌───────────────────────────────────────────────────────────────────┐
│ CONTROL PLANE virtual network (10.10.0.0/16) │
│ Account: Management (123456789012) │
├───────────────────────────────────────────────────────────────────┤
│ │
│ ┌────────────────────────────────────────────────────────────┐ │
│ │ Private Subnet 1 (10.10.0.0/20) - us-east-1a │ │
│ │ • serverless functions Functions (in virtual network) │ │
│ │ • DP Dispatcher (initiates connections to DPs) │ │
│ └────────────────────────────────────────────────────────────┘ │
│ │
│ ┌────────────────────────────────────────────────────────────┐ │
│ │ Private Subnet 2 (10.10.16.0/20) - us-east-1b │ │
│ │ • serverless functions Functions (in virtual network) - HA │ │
│ └────────────────────────────────────────────────────────────┘ │
│ │
│ ┌────────────────────────────────────────────────────────────┐ │
│ │ Private Subnet 3 (10.10.32.0/20) - us-east-1c │ │
│ │ • serverless functions Functions (in virtual network) - HA │ │
│ └────────────────────────────────────────────────────────────┘ │
│ │
│ ┌────────────────────────────────────────────────────────────┐ │
│ │ Public Subnet 1 (10.10.48.0/20) - us-east-1a │ │
│ │ • NAT Instance (t3.nano - 88% cost savings) │ │
│ │ • Application Load Balancer (Admin Panel) │ │
│ │ • Bastion Host (emergency access) │ │
│ └────────────────────────────────────────────────────────────┘ │
│ │
│ ┌────────────────────────────────────────────────────────────┐ │
│ │ virtual network Endpoints │ │
│ │ • NoSQL database (Gateway) │ │
│ │ • object storage (Gateway) │ │
│ │ • ECR API/DKR (Interface) │ │
│ │ • monitoring service Logs (Interface) │ │
│ └────────────────────────────────────────────────────────────┘ │
│ │
└─────────┬────────────────────────────────┬────────────────┬──────┘
│ Peering │ Peering │ Peering
│ (DP → CP, CP → DP) │ │
▼ ▼ ▼
┌──────────────────────┐ ┌──────────────────────┐ ┌──────────────────────┐
│ Tenant DP virtual network │ │ Tenant DP virtual network │ │ Tenant DP virtual network │
│ 10.100.0.0/16 │ │ 10.101.0.0/16 │ │ 10.102.0.0/16 │
│ Account: DP-001 │ │ Account: DP-002 │ │ Account: DP-003 │
├──────────────────────┤ ├──────────────────────┤ ├──────────────────────┤
│ • workflow-engine Executor │ │ • workflow-engine Executor │ │ • workflow-engine Executor │
│ • Go Microservices │ │ • Go Microservices │ │ • Go Microservices │
│ • NAT Instance │ │ • NAT Instance │ │ • NAT Instance │
│ • Private subnets │ │ • Private subnets │ │ • Private subnets │
└──────────────────────┘ └──────────────────────┘ └──────────────────────┘
Control Plane virtual network Design
virtual network Configuration
[Infrastructure code removed for vendor neutrality]
Configuration includes:
- Network isolation and segmentation
- Route tables and gateways
- Security groups and firewall rules
- Service endpoints for private connectivity
Subnet Design
| Subnet | CIDR | AZ | Purpose | Public |
|---|---|---|---|---|
| Private-1 | 10.10.0.0/20 | us-east-1a | serverless functions, DP Dispatcher | ❌ |
| Private-2 | 10.10.16.0/20 | us-east-1b | serverless functions (HA), RDS | ❌ |
| Private-3 | 10.10.32.0/20 | us-east-1c | serverless functions (HA) | ❌ |
| Public-1 | 10.10.48.0/20 | us-east-1a | NAT Instance, load balancer, Bastion | ✅ |
| Public-2 | 10.10.64.0/20 | us-east-1b | NAT Instance (HA), load balancer | ✅ |
| Public-3 | 10.10.80.0/20 | us-east-1c | NAT Instance (HA) | ✅ |
Route Tables
Public Subnet Route Table
[Infrastructure code removed for vendor neutrality]
Configuration includes:
- Network isolation and segmentation
- Route tables and gateways
- Security groups and firewall rules
- Service endpoints for private connectivity
Private Subnet Route Table
[Infrastructure code removed for vendor neutrality]
Configuration includes:
- Network isolation and segmentation
- Route tables and gateways
- Security groups and firewall rules
- Service endpoints for private connectivity
virtual network Endpoints
Gateway Endpoints (no additional cost):
# object storage Gateway Endpoint
resource "cloud_vpc_endpoint" "s3" {
vpc_id = cloud_vpc.control_plane.id
service_name = "cloud-provider.region.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [cloud_route_table.private.id]
}
# NoSQL database Gateway Endpoint
resource "cloud_vpc_endpoint" "dynamodb" {
vpc_id = cloud_vpc.control_plane.id
service_name = "cloud-provider.region.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [cloud_route_table.private.id]
}
Interface Endpoints (charged per hour + data):
# Secrets Manager Interface Endpoint
resource "cloud_vpc_endpoint" "secrets_manager" {
vpc_id = cloud_vpc.control_plane.id
service_name = "cloud-provider.region.secretsmanager"
vpc_endpoint_type = "Interface"
subnet_ids = [cloud_subnet.private_1.id, cloud_subnet.private_2.id]
security_group_ids = [cloud_security_group.vpc_endpoints.id]
private_dns_enabled = true
}
# monitoring service Logs Interface Endpoint
resource "cloud_vpc_endpoint" "logs" {
vpc_id = cloud_vpc.control_plane.id
service_name = "cloud-provider.region.logs"
vpc_endpoint_type = "Interface"
subnet_ids = [cloud_subnet.private_1.id, cloud_subnet.private_2.id]
security_group_ids = [cloud_security_group.vpc_endpoints.id]
private_dns_enabled = true
}
Data Plane virtual network Design
virtual network Configuration (Per Tenant)
# Tenant number determines virtual network CIDR to avoid conflicts
# Example: tenant-1 → 10.100.0.0/16, tenant-2 → 10.101.0.0/16
locals {
tenant_number = tonumber(regex("[0-9]+$", var.tenant_id))
vpc_cidr = "10.${100 + local.tenant_number - 1}.0.0/16"
}
resource "cloud_vpc" "tenant" {
cidr_block = local.vpc_cidr
enable_dns_hostnames = true
enable_dns_support = true
tags = {
Name = "dp-${var.tenant_id}"
TenantID = var.tenant_id
}
}
Subnet Design (Per Tenant)
| Subnet | CIDR | AZ | Purpose | Public |
|---|---|---|---|---|
| Public-1 | 10.(100+N-1).0.0/20 | us-east-1a | NAT Instance | ✅ |
| Public-2 | 10.(100+N-1).16.0/20 | us-east-1b | NAT Instance (HA) | ✅ |
| Public-3 | 10.(100+N-1).32.0/20 | us-east-1c | NAT Instance (HA) | ✅ |
| Private-1 | 10.(100+N-1).128.0/20 | us-east-1a | workflow-engine, Go services, Metering | ❌ |
| Private-2 | 10.(100+N-1).144.0/20 | us-east-1b | workflow-engine (HA), Go services | ❌ |
| Private-3 | 10.(100+N-1).160.0/20 | us-east-1c | Reserved for GPU instances | ❌ |
Route Tables (Data Plane)
[Infrastructure code removed for vendor neutrality]
Configuration includes:
- Network isolation and segmentation
- Route tables and gateways
- Security groups and firewall rules
- Service endpoints for private connectivity
virtual network Peering
Control Plane ↔ Data Plane Peering
Bidirectional peering with carefully controlled routes:
# Initiated from Data Plane account
resource "cloud_vpc_peering_connection" "to_cp" {
vpc_id = cloud_vpc.tenant.id
peer_vpc_id = var.control_plane_vpc_id
peer_owner_id = var.control_plane_account_id
peer_region = var.control_plane_region
auto_accept = false # CP must accept
tags = {
Name = "dp-${var.tenant_id}-to-cp"
TenantID = var.tenant_id
}
}
# Accepted in Control Plane account
resource "cloud_vpc_peering_connection_accepter" "from_dp" {
provider = aws.control_plane
vpc_peering_connection_id = cloud_vpc_peering_connection.to_cp.id
auto_accept = true
tags = {
Name = "cp-from-dp-${var.tenant_id}"
}
}
Traffic Flows
CP → DP (Execution Dispatch)
DP Dispatcher serverless functions (10.10.1.X)
↓ virtual network Peering
workflow-engine instance (10.142.1.10:5678)
Control Plane Route:
[Infrastructure code removed for vendor neutrality]
Configuration includes:
- Network isolation and segmentation
- Route tables and gateways
- Security groups and firewall rules
- Service endpoints for private connectivity
DP → CP (Outcome Reporting)
workflow-engine instance (10.142.1.10)
↓ virtual network Peering
API Gateway (10.10.1.50:443) → Metering Collector serverless functions
Data Plane Route:
[Infrastructure code removed for vendor neutrality]
Configuration includes:
- Network isolation and segmentation
- Route tables and gateways
- Security groups and firewall rules
- Service endpoints for private connectivity
Security Groups
Control Plane Security Groups
serverless functions Security Group
[Infrastructure code removed for vendor neutrality]
Configuration includes:
- Network isolation and segmentation
- Route tables and gateways
- Security groups and firewall rules
- Service endpoints for private connectivity
load balancer Security Group (Admin Panel)
[Infrastructure code removed for vendor neutrality]
Configuration includes:
- Network isolation and segmentation
- Route tables and gateways
- Security groups and firewall rules
- Service endpoints for private connectivity
Data Plane Security Groups
workflow-engine Instance Security Group
[Infrastructure code removed for vendor neutrality]
Configuration includes:
- Network isolation and segmentation
- Route tables and gateways
- Security groups and firewall rules
- Service endpoints for private connectivity
Network ACLs
Control Plane NACLs
[Infrastructure code removed for vendor neutrality]
Configuration includes:
- Network isolation and segmentation
- Route tables and gateways
- Security groups and firewall rules
- Service endpoints for private connectivity
Traffic Flow Examples
Example 1: Slack Command → Workflow Execution
┌──────────┐
│ Slack │ 1. POST /slack/commands
│ Workspace│────────────────────┐
└──────────┘ │
▼
┌────────────────────────┐
│ CloudFront / WAF │
│ • Rate limit check │
└────────┬───────────────┘
│ 2. Forward to API Gateway
▼
┌────────────────────────┐
│ API Gateway │
│ • Verify Slack sig │
└────────┬───────────────┘
│ 3. Invoke Slack Handler
▼
┌────────────────────────────────────────────────────────────┐
│ Control Plane virtual network (10.10.0.0/16) │
│ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ Slack Handler serverless functions (10.10.1.X) │ │
│ │ 4. Check rate limits, invoke Execution Orchestrator │ │
│ └────────┬─────────────────────────────────────────────┘ │
│ │ 5. Invoke │
│ ▼ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ Execution Orchestrator serverless functions (10.10.1.Y) │ │
│ │ 6. Planner → Policy → Token Service → DP Dispatcher │ │
│ └────────┬─────────────────────────────────────────────┘ │