Infrastructure Design
When to activate
When designing cloud infrastructure for new services, scaling existing systems, planning disaster recovery, optimizing costs, or conducting infrastructure reviews. Also when evaluating trade-offs between compute options, networking topologies, storage strategies, or disaster recovery approaches.
When NOT to use
For minor configuration tweaks or troubleshooting existing infrastructure. Use this skill when designing from scratch or making major architectural decisions.
Instructions
1. Gather Requirements
Before designing, establish:
Application Requirements:
- Expected traffic volume (requests/sec, peak vs average)
- Data volume (GB/TB), growth rate
- Latency requirements (p99 target)
- Availability target (99.9%, 99.95%, 99.99%)
- Compliance requirements (HIPAA, PCI-DSS, SOC2, etc.)
Operational Requirements:
- Team size and skill level (Kubernetes expertise, automation capability)
- On-call support model (24/7, business hours, hybrid)
- Disaster recovery targets (RTO, RPO)
- Budget constraints
Technology Stack:
- Programming languages and frameworks
- Database types (SQL, NoSQL, time-series)
- Message queues or event systems
- Caching requirements
2. Design Core Architecture
Define the foundational layers:
Compute Layer:
- Platform: Kubernetes, ECS, Lambda, Heroku, or self-managed VMs
- Instance sizing: CPU, memory requirements per container
- Horizontal scaling: Min/max replicas, scaling triggers
- Vertical scaling: Reserved capacity, spot instances
- Network location: Single region, multi-region, edge
Data Layer:
- Primary database: PostgreSQL, MySQL, DynamoDB, BigQuery
- Backup strategy: Frequency, retention, tested recovery
- Replication: Synchronous vs asynchronous, read replicas
- Encryption: At-rest and in-transit, key management
- Schema design: Normalized, sharded, or partitioned
Networking:
- VPC/VNet: CIDR ranges, subnet layout (public/private)
- Load balancing: Application vs network load balancer
- Service mesh: Istio, Linkerd, or native load balancing
- Security groups/NACLs: Ingress/egress rules
- DNS: Internal service discovery, external domains
- CDN: For static content and API response caching
Storage:
- Object storage: S3, GCS, Azure Blob
- Bucket structure: By data type, tenant, or time period
- Lifecycle policies: Transition to cold storage, deletion
- Encryption and access control
- Backup and versioning
3. Define Resilience
Plan for failures:
High Availability:
- Multi-zone deployments: Replicas across availability zones
- Load balancer health checks: Endpoint, frequency, failure threshold
- Graceful shutdown: Connection draining, in-flight request completion
- Circuit breakers: Fail fast when downstream is unavailable
Disaster Recovery:
- RTO (Recovery Time Objective): How long can you be down?
- RPO (Recovery Point Objective): How much data loss is acceptable?
- Backup strategy: Daily snapshots? Continuous replication? Point-in-time recovery?
- Failover procedure: Automated or manual? How long to execute?
- Testing schedule: Monthly, quarterly, or annual DR drills
Cost Optimization:
- Identify non-critical workloads suitable for spot instances
- Reserved capacity for baseline traffic
- Auto-scaling policies to shed load during peak
- Metrics to track cost per request/transaction
4. Plan Security
Establish security posture:
Authentication & Authorization:
- Service-to-service auth: mTLS, API keys, or OAuth2
- User authentication: IAM, OIDC, or custom
- Secrets management: Vault, AWS Secrets Manager, or encrypted configs
Network Security:
- Firewall rules: Only necessary ports and protocols
- Egress filtering: Which external services can instances reach?
- VPN or private connectivity for sensitive data
Compliance & Audit:
- Encryption requirements: TLS 1.2+, AES-256
- Audit logging: Who accessed what, when
- Data retention: How long to keep logs and backups
- Penetration testing: Schedule and scope
5. Document Architecture
Create diagrams and docs:
Architecture Diagram:
- Show compute, data, networking, and external services
- Label connections and data flows
- Indicate redundancy and failover paths
Decision Log:
- Why Kubernetes vs ECS?
- Why PostgreSQL vs DynamoDB?
- Why multi-region vs single region?
- What was rejected and why?
Cost Projection:
- Baseline monthly cost estimate
- Cost at 2x and 10x traffic
- Cost optimization opportunities
Deployment Procedure:
- Steps to provision infrastructure
- Terraform/CloudFormation files
- Helm charts for Kubernetes
- Testing checklist before production
Example
Design: User Onboarding Service
Requirements:
- 1,000 requests/sec average, 5,000 peak
- 99.9% availability (1,000 minutes error budget per month)
- GDPR compliance required
- Multi-region deployment desired
Compute:
- Kubernetes on EKS (multi-region)
- Deployment: 3 replicas per region, minimum
- Auto-scaling: Scale up at 70% CPU, down at 30%
- Instance type: t3.large for staging, c5.xlarge for production
Data:
- PostgreSQL RDS: Multi-AZ primary with read replicas in other regions
- Backups: Daily snapshots, 30-day retention
- Replication: Asynchronous to read replicas (5 second lag acceptable)
- Sharding: Not needed until 10,000+ requests/sec
Networking:
- VPC CIDR: 10.0.0.0/16
- Private subnets: 10.0.1.0/24, 10.0.2.0/24, 10.0.3.0/24 (one per AZ)
- Public subnets: 10.0.101.0/24, 10.0.102.0/24, 10.0.103.0/24 (NAT gateways)
- Load balancer: Application Load Balancer (ALB) with TLS termination
- Service mesh: Istio for observability and circuit breaking
Security:
- TLS 1.3 for all connections
- mTLS for service-to-service communication
- Secrets managed in AWS Secrets Manager, rotated every 90 days
- RBAC: Separate IAM roles for each service
- Network policies: Only permit necessary traffic between services
Disaster Recovery:
- RTO: 15 minutes (acceptable for non-critical onboarding)
- RPO: 1 hour (we can accept losing up to 1 hour of signups)
- Backup strategy: Continuous replication to standby region
- Failover: Automated DNS switch to secondary region if primary becomes unavailable
- Testing: Quarterly DR drills with failover simulation
Cost Estimate:
- EKS cluster: $73/month
- EC2 instances (6 nodes at c5.xlarge): $2,100/month
- RDS Multi-AZ: $2,500/month
- NAT Gateway: $32/month
- Data transfer: $200/month
- Total: ~$4,900/month
Decision Log:
- Why EKS + Kubernetes? Need multi-region, automatic scaling, and observability
- Why PostgreSQL? Structured data, ACID transactions required, known scaling patterns
- Why not DynamoDB? Requires application-level partitioning, operational complexity for this scale
- Why multi-region? Reduce latency for global users, survive region-level outages
Success Criteria
A well-designed infrastructure:
- Meets SLOs: Achieves target availability, latency, and error rates
- Scales horizontally: Can handle 10x traffic by adding resources, not rewriting code
- Recoverable: RTO/RPO targets are documented and tested quarterly
- Secure: Encryption, authentication, and audit logging in place before production
- Observable: Metrics, logs, and traces enable rapid issue diagnosis
- Documented: Architecture decisions recorded; runbooks exist for common issues
- Cost-optimized: No obvious waste; costs track with revenue or usage metrics
1---2name: infrastructure-design3description: Infrastructure Design4---5# Infrastructure Design67## When to activate89When designing cloud infrastructure for new services, scaling existing systems, planning disaster recovery, optimizing costs, or conducting infrastructure reviews. Also when evaluating trade-offs between compute options, networking topologies, storage strategies, or disaster recovery approaches.1011## When NOT to use1213For minor configuration tweaks or troubleshooting existing infrastructure. Use this skill when designing from scratch or making major architectural decisions.1415## Instructions1617### 1. Gather Requirements1819Before designing, establish:2021**Application Requirements:**22- Expected traffic volume (requests/sec, peak vs average)23- Data volume (GB/TB), growth rate24- Latency requirements (p99 target)25- Availability target (99.9%, 99.95%, 99.99%)26- Compliance requirements (HIPAA, PCI-DSS, SOC2, etc.)2728**Operational Requirements:**29- Team size and skill level (Kubernetes expertise, automation capability)30- On-call support model (24/7, business hours, hybrid)31- Disaster recovery targets (RTO, RPO)32- Budget constraints3334**Technology Stack:**35- Programming languages and frameworks36- Database types (SQL, NoSQL, time-series)37- Message queues or event systems38- Caching requirements3940### 2. Design Core Architecture4142Define the foundational layers:4344**Compute Layer:**45- Platform: Kubernetes, ECS, Lambda, Heroku, or self-managed VMs46- Instance sizing: CPU, memory requirements per container47- Horizontal scaling: Min/max replicas, scaling triggers48- Vertical scaling: Reserved capacity, spot instances49- Network location: Single region, multi-region, edge5051**Data Layer:**52- Primary database: PostgreSQL, MySQL, DynamoDB, BigQuery53- Backup strategy: Frequency, retention, tested recovery54- Replication: Synchronous vs asynchronous, read replicas55- Encryption: At-rest and in-transit, key management56- Schema design: Normalized, sharded, or partitioned5758**Networking:**59- VPC/VNet: CIDR ranges, subnet layout (public/private)60- Load balancing: Application vs network load balancer61- Service mesh: Istio, Linkerd, or native load balancing62- Security groups/NACLs: Ingress/egress rules63- DNS: Internal service discovery, external domains64- CDN: For static content and API response caching6566**Storage:**67- Object storage: S3, GCS, Azure Blob68- Bucket structure: By data type, tenant, or time period69- Lifecycle policies: Transition to cold storage, deletion70- Encryption and access control71- Backup and versioning7273### 3. Define Resilience7475Plan for failures:7677**High Availability:**78- Multi-zone deployments: Replicas across availability zones79- Load balancer health checks: Endpoint, frequency, failure threshold80- Graceful shutdown: Connection draining, in-flight request completion81- Circuit breakers: Fail fast when downstream is unavailable8283**Disaster Recovery:**84- RTO (Recovery Time Objective): How long can you be down?85- RPO (Recovery Point Objective): How much data loss is acceptable?86- Backup strategy: Daily snapshots? Continuous replication? Point-in-time recovery?87- Failover procedure: Automated or manual? How long to execute?88- Testing schedule: Monthly, quarterly, or annual DR drills8990**Cost Optimization:**91- Identify non-critical workloads suitable for spot instances92- Reserved capacity for baseline traffic93- Auto-scaling policies to shed load during peak94- Metrics to track cost per request/transaction9596### 4. Plan Security9798Establish security posture:99100**Authentication & Authorization:**101- Service-to-service auth: mTLS, API keys, or OAuth2102- User authentication: IAM, OIDC, or custom103- Secrets management: Vault, AWS Secrets Manager, or encrypted configs104105**Network Security:**106- Firewall rules: Only necessary ports and protocols107- Egress filtering: Which external services can instances reach?108- VPN or private connectivity for sensitive data109110**Compliance & Audit:**111- Encryption requirements: TLS 1.2+, AES-256112- Audit logging: Who accessed what, when113- Data retention: How long to keep logs and backups114- Penetration testing: Schedule and scope115116### 5. Document Architecture117118Create diagrams and docs:119120**Architecture Diagram:**121- Show compute, data, networking, and external services122- Label connections and data flows123- Indicate redundancy and failover paths124125**Decision Log:**126- Why Kubernetes vs ECS?127- Why PostgreSQL vs DynamoDB?128- Why multi-region vs single region?129- What was rejected and why?130131**Cost Projection:**132- Baseline monthly cost estimate133- Cost at 2x and 10x traffic134- Cost optimization opportunities135136**Deployment Procedure:**137- Steps to provision infrastructure138- Terraform/CloudFormation files139- Helm charts for Kubernetes140- Testing checklist before production141142## Example143144### Design: User Onboarding Service145146**Requirements:**147- 1,000 requests/sec average, 5,000 peak148- 99.9% availability (1,000 minutes error budget per month)149- GDPR compliance required150- Multi-region deployment desired151152**Compute:**153- Kubernetes on EKS (multi-region)154- Deployment: 3 replicas per region, minimum155- Auto-scaling: Scale up at 70% CPU, down at 30%156- Instance type: t3.large for staging, c5.xlarge for production157158**Data:**159- PostgreSQL RDS: Multi-AZ primary with read replicas in other regions160- Backups: Daily snapshots, 30-day retention161- Replication: Asynchronous to read replicas (5 second lag acceptable)162- Sharding: Not needed until 10,000+ requests/sec163164**Networking:**165- VPC CIDR: 10.0.0.0/16166- Private subnets: 10.0.1.0/24, 10.0.2.0/24, 10.0.3.0/24 (one per AZ)167- Public subnets: 10.0.101.0/24, 10.0.102.0/24, 10.0.103.0/24 (NAT gateways)168- Load balancer: Application Load Balancer (ALB) with TLS termination169- Service mesh: Istio for observability and circuit breaking170171**Security:**172- TLS 1.3 for all connections173- mTLS for service-to-service communication174- Secrets managed in AWS Secrets Manager, rotated every 90 days175- RBAC: Separate IAM roles for each service176- Network policies: Only permit necessary traffic between services177178**Disaster Recovery:**179- RTO: 15 minutes (acceptable for non-critical onboarding)180- RPO: 1 hour (we can accept losing up to 1 hour of signups)181- Backup strategy: Continuous replication to standby region182- Failover: Automated DNS switch to secondary region if primary becomes unavailable183- Testing: Quarterly DR drills with failover simulation184185**Cost Estimate:**186- EKS cluster: $73/month187- EC2 instances (6 nodes at c5.xlarge): $2,100/month188- RDS Multi-AZ: $2,500/month189- NAT Gateway: $32/month190- Data transfer: $200/month191- **Total: ~$4,900/month**192193**Decision Log:**194- Why EKS + Kubernetes? Need multi-region, automatic scaling, and observability195- Why PostgreSQL? Structured data, ACID transactions required, known scaling patterns196- Why not DynamoDB? Requires application-level partitioning, operational complexity for this scale197- Why multi-region? Reduce latency for global users, survive region-level outages198199---200201## Success Criteria202203A well-designed infrastructure:2042051. **Meets SLOs:** Achieves target availability, latency, and error rates2062. **Scales horizontally:** Can handle 10x traffic by adding resources, not rewriting code2073. **Recoverable:** RTO/RPO targets are documented and tested quarterly2084. **Secure:** Encryption, authentication, and audit logging in place before production2095. **Observable:** Metrics, logs, and traces enable rapid issue diagnosis2106. **Documented:** Architecture decisions recorded; runbooks exist for common issues2117. **Cost-optimized:** No obvious waste; costs track with revenue or usage metrics212213---