DEVOPS TRIBUNE ENGINEERING INTELLIGENCE FOR THE REAL WORLD
AWS Cloud Logo
12 PRODUCTION SCENARIOS • ARCHITECTURAL RUNBOOKS

AWS & Cloud Architecture Interview Questions and Scenarios

Conquer Principal Architect and Staff DevOps technical interviews. From Transit Gateway routing topologies and zero-egress VPCs to DynamoDB single-table design, cross-region active-active failover, and NAT Gateway FinOps, master high-judgment architectural decision-making.

AWS Cloud Platform Architecture & Multi-Account Interview Scenarios Infographic
SCENARIO 01 • ENTERPRISE GOVERNANCE

How do you architect a multi-account AWS environment using AWS Organizations, Control Tower, and Service Control Policies (SCPs)?

⚡ 30-Second Elevator Pitch

“A single AWS account is an anti-pattern that couples blast radiuses and creates noisy-neighbor IAM complexity. I architect a multi-account Landing Zone organized into Core and Custom Organizational Units (OUs). Core houses Security, Log Archive, and Shared Network Transit accounts. Custom OUs segment Workloads into dedicated Staging, Production, and Sandbox accounts. We enforce non-negotiable guardrails using Service Control Policies (SCPs) to deny root user actions, restrict regions to allowed geographic zones, and prevent tampering with CloudTrail logs.”

S Situation

A fast-growing fintech company ran production databases, staging environments, and internal developer experiments inside a single AWS account with 200+ IAM users.

T Task

Design and migrate to a secure, compliant multi-account landing zone with centralized billing and automated account provisioning.

A Action

Deployed AWS Control Tower with Account Factory for Terraform (AFT). Created segregated OUs: Security, Infrastructure, and Workloads. Attached SCP guardrails denying unencrypted S3 buckets and blocking access outside us-east-1 and eu-west-1. Centralized logs into an immutable S3 Object Lock bucket in the Log Archive account.

R Result

Passed SOC2 Type II audit with zero IAM findings. Isolated developer blast radiuses so an accidental staging resource exhaustion had zero impact on production.

Key SCP: Deny Unapproved AWS Regions

json • scp-region-restriction.json
AWS IAM & Organizations Policy
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyUnapprovedRegions",
      "Effect": "Deny",
      "NotAction": [
        "iam:*",
        "organizations:*",
        "route53:*",
        "cloudfront:*",
        "support:*"
      ],
      "Resource": "*",
      "Condition": {
        "StringNotEquals": {
          "aws:RequestedRegion": [
            "us-east-1",
            "eu-west-1"
          ]
        }
      }
    }
  ]
}
SCENARIO 02 • CLOUD NETWORKING

When should you choose AWS Transit Gateway (TGW) over VPC Peering? How do you justify the cost?

⚡ 30-Second Elevator Pitch

“VPC Peering is a direct 1-to-1 connection that is free (no hourly charge, only data transfer) and provides maximum throughput with lowest latency, but it does not support transitive routing. Connecting N VPCs requires N*(N-1)/2 peering links, creating a management nightmare at scale. AWS Transit Gateway acts as a central regional cloud router: it supports transitive routing, integrates seamlessly with on-premises Direct Connect and SD-WAN, and enables central egress inspection firewalls. You justify TGW when you exceed 10 VPCs or require centralized security appliance chaining.”

Architectural Comparison: Peering vs. Transit Gateway

Feature VPC Peering AWS Transit Gateway
Topology Point-to-point mesh (complex routing tables). Hub-and-spoke central router with route tables.
Transitive Routing Unsupported (VPC A cannot reach VPC C through B). Fully supported across all attached VPCs and VPNs.
Pricing No hourly cost; $0.01/GB cross-AZ peering fee. $0.05/hr per attachment + $0.02/GB processed.
Central Inspection Requires manual proxy routing in every VPC. Single inspection VPC for AWS Network Firewall.
S Situation

Our organization had 32 VPCs connected via 128 fragile VPC peering connections. Adding a new VPC took 3 days of manual route table edits and frequently caused routing loops.

T Task

