● Stable v4.2.1

Part 4: Infrastructure as Code with Pulumi

Provision and manage Aevum's multi-region knowledge infrastructure using modern IaC patterns.

Aevum Encyclopedia relies on a distributed, low-latency infrastructure to serve 2.4M+ articles across 140 languages. This guide details how to provision the underlying cloud resources using Pulumi, enabling type-safe infrastructure, familiar programming languages, and seamless GitOps workflows.

ℹ️ Design Philosophy Pulumi replaces traditional declarative YAML with TypeScript/Python, allowing us to model complex relationships (e.g., Knowledge Graph shards → AI inference queues → CDN edge caches) as reusable components.

Prerequisites

  • Pulumi CLI v3.110+ (curl -fsSL https://get.pulumi.com | sh)
  • Node.js 18+ or Python 3.10+
  • Cloud provider credentials (AWS/Azure/GCP) with IAMFullAccess scope
  • Aevum Organization access token for private registry pulls

Initialize Project

Clone the infrastructure repository and scaffold a new stack:

bashTerminal
git clone https://github.com/aevum-enc/infra-pulumi.git\ncd infra-pulumi\npulumi stack init prod-us-east-1\npulumi config set cloud:region us-east-1\npulumi config set aevum:env production

The scaffolded project includes three primary modules:

  • ./network/ — VPC, Transit Gateway, NAT Gateways
  • ./compute/ — ECS/EKS clusters, Lambda@Edge, AI GPU nodes
  • ./data/ — Neptune/Neo4j graphs, S3/GCS artifact storage, Redis cache

Core Components

Aevum's knowledge graph requires specialized storage and compute. Below is the TypeScript definition for the primary graph cluster and AI routing layer:

typescriptindex.ts
import * as aws from "@pulumi/aws";\nimport { KnowledgeGraph } from "@aevum/infra-graph";\n\n// 1. Multi-AZ VPC with strict security groups\nconst vpc = new aws.ec2.Vpc("aevum-core", {\n cidrBlock: "10.0.0.0/16",\n enableDnsHostnames: true,\n tags: { "env": "prod", "team": "platform" }\n});\n\n// 2. Graph Database Cluster (Neptune w/ multi-region replication)\nconst graph = new KnowledgeGraph("encyclopedia-graph", {\n vpcId: vpc.id,\n instanceType: "db.r6g.xlarge",\n replicas: 3,\n multiRegion: true,\n backupRetention: 30\n});\n\n// 3. AI Inference Router (GPU-backed Lambda)\nconst aiRouter = new aws.lambda.Function("semantic-router", {\n runtime: "nodejs20.x",\n gpuAcceleration: true,\n memorySize: 4096,\n environment: {\n variables: {\n GRAPH_ENDPOINT: graph.endpoint,\n MODEL_VERSION: "aevum-llm-v3.2"\n }\n }\n});
⚠️ GPU Allocation The aiRouter requires GPU-backed instances in regions supporting g5.xlarge or p4d.24xlarge. Fallback to CPU inference will degrade semantic search latency by ~400ms.

Deploy & Validate

Preview changes before applying. Pulumi renders a diff similar to git diff for infrastructure:

bashTerminal
pulumi preview\n# ... reviews diff ...\npulumi up --yes --skip-preview

Post-deployment validation runs automated health checks against the knowledge graph and AI endpoints. The CLI outputs stack exports including the CDN distribution ID, graph cluster ARN, and monitoring dashboard URLs.

Environment Configuration

Sensitive values are encrypted using Pulumi's default KMS-backed encryption. Override defaults via config files:

yamlPulumi.prod-us-east-1.yaml
config:\n aevum:env:\n value: production\n aevum:auth:\n value:\n jwtSecret: <encrypted>\n oidcIssuer: https://auth.aevum.io\n cloud:region:\n value: us-east-1\n scaling:maxNodes:\n value: 45

Scaling Strategies

Aevum automatically scales based on query load and language request distribution:

  • Horizontal Pod Autoscaling (HPA) — Triggers at 70% CPU/RAM utilization across inference pods
  • Read Replica Scaling — Adds graph replicas when graph.read_latency_p99 exceeds 120ms
  • Edge Caching — CloudFront/GCP CDN caches static article renders with Cache-Control: public, max-age=86400

Use pulumi config set scaling:enabled true to activate auto-scaling policies. Monitor capacity via the exported grafanaDashboardUrl.