{
  "schemaVersion": "0.1",
  "sceneId": "aws-architecture-from-terraform",
  "baseRevision": 1,
  "message": "Build the production AWS architecture from infra/production, with PR 412's photo-resize queue and Lambda worker",
  "ops": [
    { "op": "createFrame", "id": "aws_cloud", "title": "AWS Cloud", "containerType": "aws.cloud", "children": ["route53", "cloudfront", "waf", "region"] },
    { "op": "createFrame", "id": "region", "title": "Region us-east-1", "containerType": "aws.region", "children": ["vpc", "cognito", "s3_assets", "s3_uploads", "cloudwatch"] },
    { "op": "createFrame", "id": "vpc", "title": "VPC 10.0.0.0/16", "containerType": "aws.vpc", "children": ["igw", "alb", "az_a", "az_b"] },
    { "op": "createFrame", "id": "az_a", "title": "Availability Zone A", "containerType": "aws.az", "children": ["pub_a", "app_a", "data_a"] },
    { "op": "createFrame", "id": "az_b", "title": "Availability Zone B", "containerType": "aws.az", "children": ["pub_b", "app_b", "data_b"] },
    { "op": "createFrame", "id": "pub_a", "title": "Public subnet", "containerType": "aws.subnet.public", "children": ["nat_a"] },
    { "op": "createFrame", "id": "pub_b", "title": "Public subnet", "containerType": "aws.subnet.public", "children": ["nat_b"] },
    { "op": "createFrame", "id": "app_a", "title": "Private subnet (app)", "containerType": "aws.subnet.private", "children": ["svc_a"] },
    { "op": "createFrame", "id": "app_b", "title": "Private subnet (app)", "containerType": "aws.subnet.private", "children": ["svc_b"] },
    { "op": "createFrame", "id": "data_a", "title": "Private subnet (data)", "containerType": "aws.subnet.private", "children": ["cache_a", "aurora_w"] },
    { "op": "createFrame", "id": "data_b", "title": "Private subnet (data)", "containerType": "aws.subnet.private", "children": ["aurora_r", "cache_b"] },
    { "op": "createNode", "id": "users", "nodeType": "actor", "label": "Customers", "icon": "aws:users" },
    { "op": "createNode", "id": "route53", "nodeType": "service", "label": "Amazon Route 53", "icon": "aws:route53" },
    { "op": "createNode", "id": "cloudfront", "nodeType": "service", "label": "Amazon CloudFront", "icon": "aws:cloudfront" },
    { "op": "createNode", "id": "waf", "nodeType": "service", "label": "AWS WAF", "icon": "aws:waf" },
    { "op": "createNode", "id": "igw", "nodeType": "service", "label": "Internet gateway", "icon": "aws:internet-gateway" },
    { "op": "createNode", "id": "alb", "nodeType": "service", "label": "Application Load Balancer", "icon": "aws:application-load-balancer" },
    { "op": "createNode", "id": "nat_a", "nodeType": "service", "label": "NAT gateway", "icon": "aws:nat-gateway" },
    { "op": "createNode", "id": "nat_b", "nodeType": "service", "label": "NAT gateway", "icon": "aws:nat-gateway" },
    { "op": "createNode", "id": "svc_a", "nodeType": "service", "label": "Bookings API task", "icon": "aws:ecs-task" },
    { "op": "createNode", "id": "svc_b", "nodeType": "service", "label": "Bookings API task", "icon": "aws:ecs-task" },
    { "op": "createNode", "id": "cache_a", "nodeType": "database", "label": "ElastiCache primary", "icon": "aws:elasticache" },
    { "op": "createNode", "id": "aurora_w", "nodeType": "database", "label": "Aurora writer", "icon": "aws:aurora" },
    { "op": "createNode", "id": "aurora_r", "nodeType": "database", "label": "Aurora reader", "icon": "aws:aurora" },
    { "op": "createNode", "id": "cache_b", "nodeType": "database", "label": "ElastiCache replica", "icon": "aws:elasticache" },
    { "op": "createNode", "id": "cognito", "nodeType": "service", "label": "Amazon Cognito", "icon": "aws:cognito" },
    { "op": "createNode", "id": "s3_assets", "nodeType": "objectStorage", "label": "S3 web assets", "icon": "aws:s3" },
    { "op": "createNode", "id": "s3_uploads", "nodeType": "objectStorage", "label": "S3 uploads", "icon": "aws:s3" },
    { "op": "createNode", "id": "cloudwatch", "nodeType": "service", "label": "Amazon CloudWatch", "icon": "aws:cloudwatch" },
    { "op": "createNode", "id": "sqs", "nodeType": "queue", "label": "Amazon SQS", "icon": "aws:sqs", "frame": "region" },
    { "op": "createNode", "id": "worker", "nodeType": "service", "label": "AWS Lambda worker", "icon": "aws:lambda", "frame": "region" },
    { "op": "createEdge", "id": "e_dns", "from": { "elementId": "users" }, "to": { "elementId": "route53" }, "label": "DNS" },
    { "op": "createEdge", "id": "e_https", "from": { "elementId": "users" }, "to": { "elementId": "cloudfront" }, "label": "HTTPS" },
    { "op": "createEdge", "id": "e_signin", "from": { "elementId": "users" }, "to": { "elementId": "cognito" }, "label": "sign in" },
    { "op": "createEdge", "id": "e_waf", "from": { "elementId": "waf" }, "to": { "elementId": "cloudfront" }, "style": { "dash": [6, 4] }, "endpoints": { "endArrow": "none" } },
    { "op": "createEdge", "id": "e_static", "from": { "elementId": "cloudfront" }, "to": { "elementId": "s3_assets" }, "label": "static files" },
    { "op": "createEdge", "id": "e_api", "from": { "elementId": "cloudfront" }, "to": { "elementId": "igw" }, "label": "/api/*" },
    { "op": "createEdge", "id": "e_igw", "from": { "elementId": "igw" }, "to": { "elementId": "alb" } },
    { "op": "createEdge", "id": "e_alb_a", "from": { "elementId": "alb" }, "to": { "elementId": "svc_a" } },
    { "op": "createEdge", "id": "e_alb_b", "from": { "elementId": "alb" }, "to": { "elementId": "svc_b" } },
    { "op": "createEdge", "id": "e_cache_a", "from": { "elementId": "svc_a" }, "to": { "elementId": "cache_a" } },
    { "op": "createEdge", "id": "e_sql_a", "from": { "elementId": "svc_a" }, "to": { "elementId": "aurora_w" } },
    { "op": "createEdge", "id": "e_sql_b", "from": { "elementId": "svc_b" }, "to": { "elementId": "aurora_w" }, "label": "writes" },
    { "op": "createEdge", "id": "e_read_b", "from": { "elementId": "svc_b" }, "to": { "elementId": "aurora_r" }, "label": "reads" },
    { "op": "createEdge", "id": "e_cache_b", "from": { "elementId": "svc_b" }, "to": { "elementId": "cache_b" } },
    { "op": "createEdge", "id": "e_repl_db", "from": { "elementId": "aurora_w" }, "to": { "elementId": "aurora_r" }, "label": "replication", "style": { "dash": [6, 4] } },
    { "op": "createEdge", "id": "e_repl_cache", "from": { "elementId": "cache_a" }, "to": { "elementId": "cache_b" }, "label": "replication", "style": { "dash": [6, 4] } },
    { "op": "createEdge", "id": "e_logs", "from": { "elementId": "vpc" }, "to": { "elementId": "cloudwatch" }, "label": "logs, metrics" },
    { "op": "createEdge", "id": "e_upload", "from": { "elementId": "svc_b" }, "to": { "elementId": "s3_uploads" }, "label": "originals" },
    { "op": "createEdge", "id": "e_enqueue", "from": { "elementId": "svc_b" }, "to": { "elementId": "sqs" }, "label": "enqueue" },
    { "op": "createEdge", "id": "e_trigger", "from": { "elementId": "sqs" }, "to": { "elementId": "worker" }, "label": "invokes" },
    { "op": "createEdge", "id": "e_write", "from": { "elementId": "worker" }, "to": { "elementId": "s3_uploads" }, "label": "thumbnails" }
  ]
}