Transition to a scalable hub-and-spoke network with centralized internet egress inspection via AWS Network Firewall.

A Action

Provisioned a centralized Transit Gateway with 3 route tables: Workloads, Shared Services, and Central Egress. Migrated VPCs incrementally using Terraform, routing all 0.0.0.0/0 traffic through the Inspection VPC firewall.

R Result

VPC onboarding time dropped from 3 days to 10 minutes via automated Terraform attachment. Centralized inspection met PCI-DSS egress logging requirements.

SCENARIO 03 • NETWORK SECURITY & PRIVATELINK

How do you architect a 'Zero-Egress' private VPC where backend compute accesses AWS APIs without an Internet Gateway or NAT Gateway?

⚡ 30-Second Elevator Pitch

“In a Zero-Egress VPC, route tables contain zero 0.0.0.0/0 outbound routes to Internet or NAT Gateways, completely preventing outbound data exfiltration. All AWS communication is routed through AWS PrivateLink endpoints: Gateway VPC Endpoints for Amazon S3 and DynamoDB (free and configured via route table entries), and Interface VPC Endpoints (ENIs with private IPs) for services like ECR, CloudWatch, SSM, and Secrets Manager. Private DNS ensures SDK calls automatically resolve to private IP addresses.”

S Situation

Our core financial payment processing containers handled raw PCI cardholder data, requiring strict air-gapping with zero direct route to the public internet.

T Task

Eliminate NAT Gateways entirely from the PCI VPC while preserving container image pulls from ECR, secret retrieval from Secrets Manager, and metrics in CloudWatch.

A Action

Removed the NAT Gateway and default route. Provisioned Gateway Endpoints for S3 (ECR image layers) and Interface Endpoints with private Security Groups for `ecr.api`, `ecr.dkr`, `secretsmanager`, and `logs`. Enabled `PrivateDnsEnabled: true`.

R Result

Achieved 100% air-gapped Zero-Egress architecture, passed Level 1 PCI-DSS audit, and saved $850/month by decommissioning idle NAT Gateways.

SCENARIO 04 • DATABASE ARCHITECTURE

How do you evaluate DynamoDB Single-Table Design versus Amazon Aurora Serverless v2 for a high-throughput microservice?

⚡ 30-Second Elevator Pitch

“DynamoDB is optimal when access patterns are strictly known in advance, requiring predictable single-digit millisecond latency at any scale (tens of thousands of QPS) with zero connection pool overhead. Single-table design overloads Partition Keys (PK) and Sort Keys (SK) with generic prefixes (e.g. `USER#123`, `ORDER#456`) to fetch parent-child relations in a single query. Aurora Serverless v2 is optimal when access patterns are ad-hoc or analytical, data requires strict relational ACID joins across multiple entities, or teams require standard PostgreSQL/MySQL compatibility.”

DynamoDB vs. Aurora Serverless v2 Decision Matrix

Criteria DynamoDB (Single-Table) Amazon Aurora Serverless v2
Latency Profile Predictable 2–8ms P99 regardless of table size (TB to PB). 10–30ms; query complexity and buffer cache dependent.
Flexibility Rigid; queries must match pre-designed PK/SK & GSIs. High; arbitrary SQL queries, joins, and aggregations.
Scaling Speed Instantaneous autoscaling on On-Demand mode. Scales ACUs in fractions of a second; bounded by connection pools.
Operational Cost Near-zero idle cost on Pay-Per-Request. Minimum 0.5 ACU baseline cost ($45/month per instance).
S Situation

Our real-time notification engine suffered connection starvation and CPU spikes on Aurora MySQL during flash sales when 50,000 Lambda functions invoked simultaneously.

T Task

Eliminate database connection bottlenecks and support 100k+ writes/second without managing database proxies.

A Action

Migrated user preferences and device tokens to DynamoDB using single-table modeling (`PK: USER#id, SK: DEVICE#token`). Enabled DynamoDB Streams to asynchronously fan out push notifications via Amazon SNS.

R Result

Latency dropped to a consistent 4ms P99 under 120,000 requests/sec. Database operating costs dropped by 74% compared to over-provisioned Aurora instances.

SCENARIO 05 • IAM PRIVILEGE ESCALATION

How do IAM Permission Boundaries prevent developers from escalating their own privileges in multi-tenant AWS accounts?

⚡ 30-Second Elevator Pitch

“If you allow developers to create IAM roles for Lambda or ECS, they can simply attach `AdministratorAccess` to that role and assume it, effectively escalating themselves to root administrators. An IAM Permission Boundary is an advanced policy that sets the maximum allowable permissions an identity-based policy can grant. Even if a developer creates a role with `*:*` permissions, the effective permissions are strictly the intersection between the permission policy and the boundary policy. We enforce boundaries via condition keys on `iam:CreateRole` and `iam:PutRolePolicy`.”

S Situation

Platform engineering was a bottleneck because developers needed ticket approvals every time a new microservice required a custom IAM execution role.

T Task

Empower developers to create their own IAM roles in self-service CI/CD pipelines while mathematically preventing privilege escalation.

A Action

Authored a standardized `DeveloperPermissionBoundary` policy. Added IAM policies to developer roles allowing `iam:CreateRole` only when `Condition: StringEquals: iam:PermissionsBoundary: arn:aws:iam::account:policy/DeveloperPermissionBoundary`.

R Result

Eliminated 100% of IAM ticket turnaround delay. Developers create roles self-service, while preventing any ability to tamper with billing, security tools, or audit trails.

Enforcing Permission Boundary on Role Creation

json • iam-enforce-boundary.json
AWS IAM & Organizations Policy
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowRoleCreationWithBoundaryOnly",
      "Effect": "Allow",
      "Action": ["iam:CreateRole", "iam:AttachRolePolicy"],
      "Resource": "arn:aws:iam::123456789012:role/service-*",
      "Condition": {
        "StringEquals": {
          "iam:PermissionsBoundary": "arn:aws:iam::123456789012:policy/DeveloperPermissionBoundary"
        }
      }
    }
  ]
}
SCENARIO 06 • DISASTER RECOVERY & RESILIENCE

How do you architect a multi-region active-active disaster recovery topology with RPO < 1s and RTO < 2 minutes?

⚡ 30-Second Elevator Pitch

“True multi-region active-active requires solving data replication latency and automated failover control. We deploy identical application stacks in primary (us-east-1) and secondary (us-west-2) regions. We utilize Amazon DynamoDB Global Tables or Aurora Global Database for sub-second cross-region replication (RPO < 1s). For traffic management, we use Route 53 Application Recovery Controller (ARC) with routing controls and health checks. Unlike standard DNS TTL caching which takes 5 to 15 minutes to clear, ARC routing control health checks shift global ingress traffic at the edge in under 60 seconds.”

S Situation

A regional outage in AWS us-east-1 took down our customer portal for 3 hours because our DR plan relied on manual RDS snapshot restoration in us-west-2.

T Task

Architect an automated multi-region active-active architecture capable of withstanding a total regional blackout with zero customer downtime.

A Action

Migrated databases to Aurora Global Database with write forwarding. Deployed dual-region EKS clusters synchronized via ArgoCD. Implemented Route 53 Application Recovery Controller (ARC) regional readiness checks with automated circuit breakers.

R Result

During a scheduled chaos engineering game day, regional failover completed in 1 minute 42 seconds with zero lost transactions, beating our 2-minute RTO target.

SCENARIO 07 • EKS COMPUTE ORCHESTRATION

Why choose Karpenter over Kubernetes Cluster Autoscaler for Amazon EKS? How does Karpenter optimize cost and speed?

⚡ 30-Second Elevator Pitch

“Cluster Autoscaler is tightly bound to AWS Auto Scaling Groups (ASGs). It scales ASGs blindly by increments of 1 node, taking 3 to 6 minutes to provision EC2 instances, and cannot dynamically choose optimal instance types. Karpenter bypasses ASGs completely: it communicates directly with the AWS EC2 Fleet API, evaluates unscheduled pod resource requests, and selects the exact instance type, architecture (Graviton ARM64 vs AMD64), and pricing model (Spot vs On-Demand) to fit the pending pods in under 45 seconds. It also continuously consolidates and bin-packs underutilized nodes.”

S Situation

Our batch machine learning preprocessing jobs queued for 12 minutes while Cluster Autoscaler slowly scaled up generic m5.xlarge instances, leaving 40% of node memory unused.

T Task

Accelerate node scale-up speed to under 1 minute and right-size compute instances to reduce waste.

A Action

Replaced Cluster Autoscaler with Karpenter v1.0. Configured NodePools with multi-architecture support (c6g, c6i, c5) targeting 80% Spot instances with automated node consolidation (`consolidationPolicy: WhenEmptyOrUnderutilized`).

R Result

Node provision latency dropped from 12 minutes to 48 seconds. Spot instance mix and automated bin-packing reduced our monthly Amazon EC2 bill by 54%.

Karpenter NodePool Manifest

yaml • karpenter-nodepool.yaml
AWS IAM & Organizations Policy
apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
  name: general-compute
spec:
  template:
    spec:
      requirements:
        - key: "karpenter.k8s.aws/instance-category"
          operator: In
          values: ["c", "m", "r"]
        - key: "karpenter.k8s.aws/instance-generation"
          operator: Gt
          values: ["4"]
        - key: "karpenter.sh/capacity-type"
          operator: In
          values: ["spot", "on-demand"]
      nodeClassRef:
        group: karpenter.k8s.aws
        kind: EC2NodeClass
        name: default
  disruption:
    consolidationPolicy: WhenEmptyOrUnderutilized
    consolidateAfter: 1m
SCENARIO 08 • EDGE & S3 SECURITY

How do you troubleshoot a CloudFront distribution returning '403 Access Denied' when fetching from a private S3 origin with OAC?

⚡ 30-Second Elevator Pitch

“CloudFront 403 Access Denied with Origin Access Control (OAC) stems from four root causes: 1) The S3 bucket policy lacks the `s3:GetObject` statement allowing `cloudfront.amazonaws.com` with a Condition matching the specific `aws:SourceArn` of the distribution; 2) The S3 objects are encrypted with a Customer Managed KMS key (SSE-KMS) and the KMS key policy does not allow the CloudFront service principal `kms:Decrypt`; 3) S3 Block Public Access is misconfigured or bucket ownership controls are not set to `BucketOwnerEnforced`; or 4) The requested S3 key does not exist, causing S3 to return 403 instead of 404 when listing permissions are denied.”

S Situation

After migrating from legacy CloudFront Origin Access Identity (OAI) to Origin Access Control (OAC) with SSE-KMS encryption, all static assets returned HTTP 403 Forbidden.

T Task

Diagnose and resolve the 403 Access Denied error immediately while maintaining private S3 bucket status and customer-managed encryption.

A Action

Inspected AWS CloudTrail for AccessDenied events. Identified that CloudFront was attempting to decrypt objects but the KMS key policy lacked permission for `cloudfront.amazonaws.com`. Updated the KMS key policy statement with `kms:Decrypt` and `kms:GenerateDataKey` conditioned on the CloudFront distribution ARN.

R Result

Immediate 100% resolution; static assets returned HTTP 200 within seconds of key policy update without making S3 objects public.

Compliant S3 Bucket Policy with CloudFront OAC

json • s3-oac-policy.json
AWS IAM & Organizations Policy
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowCloudFrontServicePrincipalReadOnly",
      "Effect": "Allow",
      "Principal": {
        "Service": "cloudfront.amazonaws.com"
      },
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::devopstribune-production-origin-1794/*",
      "Condition": {
        "StringEquals": {
          "AWS:SourceArn": "arn:aws:cloudfront::347166961665:distribution/EX6PQD1ERDSMT"
        }
      }
    }
  ]
}
SCENARIO 09 • FINOPS & CLOUD ECONOMICS

How do you diagnose and eliminate unexpected $5,000+ monthly AWS NAT Gateway data processing charges?

⚡ 30-Second Elevator Pitch

“AWS NAT Gateway charges $0.045 per GB for data processing in addition to the hourly fee. Spikes are almost always caused by internal AWS traffic (container image pulls from ECR, continuous CloudWatch log streaming, or S3 backups) unnecessarily traversing the NAT Gateway. I run Amazon Athena queries against VPC Flow Logs filtering by the NAT Gateway's private IP to identify the top source IP and destination IP pairs. We then add free S3 Gateway Endpoints and Interface Endpoints for ECR, CloudWatch, and SSM, rerouting high-volume traffic through the private AWS backbone.”

S Situation

Our monthly AWS bill showed an unexpected $6,400 charge for NAT Gateway data processing in our Kubernetes cluster VPC.

T Task

Pinpoint the offending workload generating high data transfer and eliminate the charges permanently.

A Action

Analyzed VPC Flow Logs using CloudWatch Contributor Insights. Discovered that 80 EKS nodes pulled a 2.5GB container image during autoscaling events 40 times a day, pulling directly through NAT Gateway instead of private VPC endpoints. Provisioned S3 Gateway Endpoints and ECR Interface Endpoints.

R Result

NAT Gateway data processing charges fell by 92%, saving $5,900 per month ($70,800 annualized) with zero changes to application code.

Athena VPC Flow Log Top Talkers Query

sql • top-nat-talkers.sql
AWS IAM & Organizations Policy
SELECT 
  srcaddr, 
  dstaddr, 
  SUM(bytes) / (1024 * 1024 * 1024) AS giga_bytes_transferred
FROM vpc_flow_logs
WHERE pkt_dstaddr = '10.0.1.150' -- NAT Gateway Private IP
  AND date >= current_date - interval '3' day
GROUP BY srcaddr, dstaddr
ORDER BY giga_bytes_transferred DESC
LIMIT 10;
SCENARIO 10 • EVENT-DRIVEN ARCHITECTURE

How do you choose between Amazon SQS FIFO, Amazon SNS, and Amazon EventBridge for decoupling microservices?

⚡ 30-Second Elevator Pitch

“Each AWS messaging service solves a distinct architectural pattern: Amazon SQS FIFO guarantees strict first-in-first-out ordering and exactly-once processing per message group ID, ideal for financial ledgers and inventory debits. Amazon SNS is a high-throughput pub/sub fan-out broker capable of pushing identical payloads to thousands of HTTP/SQS subscribers with ultra-low latency. Amazon EventBridge is an enterprise event bus designed for schema-driven, content-based routing and SaaS integrations, supporting complex rule matching without custom consumer dispatch code.”

Messaging Service Architecture Matrix

Criteria Amazon SQS FIFO Amazon SNS Amazon EventBridge
Primary Pattern Point-to-point pull queue. High-throughput pub/sub push. Content-based event routing bus.
Ordering Guarantee Strict per MessageGroupId. Standard SNS: none; SNS FIFO: strict. Ordered within a partition.
Latency Profile Sub-10ms polling. Sub-15ms push delivery. 20–60ms rule evaluation.
Filtering Capability None; consumer processes all. Attribute-based message filtering. Deep JSON payload pattern matching.
SCENARIO 11 • PRODUCTION INCIDENT TRIAGE

Your Application Load Balancer intermittently returns HTTP 502 Bad Gateway during normal traffic. How do you isolate the root cause?

⚡ 30-Second Elevator Pitch

“Intermittent ALB 502s with zero target group unhealthiness are almost always caused by a TCP Keep-Alive timeout race condition. The ALB maintains persistent idle TCP connections to backend targets (default idle timeout: 60 seconds). If the backend application server (e.g. Node.js with default 5s keep-alive, or Nginx with 60s) closes the TCP connection concurrently as the ALB dispatches a new client request, the ALB receives a TCP RST. Because the request was already sent, the ALB cannot retry idempotent requests and returns HTTP 502. The fix is ensuring the backend keep-alive timeout is strictly higher than the ALB idle timeout (e.g., 65 seconds vs 60 seconds).”

S Situation

Our e-commerce checkout API experienced a 0.8% random 502 Bad Gateway rate under modest load. CloudWatch showed targets were healthy and CPU was below 25%.

T Task

Isolate why the ALB was returning 502s without target group drops, and eliminate the checkout failures.

A Action

Queried ALB Access Logs using Athena, filtering on `elb_status_code = 502` and `target_status_code = '-'`. Confirmed the target closed the connection prematurely. Inspected our Node.js Express server configuration and discovered `server.keepAliveTimeout` was set to the default 5,000ms while ALB idle timeout was 60,000ms. Configured `keepAliveTimeout = 65000` and `headersTimeout = 66000`.

R Result

HTTP 502 Bad Gateway errors dropped to absolute zero. Restored 100% checkout success rate.

Node.js / Express Keep-Alive Configuration

javascript • server.js
AWS IAM & Organizations Policy
const express = require('express');
const app = express();

const server = app.listen(3000, () => {
  console.log('App running on port 3000');
});

// CRITICAL: Must exceed ALB Idle Timeout (default 60s)
server.keepAliveTimeout = 65 * 1000; // 65 seconds
server.headersTimeout = 66 * 1000;   // 66 seconds (must be higher than keepAliveTimeout)
SCENARIO 12 • ENVELOPE ENCRYPTION & COMPLIANCE

How does AWS KMS Envelope Encryption work? How do you audit key usage during a security breach investigation?

⚡ 30-Second Elevator Pitch

“KMS does not directly encrypt large datasets due to payload limits (max 4KB). Instead, it uses Envelope Encryption: KMS generates a plaintext Data Encryption Key (DEK) and an encrypted copy of that DEK using the Customer Managed KMS Key (CMK). The application uses the plaintext DEK to encrypt data locally via AES-GCM, immediately wipes the plaintext DEK from memory, and stores the encrypted DEK alongside the ciphertext. During forensic investigations, every single `kms:Decrypt` and `kms:GenerateDataKey` call is immutably logged in AWS CloudTrail with the caller identity, source IP, encryption context, and timestamp.”

S Situation

A developer workstation was compromised via malware, and security detected that the stolen IAM session credentials had access to our production KMS key.

T Task

Determine conclusively whether customer sensitive data was decrypted and stolen using the compromised KMS key.

A Action

Executed an Amazon Athena forensic query across CloudTrail logs searching for `eventName IN ('Decrypt', 'GenerateDataKey')` matching the compromised assumed-role session ARN. Verified that zero successful decrypt API calls occurred because our KMS key policy required strict `aws:SourceVpce` conditions restricting calls to our VPC.

R Result

Proved conclusively to regulatory authorities that zero customer records were decrypted. Revoked the compromised session and rotated the KMS key alias without data loss.

CloudTrail KMS Decrypt Forensic Query

sql • kms-audit.sql
AWS IAM & Organizations Policy
SELECT 
  eventtime, 
  useridentity.arn AS caller_arn, 
  useridentity.sessioncontext.sessionissuer.username AS role_name,
  sourceipaddress, 
  requestparameters
FROM cloudtrail_logs
WHERE eventsource = 'kms.amazonaws.com'
  AND eventname IN ('Decrypt', 'GenerateDataKey')
  AND useridentity.arn LIKE '%compromised-session-id%'
ORDER BY eventtime DESC;

Related Production Guides & Developer Tools

Strengthen your interview preparation with our companion architectural runbooks and utilities:

SECURITY AWS IAM Identity Center Guide

Multi-account governance, permission sets, SSO federation, and least-privilege SCPs.

READ ARCHITECTURE GUIDE →
EDGE ARCHITECTURE CloudFront & S3 403 Access Denied

Origin Access Control (OAC), S3 bucket policies, KMS encryption, and edge routing.

READ ARCHITECTURE GUIDE →
PORTFOLIO Real-World DevOps Projects

Zero-trust multi-AZ AWS EKS platform with IRSA, GitOps, and FinOps governance.

READ ARCHITECTURE GUIDE →
UTILITY CIDR & VPC Subnet Calculator

Calculate AWS VPC subnet masks, IP allocations, and network peering blocks.

TRY CIDR TOOL →