[{"data":1,"prerenderedAt":2982},["ShallowReactive",2],{"content-query-RW7T3ACNJP":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"tags":10,"body":16,"_type":2976,"_id":2977,"_source":2978,"_file":2979,"_stem":2980,"_extension":2981},"/codes/ecs-fargate-autoscaling","codes",false,"","ECS Fargate Autoscaling with Target Tracking","How I designed a highly available ECS Fargate cluster with target tracking autoscaling policies supporting 100+ microservices.",[11,12,13,14,15],"aws","ecs","fargate","autoscaling","devops",{"type":17,"children":18,"toc":2968},"root",[19,28,34,41,470,476,481,1396,1402,1407,2312,2318,2323,2854,2860,2922,2928,2962],{"type":20,"tag":21,"props":22,"children":24},"element","h1",{"id":23},"ecs-fargate-autoscaling-architecture",[25],{"type":26,"value":27},"text","ECS Fargate Autoscaling Architecture",{"type":20,"tag":29,"props":30,"children":31},"p",{},[32],{"type":26,"value":33},"This write-up covers how I set up ECS Fargate with target tracking autoscaling to handle dynamic workloads across 100+ microservices while maintaining 99.99% uptime.",{"type":20,"tag":35,"props":36,"children":38},"h2",{"id":37},"architecture-overview",[39],{"type":26,"value":40},"Architecture Overview",{"type":20,"tag":42,"props":43,"children":47},"pre",{"className":44,"code":45,"language":46,"meta":7,"style":7},"language-mermaid shiki shiki-themes material-theme-lighter github-light github-dark","graph TB\n    subgraph \"Traffic Layer\"\n        ALB[Application Load Balancer]\n        TG1[Target Group - Service A]\n        TG2[Target Group - Service B]\n        TGN[Target Group - Service N]\n    end\n\n    subgraph \"ECS Cluster\"\n        SVC1[ECS Service A\u003Cbr/>Desired: 2-10 tasks]\n        SVC2[ECS Service B\u003Cbr/>Desired: 3-15 tasks]\n        SVCN[ECS Service N\u003Cbr/>Desired: 1-5 tasks]\n    end\n\n    subgraph \"Autoscaling\"\n        CW[CloudWatch Metrics]\n        ASP[Application Auto Scaling]\n        TTP[Target Tracking Policy\u003Cbr/>CPU: 60% / Memory: 70%]\n    end\n\n    subgraph \"Supporting Services\"\n        ECR[ECR Registry]\n        SM[Secrets Manager]\n        CWL[CloudWatch Logs]\n    end\n\n    ALB --> TG1 --> SVC1\n    ALB --> TG2 --> SVC2\n    ALB --> TGN --> SVCN\n\n    SVC1 --> CW\n    SVC2 --> CW\n    SVCN --> CW\n    CW --> ASP\n    ASP --> TTP\n    TTP --> SVC1\n    TTP --> SVC2\n    TTP --> SVCN\n\n    ECR --> SVC1\n    ECR --> SVC2\n    SM --> SVC1\n    SVC1 --> CWL\n\n    style ALB fill:#4dabf7\n    style ASP fill:#51cf66\n    style TTP fill:#51cf66\n","mermaid",[48],{"type":20,"tag":49,"props":50,"children":51},"code",{"__ignoreMap":7},[52,64,73,82,91,100,109,118,128,137,146,155,164,172,180,189,198,207,216,224,232,241,250,259,268,276,284,293,302,311,319,328,337,346,355,364,373,382,391,399,408,417,426,435,443,452,461],{"type":20,"tag":53,"props":54,"children":57},"span",{"class":55,"line":56},"line",1,[58],{"type":20,"tag":53,"props":59,"children":61},{"style":60},"--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8",[62],{"type":26,"value":63},"graph TB\n",{"type":20,"tag":53,"props":65,"children":67},{"class":55,"line":66},2,[68],{"type":20,"tag":53,"props":69,"children":70},{"style":60},[71],{"type":26,"value":72},"    subgraph \"Traffic Layer\"\n",{"type":20,"tag":53,"props":74,"children":76},{"class":55,"line":75},3,[77],{"type":20,"tag":53,"props":78,"children":79},{"style":60},[80],{"type":26,"value":81},"        ALB[Application Load Balancer]\n",{"type":20,"tag":53,"props":83,"children":85},{"class":55,"line":84},4,[86],{"type":20,"tag":53,"props":87,"children":88},{"style":60},[89],{"type":26,"value":90},"        TG1[Target Group - Service A]\n",{"type":20,"tag":53,"props":92,"children":94},{"class":55,"line":93},5,[95],{"type":20,"tag":53,"props":96,"children":97},{"style":60},[98],{"type":26,"value":99},"        TG2[Target Group - Service B]\n",{"type":20,"tag":53,"props":101,"children":103},{"class":55,"line":102},6,[104],{"type":20,"tag":53,"props":105,"children":106},{"style":60},[107],{"type":26,"value":108},"        TGN[Target Group - Service N]\n",{"type":20,"tag":53,"props":110,"children":112},{"class":55,"line":111},7,[113],{"type":20,"tag":53,"props":114,"children":115},{"style":60},[116],{"type":26,"value":117},"    end\n",{"type":20,"tag":53,"props":119,"children":121},{"class":55,"line":120},8,[122],{"type":20,"tag":53,"props":123,"children":125},{"emptyLinePlaceholder":124},true,[126],{"type":26,"value":127},"\n",{"type":20,"tag":53,"props":129,"children":131},{"class":55,"line":130},9,[132],{"type":20,"tag":53,"props":133,"children":134},{"style":60},[135],{"type":26,"value":136},"    subgraph \"ECS Cluster\"\n",{"type":20,"tag":53,"props":138,"children":140},{"class":55,"line":139},10,[141],{"type":20,"tag":53,"props":142,"children":143},{"style":60},[144],{"type":26,"value":145},"        SVC1[ECS Service A\u003Cbr/>Desired: 2-10 tasks]\n",{"type":20,"tag":53,"props":147,"children":149},{"class":55,"line":148},11,[150],{"type":20,"tag":53,"props":151,"children":152},{"style":60},[153],{"type":26,"value":154},"        SVC2[ECS Service B\u003Cbr/>Desired: 3-15 tasks]\n",{"type":20,"tag":53,"props":156,"children":158},{"class":55,"line":157},12,[159],{"type":20,"tag":53,"props":160,"children":161},{"style":60},[162],{"type":26,"value":163},"        SVCN[ECS Service N\u003Cbr/>Desired: 1-5 tasks]\n",{"type":20,"tag":53,"props":165,"children":167},{"class":55,"line":166},13,[168],{"type":20,"tag":53,"props":169,"children":170},{"style":60},[171],{"type":26,"value":117},{"type":20,"tag":53,"props":173,"children":175},{"class":55,"line":174},14,[176],{"type":20,"tag":53,"props":177,"children":178},{"emptyLinePlaceholder":124},[179],{"type":26,"value":127},{"type":20,"tag":53,"props":181,"children":183},{"class":55,"line":182},15,[184],{"type":20,"tag":53,"props":185,"children":186},{"style":60},[187],{"type":26,"value":188},"    subgraph \"Autoscaling\"\n",{"type":20,"tag":53,"props":190,"children":192},{"class":55,"line":191},16,[193],{"type":20,"tag":53,"props":194,"children":195},{"style":60},[196],{"type":26,"value":197},"        CW[CloudWatch Metrics]\n",{"type":20,"tag":53,"props":199,"children":201},{"class":55,"line":200},17,[202],{"type":20,"tag":53,"props":203,"children":204},{"style":60},[205],{"type":26,"value":206},"        ASP[Application Auto Scaling]\n",{"type":20,"tag":53,"props":208,"children":210},{"class":55,"line":209},18,[211],{"type":20,"tag":53,"props":212,"children":213},{"style":60},[214],{"type":26,"value":215},"        TTP[Target Tracking Policy\u003Cbr/>CPU: 60% / Memory: 70%]\n",{"type":20,"tag":53,"props":217,"children":219},{"class":55,"line":218},19,[220],{"type":20,"tag":53,"props":221,"children":222},{"style":60},[223],{"type":26,"value":117},{"type":20,"tag":53,"props":225,"children":227},{"class":55,"line":226},20,[228],{"type":20,"tag":53,"props":229,"children":230},{"emptyLinePlaceholder":124},[231],{"type":26,"value":127},{"type":20,"tag":53,"props":233,"children":235},{"class":55,"line":234},21,[236],{"type":20,"tag":53,"props":237,"children":238},{"style":60},[239],{"type":26,"value":240},"    subgraph \"Supporting Services\"\n",{"type":20,"tag":53,"props":242,"children":244},{"class":55,"line":243},22,[245],{"type":20,"tag":53,"props":246,"children":247},{"style":60},[248],{"type":26,"value":249},"        ECR[ECR Registry]\n",{"type":20,"tag":53,"props":251,"children":253},{"class":55,"line":252},23,[254],{"type":20,"tag":53,"props":255,"children":256},{"style":60},[257],{"type":26,"value":258},"        SM[Secrets Manager]\n",{"type":20,"tag":53,"props":260,"children":262},{"class":55,"line":261},24,[263],{"type":20,"tag":53,"props":264,"children":265},{"style":60},[266],{"type":26,"value":267},"        CWL[CloudWatch Logs]\n",{"type":20,"tag":53,"props":269,"children":271},{"class":55,"line":270},25,[272],{"type":20,"tag":53,"props":273,"children":274},{"style":60},[275],{"type":26,"value":117},{"type":20,"tag":53,"props":277,"children":279},{"class":55,"line":278},26,[280],{"type":20,"tag":53,"props":281,"children":282},{"emptyLinePlaceholder":124},[283],{"type":26,"value":127},{"type":20,"tag":53,"props":285,"children":287},{"class":55,"line":286},27,[288],{"type":20,"tag":53,"props":289,"children":290},{"style":60},[291],{"type":26,"value":292},"    ALB --> TG1 --> SVC1\n",{"type":20,"tag":53,"props":294,"children":296},{"class":55,"line":295},28,[297],{"type":20,"tag":53,"props":298,"children":299},{"style":60},[300],{"type":26,"value":301},"    ALB --> TG2 --> SVC2\n",{"type":20,"tag":53,"props":303,"children":305},{"class":55,"line":304},29,[306],{"type":20,"tag":53,"props":307,"children":308},{"style":60},[309],{"type":26,"value":310},"    ALB --> TGN --> SVCN\n",{"type":20,"tag":53,"props":312,"children":314},{"class":55,"line":313},30,[315],{"type":20,"tag":53,"props":316,"children":317},{"emptyLinePlaceholder":124},[318],{"type":26,"value":127},{"type":20,"tag":53,"props":320,"children":322},{"class":55,"line":321},31,[323],{"type":20,"tag":53,"props":324,"children":325},{"style":60},[326],{"type":26,"value":327},"    SVC1 --> CW\n",{"type":20,"tag":53,"props":329,"children":331},{"class":55,"line":330},32,[332],{"type":20,"tag":53,"props":333,"children":334},{"style":60},[335],{"type":26,"value":336},"    SVC2 --> CW\n",{"type":20,"tag":53,"props":338,"children":340},{"class":55,"line":339},33,[341],{"type":20,"tag":53,"props":342,"children":343},{"style":60},[344],{"type":26,"value":345},"    SVCN --> CW\n",{"type":20,"tag":53,"props":347,"children":349},{"class":55,"line":348},34,[350],{"type":20,"tag":53,"props":351,"children":352},{"style":60},[353],{"type":26,"value":354},"    CW --> ASP\n",{"type":20,"tag":53,"props":356,"children":358},{"class":55,"line":357},35,[359],{"type":20,"tag":53,"props":360,"children":361},{"style":60},[362],{"type":26,"value":363},"    ASP --> TTP\n",{"type":20,"tag":53,"props":365,"children":367},{"class":55,"line":366},36,[368],{"type":20,"tag":53,"props":369,"children":370},{"style":60},[371],{"type":26,"value":372},"    TTP --> SVC1\n",{"type":20,"tag":53,"props":374,"children":376},{"class":55,"line":375},37,[377],{"type":20,"tag":53,"props":378,"children":379},{"style":60},[380],{"type":26,"value":381},"    TTP --> SVC2\n",{"type":20,"tag":53,"props":383,"children":385},{"class":55,"line":384},38,[386],{"type":20,"tag":53,"props":387,"children":388},{"style":60},[389],{"type":26,"value":390},"    TTP --> SVCN\n",{"type":20,"tag":53,"props":392,"children":394},{"class":55,"line":393},39,[395],{"type":20,"tag":53,"props":396,"children":397},{"emptyLinePlaceholder":124},[398],{"type":26,"value":127},{"type":20,"tag":53,"props":400,"children":402},{"class":55,"line":401},40,[403],{"type":20,"tag":53,"props":404,"children":405},{"style":60},[406],{"type":26,"value":407},"    ECR --> SVC1\n",{"type":20,"tag":53,"props":409,"children":411},{"class":55,"line":410},41,[412],{"type":20,"tag":53,"props":413,"children":414},{"style":60},[415],{"type":26,"value":416},"    ECR --> SVC2\n",{"type":20,"tag":53,"props":418,"children":420},{"class":55,"line":419},42,[421],{"type":20,"tag":53,"props":422,"children":423},{"style":60},[424],{"type":26,"value":425},"    SM --> SVC1\n",{"type":20,"tag":53,"props":427,"children":429},{"class":55,"line":428},43,[430],{"type":20,"tag":53,"props":431,"children":432},{"style":60},[433],{"type":26,"value":434},"    SVC1 --> CWL\n",{"type":20,"tag":53,"props":436,"children":438},{"class":55,"line":437},44,[439],{"type":20,"tag":53,"props":440,"children":441},{"emptyLinePlaceholder":124},[442],{"type":26,"value":127},{"type":20,"tag":53,"props":444,"children":446},{"class":55,"line":445},45,[447],{"type":20,"tag":53,"props":448,"children":449},{"style":60},[450],{"type":26,"value":451},"    style ALB fill:#4dabf7\n",{"type":20,"tag":53,"props":453,"children":455},{"class":55,"line":454},46,[456],{"type":20,"tag":53,"props":457,"children":458},{"style":60},[459],{"type":26,"value":460},"    style ASP fill:#51cf66\n",{"type":20,"tag":53,"props":462,"children":464},{"class":55,"line":463},47,[465],{"type":20,"tag":53,"props":466,"children":467},{"style":60},[468],{"type":26,"value":469},"    style TTP fill:#51cf66\n",{"type":20,"tag":35,"props":471,"children":473},{"id":472},"task-definition",[474],{"type":26,"value":475},"Task Definition",{"type":20,"tag":29,"props":477,"children":478},{},[479],{"type":26,"value":480},"The key to efficient Fargate usage is right-sizing your task definitions. I use a tiered approach:",{"type":20,"tag":42,"props":482,"children":486},{"className":483,"code":484,"language":485,"meta":7,"style":7},"language-hcl shiki shiki-themes material-theme-lighter github-light github-dark","resource \"aws_ecs_task_definition\" \"service\" {\n  family                   = \"my-service\"\n  network_mode             = \"awsvpc\"\n  requires_compatibilities = [\"FARGATE\"]\n  cpu                      = var.task_cpu\n  memory                   = var.task_memory\n  execution_role_arn       = aws_iam_role.ecs_execution.arn\n  task_role_arn            = aws_iam_role.ecs_task.arn\n\n  container_definitions = jsonencode([\n    {\n      name  = \"app\"\n      image = \"${aws_ecr_repository.app.repository_url}:${var.image_tag}\"\n      \n      portMappings = [\n        {\n          containerPort = 8080\n          protocol      = \"tcp\"\n        }\n      ]\n\n      logConfiguration = {\n        logDriver = \"awslogs\"\n        options = {\n          \"awslogs-group\"         = aws_cloudwatch_log_group.service.name\n          \"awslogs-region\"        = var.region\n          \"awslogs-stream-prefix\" = \"ecs\"\n        }\n      }\n\n      healthCheck = {\n        command     = [\"CMD-SHELL\", \"curl -f http://localhost:8080/health || exit 1\"]\n        interval    = 30\n        timeout     = 5\n        retries     = 3\n        startPeriod = 60\n      }\n\n      secrets = [\n        {\n          name      = \"DB_PASSWORD\"\n          valueFrom = aws_secretsmanager_secret.db_password.arn\n        }\n      ]\n    }\n  ])\n}\n","hcl",[487],{"type":20,"tag":49,"props":488,"children":489},{"__ignoreMap":7},[490,516,547,573,610,639,664,700,734,741,764,772,798,878,886,903,911,929,955,963,971,978,994,1019,1035,1062,1088,1120,1127,1135,1142,1158,1210,1228,1245,1262,1279,1286,1293,1309,1316,1341,1358,1365,1372,1380,1388],{"type":20,"tag":53,"props":491,"children":492},{"class":55,"line":56},[493,499,505,510],{"type":20,"tag":53,"props":494,"children":496},{"style":495},"--shiki-light:#E2931D;--shiki-default:#6F42C1;--shiki-dark:#B392F0",[497],{"type":26,"value":498},"resource",{"type":20,"tag":53,"props":500,"children":502},{"style":501},"--shiki-light:#90A4AE;--shiki-default:#005CC5;--shiki-dark:#79B8FF",[503],{"type":26,"value":504}," \"aws_ecs_task_definition\"",{"type":20,"tag":53,"props":506,"children":507},{"style":501},[508],{"type":26,"value":509}," \"service\"",{"type":20,"tag":53,"props":511,"children":513},{"style":512},"--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8",[514],{"type":26,"value":515}," {\n",{"type":20,"tag":53,"props":517,"children":518},{"class":55,"line":66},[519,524,530,536,542],{"type":20,"tag":53,"props":520,"children":521},{"style":60},[522],{"type":26,"value":523},"  family",{"type":20,"tag":53,"props":525,"children":527},{"style":526},"--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583",[528],{"type":26,"value":529},"                   =",{"type":20,"tag":53,"props":531,"children":533},{"style":532},"--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF",[534],{"type":26,"value":535}," \"",{"type":20,"tag":53,"props":537,"children":539},{"style":538},"--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF",[540],{"type":26,"value":541},"my-service",{"type":20,"tag":53,"props":543,"children":544},{"style":532},[545],{"type":26,"value":546},"\"\n",{"type":20,"tag":53,"props":548,"children":549},{"class":55,"line":75},[550,555,560,564,569],{"type":20,"tag":53,"props":551,"children":552},{"style":60},[553],{"type":26,"value":554},"  network_mode",{"type":20,"tag":53,"props":556,"children":557},{"style":526},[558],{"type":26,"value":559},"             =",{"type":20,"tag":53,"props":561,"children":562},{"style":532},[563],{"type":26,"value":535},{"type":20,"tag":53,"props":565,"children":566},{"style":538},[567],{"type":26,"value":568},"awsvpc",{"type":20,"tag":53,"props":570,"children":571},{"style":532},[572],{"type":26,"value":546},{"type":20,"tag":53,"props":574,"children":575},{"class":55,"line":84},[576,581,586,591,596,601,605],{"type":20,"tag":53,"props":577,"children":578},{"style":60},[579],{"type":26,"value":580},"  requires_compatibilities",{"type":20,"tag":53,"props":582,"children":583},{"style":526},[584],{"type":26,"value":585}," =",{"type":20,"tag":53,"props":587,"children":588},{"style":512},[589],{"type":26,"value":590}," [",{"type":20,"tag":53,"props":592,"children":593},{"style":532},[594],{"type":26,"value":595},"\"",{"type":20,"tag":53,"props":597,"children":598},{"style":538},[599],{"type":26,"value":600},"FARGATE",{"type":20,"tag":53,"props":602,"children":603},{"style":532},[604],{"type":26,"value":595},{"type":20,"tag":53,"props":606,"children":607},{"style":512},[608],{"type":26,"value":609},"]\n",{"type":20,"tag":53,"props":611,"children":612},{"class":55,"line":93},[613,618,623,629,634],{"type":20,"tag":53,"props":614,"children":615},{"style":60},[616],{"type":26,"value":617},"  cpu",{"type":20,"tag":53,"props":619,"children":620},{"style":526},[621],{"type":26,"value":622},"                      =",{"type":20,"tag":53,"props":624,"children":626},{"style":625},"--shiki-light:#E53935;--shiki-default:#24292E;--shiki-dark:#E1E4E8",[627],{"type":26,"value":628}," var",{"type":20,"tag":53,"props":630,"children":631},{"style":526},[632],{"type":26,"value":633},".",{"type":20,"tag":53,"props":635,"children":636},{"style":60},[637],{"type":26,"value":638},"task_cpu\n",{"type":20,"tag":53,"props":640,"children":641},{"class":55,"line":102},[642,647,651,655,659],{"type":20,"tag":53,"props":643,"children":644},{"style":60},[645],{"type":26,"value":646},"  memory",{"type":20,"tag":53,"props":648,"children":649},{"style":526},[650],{"type":26,"value":529},{"type":20,"tag":53,"props":652,"children":653},{"style":625},[654],{"type":26,"value":628},{"type":20,"tag":53,"props":656,"children":657},{"style":526},[658],{"type":26,"value":633},{"type":20,"tag":53,"props":660,"children":661},{"style":60},[662],{"type":26,"value":663},"task_memory\n",{"type":20,"tag":53,"props":665,"children":666},{"class":55,"line":111},[667,672,677,682,686,691,695],{"type":20,"tag":53,"props":668,"children":669},{"style":60},[670],{"type":26,"value":671},"  execution_role_arn",{"type":20,"tag":53,"props":673,"children":674},{"style":526},[675],{"type":26,"value":676},"       =",{"type":20,"tag":53,"props":678,"children":679},{"style":625},[680],{"type":26,"value":681}," aws_iam_role",{"type":20,"tag":53,"props":683,"children":684},{"style":526},[685],{"type":26,"value":633},{"type":20,"tag":53,"props":687,"children":688},{"style":60},[689],{"type":26,"value":690},"ecs_execution",{"type":20,"tag":53,"props":692,"children":693},{"style":526},[694],{"type":26,"value":633},{"type":20,"tag":53,"props":696,"children":697},{"style":60},[698],{"type":26,"value":699},"arn\n",{"type":20,"tag":53,"props":701,"children":702},{"class":55,"line":120},[703,708,713,717,721,726,730],{"type":20,"tag":53,"props":704,"children":705},{"style":60},[706],{"type":26,"value":707},"  task_role_arn",{"type":20,"tag":53,"props":709,"children":710},{"style":526},[711],{"type":26,"value":712},"            =",{"type":20,"tag":53,"props":714,"children":715},{"style":625},[716],{"type":26,"value":681},{"type":20,"tag":53,"props":718,"children":719},{"style":526},[720],{"type":26,"value":633},{"type":20,"tag":53,"props":722,"children":723},{"style":60},[724],{"type":26,"value":725},"ecs_task",{"type":20,"tag":53,"props":727,"children":728},{"style":526},[729],{"type":26,"value":633},{"type":20,"tag":53,"props":731,"children":732},{"style":60},[733],{"type":26,"value":699},{"type":20,"tag":53,"props":735,"children":736},{"class":55,"line":130},[737],{"type":20,"tag":53,"props":738,"children":739},{"emptyLinePlaceholder":124},[740],{"type":26,"value":127},{"type":20,"tag":53,"props":742,"children":743},{"class":55,"line":139},[744,749,753,759],{"type":20,"tag":53,"props":745,"children":746},{"style":60},[747],{"type":26,"value":748},"  container_definitions",{"type":20,"tag":53,"props":750,"children":751},{"style":526},[752],{"type":26,"value":585},{"type":20,"tag":53,"props":754,"children":756},{"style":755},"--shiki-light:#6182B8;--shiki-default:#005CC5;--shiki-dark:#79B8FF",[757],{"type":26,"value":758}," jsonencode",{"type":20,"tag":53,"props":760,"children":761},{"style":512},[762],{"type":26,"value":763},"([\n",{"type":20,"tag":53,"props":765,"children":766},{"class":55,"line":148},[767],{"type":20,"tag":53,"props":768,"children":769},{"style":512},[770],{"type":26,"value":771},"    {\n",{"type":20,"tag":53,"props":773,"children":774},{"class":55,"line":157},[775,780,785,789,794],{"type":20,"tag":53,"props":776,"children":777},{"style":60},[778],{"type":26,"value":779},"      name",{"type":20,"tag":53,"props":781,"children":782},{"style":526},[783],{"type":26,"value":784},"  =",{"type":20,"tag":53,"props":786,"children":787},{"style":532},[788],{"type":26,"value":535},{"type":20,"tag":53,"props":790,"children":791},{"style":538},[792],{"type":26,"value":793},"app",{"type":20,"tag":53,"props":795,"children":796},{"style":532},[797],{"type":26,"value":546},{"type":20,"tag":53,"props":799,"children":800},{"class":55,"line":166},[801,806,810,814,820,825,829,833,837,842,847,852,856,861,865,870,874],{"type":20,"tag":53,"props":802,"children":803},{"style":60},[804],{"type":26,"value":805},"      image",{"type":20,"tag":53,"props":807,"children":808},{"style":526},[809],{"type":26,"value":585},{"type":20,"tag":53,"props":811,"children":812},{"style":532},[813],{"type":26,"value":535},{"type":20,"tag":53,"props":815,"children":817},{"style":816},"--shiki-light:#F76D47;--shiki-default:#D73A49;--shiki-dark:#F97583",[818],{"type":26,"value":819},"${",{"type":20,"tag":53,"props":821,"children":822},{"style":60},[823],{"type":26,"value":824},"aws_ecr_repository",{"type":20,"tag":53,"props":826,"children":827},{"style":526},[828],{"type":26,"value":633},{"type":20,"tag":53,"props":830,"children":831},{"style":60},[832],{"type":26,"value":793},{"type":20,"tag":53,"props":834,"children":835},{"style":526},[836],{"type":26,"value":633},{"type":20,"tag":53,"props":838,"children":839},{"style":60},[840],{"type":26,"value":841},"repository_url",{"type":20,"tag":53,"props":843,"children":844},{"style":816},[845],{"type":26,"value":846},"}",{"type":20,"tag":53,"props":848,"children":849},{"style":538},[850],{"type":26,"value":851},":",{"type":20,"tag":53,"props":853,"children":854},{"style":816},[855],{"type":26,"value":819},{"type":20,"tag":53,"props":857,"children":858},{"style":60},[859],{"type":26,"value":860},"var",{"type":20,"tag":53,"props":862,"children":863},{"style":526},[864],{"type":26,"value":633},{"type":20,"tag":53,"props":866,"children":867},{"style":60},[868],{"type":26,"value":869},"image_tag",{"type":20,"tag":53,"props":871,"children":872},{"style":816},[873],{"type":26,"value":846},{"type":20,"tag":53,"props":875,"children":876},{"style":532},[877],{"type":26,"value":546},{"type":20,"tag":53,"props":879,"children":880},{"class":55,"line":174},[881],{"type":20,"tag":53,"props":882,"children":883},{"style":625},[884],{"type":26,"value":885},"      \n",{"type":20,"tag":53,"props":887,"children":888},{"class":55,"line":182},[889,894,898],{"type":20,"tag":53,"props":890,"children":891},{"style":60},[892],{"type":26,"value":893},"      portMappings",{"type":20,"tag":53,"props":895,"children":896},{"style":526},[897],{"type":26,"value":585},{"type":20,"tag":53,"props":899,"children":900},{"style":625},[901],{"type":26,"value":902}," [\n",{"type":20,"tag":53,"props":904,"children":905},{"class":55,"line":191},[906],{"type":20,"tag":53,"props":907,"children":908},{"style":512},[909],{"type":26,"value":910},"        {\n",{"type":20,"tag":53,"props":912,"children":913},{"class":55,"line":200},[914,919,923],{"type":20,"tag":53,"props":915,"children":916},{"style":60},[917],{"type":26,"value":918},"          containerPort",{"type":20,"tag":53,"props":920,"children":921},{"style":526},[922],{"type":26,"value":585},{"type":20,"tag":53,"props":924,"children":926},{"style":925},"--shiki-light:#F76D47;--shiki-default:#005CC5;--shiki-dark:#79B8FF",[927],{"type":26,"value":928}," 8080\n",{"type":20,"tag":53,"props":930,"children":931},{"class":55,"line":209},[932,937,942,946,951],{"type":20,"tag":53,"props":933,"children":934},{"style":60},[935],{"type":26,"value":936},"          protocol",{"type":20,"tag":53,"props":938,"children":939},{"style":526},[940],{"type":26,"value":941},"      =",{"type":20,"tag":53,"props":943,"children":944},{"style":532},[945],{"type":26,"value":535},{"type":20,"tag":53,"props":947,"children":948},{"style":538},[949],{"type":26,"value":950},"tcp",{"type":20,"tag":53,"props":952,"children":953},{"style":532},[954],{"type":26,"value":546},{"type":20,"tag":53,"props":956,"children":957},{"class":55,"line":218},[958],{"type":20,"tag":53,"props":959,"children":960},{"style":512},[961],{"type":26,"value":962},"        }\n",{"type":20,"tag":53,"props":964,"children":965},{"class":55,"line":226},[966],{"type":20,"tag":53,"props":967,"children":968},{"style":625},[969],{"type":26,"value":970},"      ]\n",{"type":20,"tag":53,"props":972,"children":973},{"class":55,"line":234},[974],{"type":20,"tag":53,"props":975,"children":976},{"emptyLinePlaceholder":124},[977],{"type":26,"value":127},{"type":20,"tag":53,"props":979,"children":980},{"class":55,"line":243},[981,986,990],{"type":20,"tag":53,"props":982,"children":983},{"style":60},[984],{"type":26,"value":985},"      logConfiguration",{"type":20,"tag":53,"props":987,"children":988},{"style":526},[989],{"type":26,"value":585},{"type":20,"tag":53,"props":991,"children":992},{"style":512},[993],{"type":26,"value":515},{"type":20,"tag":53,"props":995,"children":996},{"class":55,"line":252},[997,1002,1006,1010,1015],{"type":20,"tag":53,"props":998,"children":999},{"style":60},[1000],{"type":26,"value":1001},"        logDriver",{"type":20,"tag":53,"props":1003,"children":1004},{"style":526},[1005],{"type":26,"value":585},{"type":20,"tag":53,"props":1007,"children":1008},{"style":532},[1009],{"type":26,"value":535},{"type":20,"tag":53,"props":1011,"children":1012},{"style":538},[1013],{"type":26,"value":1014},"awslogs",{"type":20,"tag":53,"props":1016,"children":1017},{"style":532},[1018],{"type":26,"value":546},{"type":20,"tag":53,"props":1020,"children":1021},{"class":55,"line":261},[1022,1027,1031],{"type":20,"tag":53,"props":1023,"children":1024},{"style":60},[1025],{"type":26,"value":1026},"        options",{"type":20,"tag":53,"props":1028,"children":1029},{"style":526},[1030],{"type":26,"value":585},{"type":20,"tag":53,"props":1032,"children":1033},{"style":512},[1034],{"type":26,"value":515},{"type":20,"tag":53,"props":1036,"children":1037},{"class":55,"line":270},[1038,1043,1048,1052,1057],{"type":20,"tag":53,"props":1039,"children":1040},{"style":532},[1041],{"type":26,"value":1042},"          \"",{"type":20,"tag":53,"props":1044,"children":1045},{"style":538},[1046],{"type":26,"value":1047},"awslogs-group",{"type":20,"tag":53,"props":1049,"children":1050},{"style":532},[1051],{"type":26,"value":595},{"type":20,"tag":53,"props":1053,"children":1054},{"style":526},[1055],{"type":26,"value":1056},"         =",{"type":20,"tag":53,"props":1058,"children":1059},{"style":625},[1060],{"type":26,"value":1061}," aws_cloudwatch_log_group.service.name\n",{"type":20,"tag":53,"props":1063,"children":1064},{"class":55,"line":278},[1065,1069,1074,1078,1083],{"type":20,"tag":53,"props":1066,"children":1067},{"style":532},[1068],{"type":26,"value":1042},{"type":20,"tag":53,"props":1070,"children":1071},{"style":538},[1072],{"type":26,"value":1073},"awslogs-region",{"type":20,"tag":53,"props":1075,"children":1076},{"style":532},[1077],{"type":26,"value":595},{"type":20,"tag":53,"props":1079,"children":1080},{"style":526},[1081],{"type":26,"value":1082},"        =",{"type":20,"tag":53,"props":1084,"children":1085},{"style":625},[1086],{"type":26,"value":1087}," var.region\n",{"type":20,"tag":53,"props":1089,"children":1090},{"class":55,"line":286},[1091,1095,1100,1104,1108,1112,1116],{"type":20,"tag":53,"props":1092,"children":1093},{"style":532},[1094],{"type":26,"value":1042},{"type":20,"tag":53,"props":1096,"children":1097},{"style":538},[1098],{"type":26,"value":1099},"awslogs-stream-prefix",{"type":20,"tag":53,"props":1101,"children":1102},{"style":532},[1103],{"type":26,"value":595},{"type":20,"tag":53,"props":1105,"children":1106},{"style":526},[1107],{"type":26,"value":585},{"type":20,"tag":53,"props":1109,"children":1110},{"style":532},[1111],{"type":26,"value":535},{"type":20,"tag":53,"props":1113,"children":1114},{"style":538},[1115],{"type":26,"value":12},{"type":20,"tag":53,"props":1117,"children":1118},{"style":532},[1119],{"type":26,"value":546},{"type":20,"tag":53,"props":1121,"children":1122},{"class":55,"line":295},[1123],{"type":20,"tag":53,"props":1124,"children":1125},{"style":512},[1126],{"type":26,"value":962},{"type":20,"tag":53,"props":1128,"children":1129},{"class":55,"line":304},[1130],{"type":20,"tag":53,"props":1131,"children":1132},{"style":512},[1133],{"type":26,"value":1134},"      }\n",{"type":20,"tag":53,"props":1136,"children":1137},{"class":55,"line":313},[1138],{"type":20,"tag":53,"props":1139,"children":1140},{"emptyLinePlaceholder":124},[1141],{"type":26,"value":127},{"type":20,"tag":53,"props":1143,"children":1144},{"class":55,"line":321},[1145,1150,1154],{"type":20,"tag":53,"props":1146,"children":1147},{"style":60},[1148],{"type":26,"value":1149},"      healthCheck",{"type":20,"tag":53,"props":1151,"children":1152},{"style":526},[1153],{"type":26,"value":585},{"type":20,"tag":53,"props":1155,"children":1156},{"style":512},[1157],{"type":26,"value":515},{"type":20,"tag":53,"props":1159,"children":1160},{"class":55,"line":330},[1161,1166,1171,1175,1179,1184,1188,1193,1197,1202,1206],{"type":20,"tag":53,"props":1162,"children":1163},{"style":60},[1164],{"type":26,"value":1165},"        command",{"type":20,"tag":53,"props":1167,"children":1168},{"style":526},[1169],{"type":26,"value":1170},"     =",{"type":20,"tag":53,"props":1172,"children":1173},{"style":625},[1174],{"type":26,"value":590},{"type":20,"tag":53,"props":1176,"children":1177},{"style":532},[1178],{"type":26,"value":595},{"type":20,"tag":53,"props":1180,"children":1181},{"style":538},[1182],{"type":26,"value":1183},"CMD-SHELL",{"type":20,"tag":53,"props":1185,"children":1186},{"style":532},[1187],{"type":26,"value":595},{"type":20,"tag":53,"props":1189,"children":1190},{"style":625},[1191],{"type":26,"value":1192},", ",{"type":20,"tag":53,"props":1194,"children":1195},{"style":532},[1196],{"type":26,"value":595},{"type":20,"tag":53,"props":1198,"children":1199},{"style":538},[1200],{"type":26,"value":1201},"curl -f http://localhost:8080/health || exit 1",{"type":20,"tag":53,"props":1203,"children":1204},{"style":532},[1205],{"type":26,"value":595},{"type":20,"tag":53,"props":1207,"children":1208},{"style":625},[1209],{"type":26,"value":609},{"type":20,"tag":53,"props":1211,"children":1212},{"class":55,"line":339},[1213,1218,1223],{"type":20,"tag":53,"props":1214,"children":1215},{"style":60},[1216],{"type":26,"value":1217},"        interval",{"type":20,"tag":53,"props":1219,"children":1220},{"style":526},[1221],{"type":26,"value":1222},"    =",{"type":20,"tag":53,"props":1224,"children":1225},{"style":925},[1226],{"type":26,"value":1227}," 30\n",{"type":20,"tag":53,"props":1229,"children":1230},{"class":55,"line":348},[1231,1236,1240],{"type":20,"tag":53,"props":1232,"children":1233},{"style":60},[1234],{"type":26,"value":1235},"        timeout",{"type":20,"tag":53,"props":1237,"children":1238},{"style":526},[1239],{"type":26,"value":1170},{"type":20,"tag":53,"props":1241,"children":1242},{"style":925},[1243],{"type":26,"value":1244}," 5\n",{"type":20,"tag":53,"props":1246,"children":1247},{"class":55,"line":357},[1248,1253,1257],{"type":20,"tag":53,"props":1249,"children":1250},{"style":60},[1251],{"type":26,"value":1252},"        retries",{"type":20,"tag":53,"props":1254,"children":1255},{"style":526},[1256],{"type":26,"value":1170},{"type":20,"tag":53,"props":1258,"children":1259},{"style":925},[1260],{"type":26,"value":1261}," 3\n",{"type":20,"tag":53,"props":1263,"children":1264},{"class":55,"line":366},[1265,1270,1274],{"type":20,"tag":53,"props":1266,"children":1267},{"style":60},[1268],{"type":26,"value":1269},"        startPeriod",{"type":20,"tag":53,"props":1271,"children":1272},{"style":526},[1273],{"type":26,"value":585},{"type":20,"tag":53,"props":1275,"children":1276},{"style":925},[1277],{"type":26,"value":1278}," 60\n",{"type":20,"tag":53,"props":1280,"children":1281},{"class":55,"line":375},[1282],{"type":20,"tag":53,"props":1283,"children":1284},{"style":512},[1285],{"type":26,"value":1134},{"type":20,"tag":53,"props":1287,"children":1288},{"class":55,"line":384},[1289],{"type":20,"tag":53,"props":1290,"children":1291},{"emptyLinePlaceholder":124},[1292],{"type":26,"value":127},{"type":20,"tag":53,"props":1294,"children":1295},{"class":55,"line":393},[1296,1301,1305],{"type":20,"tag":53,"props":1297,"children":1298},{"style":60},[1299],{"type":26,"value":1300},"      secrets",{"type":20,"tag":53,"props":1302,"children":1303},{"style":526},[1304],{"type":26,"value":585},{"type":20,"tag":53,"props":1306,"children":1307},{"style":625},[1308],{"type":26,"value":902},{"type":20,"tag":53,"props":1310,"children":1311},{"class":55,"line":401},[1312],{"type":20,"tag":53,"props":1313,"children":1314},{"style":512},[1315],{"type":26,"value":910},{"type":20,"tag":53,"props":1317,"children":1318},{"class":55,"line":410},[1319,1324,1328,1332,1337],{"type":20,"tag":53,"props":1320,"children":1321},{"style":60},[1322],{"type":26,"value":1323},"          name",{"type":20,"tag":53,"props":1325,"children":1326},{"style":526},[1327],{"type":26,"value":941},{"type":20,"tag":53,"props":1329,"children":1330},{"style":532},[1331],{"type":26,"value":535},{"type":20,"tag":53,"props":1333,"children":1334},{"style":538},[1335],{"type":26,"value":1336},"DB_PASSWORD",{"type":20,"tag":53,"props":1338,"children":1339},{"style":532},[1340],{"type":26,"value":546},{"type":20,"tag":53,"props":1342,"children":1343},{"class":55,"line":419},[1344,1349,1353],{"type":20,"tag":53,"props":1345,"children":1346},{"style":60},[1347],{"type":26,"value":1348},"          valueFrom",{"type":20,"tag":53,"props":1350,"children":1351},{"style":526},[1352],{"type":26,"value":585},{"type":20,"tag":53,"props":1354,"children":1355},{"style":625},[1356],{"type":26,"value":1357}," aws_secretsmanager_secret.db_password.arn\n",{"type":20,"tag":53,"props":1359,"children":1360},{"class":55,"line":428},[1361],{"type":20,"tag":53,"props":1362,"children":1363},{"style":512},[1364],{"type":26,"value":962},{"type":20,"tag":53,"props":1366,"children":1367},{"class":55,"line":437},[1368],{"type":20,"tag":53,"props":1369,"children":1370},{"style":625},[1371],{"type":26,"value":970},{"type":20,"tag":53,"props":1373,"children":1374},{"class":55,"line":445},[1375],{"type":20,"tag":53,"props":1376,"children":1377},{"style":512},[1378],{"type":26,"value":1379},"    }\n",{"type":20,"tag":53,"props":1381,"children":1382},{"class":55,"line":454},[1383],{"type":20,"tag":53,"props":1384,"children":1385},{"style":512},[1386],{"type":26,"value":1387},"  ])\n",{"type":20,"tag":53,"props":1389,"children":1390},{"class":55,"line":463},[1391],{"type":20,"tag":53,"props":1392,"children":1393},{"style":512},[1394],{"type":26,"value":1395},"}\n",{"type":20,"tag":35,"props":1397,"children":1399},{"id":1398},"autoscaling-configuration",[1400],{"type":26,"value":1401},"Autoscaling Configuration",{"type":20,"tag":29,"props":1403,"children":1404},{},[1405],{"type":26,"value":1406},"Target tracking is the cleanest approach — you set a target metric value and AWS handles the rest:",{"type":20,"tag":42,"props":1408,"children":1410},{"className":483,"code":1409,"language":485,"meta":7,"style":7},"resource \"aws_appautoscaling_target\" \"ecs\" {\n  max_capacity       = var.max_tasks\n  min_capacity       = var.min_tasks\n  resource_id        = \"service/${aws_ecs_cluster.main.name}/${aws_ecs_service.app.name}\"\n  scalable_dimension = \"ecs:service:DesiredCount\"\n  service_namespace  = \"ecs\"\n}\n\n# Scale based on CPU utilization\nresource \"aws_appautoscaling_policy\" \"cpu\" {\n  name               = \"${var.service_name}-cpu-scaling\"\n  policy_type        = \"TargetTrackingScaling\"\n  resource_id        = aws_appautoscaling_target.ecs.resource_id\n  scalable_dimension = aws_appautoscaling_target.ecs.scalable_dimension\n  service_namespace  = aws_appautoscaling_target.ecs.service_namespace\n\n  target_tracking_scaling_policy_configuration {\n    target_value       = 60.0\n    scale_in_cooldown  = 300\n    scale_out_cooldown = 60\n\n    predefined_metric_specification {\n      predefined_metric_type = \"ECSServiceAverageCPUUtilization\"\n    }\n  }\n}\n\n# Scale based on Memory utilization\nresource \"aws_appautoscaling_policy\" \"memory\" {\n  name               = \"${var.service_name}-memory-scaling\"\n  policy_type        = \"TargetTrackingScaling\"\n  resource_id        = aws_appautoscaling_target.ecs.resource_id\n  scalable_dimension = aws_appautoscaling_target.ecs.scalable_dimension\n  service_namespace  = aws_appautoscaling_target.ecs.service_namespace\n\n  target_tracking_scaling_policy_configuration {\n    target_value       = 70.0\n    scale_in_cooldown  = 300\n    scale_out_cooldown = 60\n\n    predefined_metric_specification {\n      predefined_metric_type = \"ECSServiceAverageMemoryUtilization\"\n    }\n  }\n}\n",[1411],{"type":20,"tag":49,"props":1412,"children":1413},{"__ignoreMap":7},[1414,1435,1460,1485,1575,1600,1624,1631,1638,1647,1668,1715,1740,1773,1805,1837,1844,1856,1883,1900,1916,1923,1935,1960,1967,1975,1982,1989,1997,2017,2061,2084,2115,2146,2177,2184,2195,2219,2234,2249,2256,2267,2291,2298,2305],{"type":20,"tag":53,"props":1415,"children":1416},{"class":55,"line":56},[1417,1421,1426,1431],{"type":20,"tag":53,"props":1418,"children":1419},{"style":495},[1420],{"type":26,"value":498},{"type":20,"tag":53,"props":1422,"children":1423},{"style":501},[1424],{"type":26,"value":1425}," \"aws_appautoscaling_target\"",{"type":20,"tag":53,"props":1427,"children":1428},{"style":501},[1429],{"type":26,"value":1430}," \"ecs\"",{"type":20,"tag":53,"props":1432,"children":1433},{"style":512},[1434],{"type":26,"value":515},{"type":20,"tag":53,"props":1436,"children":1437},{"class":55,"line":66},[1438,1443,1447,1451,1455],{"type":20,"tag":53,"props":1439,"children":1440},{"style":60},[1441],{"type":26,"value":1442},"  max_capacity",{"type":20,"tag":53,"props":1444,"children":1445},{"style":526},[1446],{"type":26,"value":676},{"type":20,"tag":53,"props":1448,"children":1449},{"style":625},[1450],{"type":26,"value":628},{"type":20,"tag":53,"props":1452,"children":1453},{"style":526},[1454],{"type":26,"value":633},{"type":20,"tag":53,"props":1456,"children":1457},{"style":60},[1458],{"type":26,"value":1459},"max_tasks\n",{"type":20,"tag":53,"props":1461,"children":1462},{"class":55,"line":75},[1463,1468,1472,1476,1480],{"type":20,"tag":53,"props":1464,"children":1465},{"style":60},[1466],{"type":26,"value":1467},"  min_capacity",{"type":20,"tag":53,"props":1469,"children":1470},{"style":526},[1471],{"type":26,"value":676},{"type":20,"tag":53,"props":1473,"children":1474},{"style":625},[1475],{"type":26,"value":628},{"type":20,"tag":53,"props":1477,"children":1478},{"style":526},[1479],{"type":26,"value":633},{"type":20,"tag":53,"props":1481,"children":1482},{"style":60},[1483],{"type":26,"value":1484},"min_tasks\n",{"type":20,"tag":53,"props":1486,"children":1487},{"class":55,"line":84},[1488,1493,1497,1501,1506,1510,1515,1519,1524,1528,1533,1537,1542,1546,1551,1555,1559,1563,1567,1571],{"type":20,"tag":53,"props":1489,"children":1490},{"style":60},[1491],{"type":26,"value":1492},"  resource_id",{"type":20,"tag":53,"props":1494,"children":1495},{"style":526},[1496],{"type":26,"value":1082},{"type":20,"tag":53,"props":1498,"children":1499},{"style":532},[1500],{"type":26,"value":535},{"type":20,"tag":53,"props":1502,"children":1503},{"style":538},[1504],{"type":26,"value":1505},"service/",{"type":20,"tag":53,"props":1507,"children":1508},{"style":816},[1509],{"type":26,"value":819},{"type":20,"tag":53,"props":1511,"children":1512},{"style":60},[1513],{"type":26,"value":1514},"aws_ecs_cluster",{"type":20,"tag":53,"props":1516,"children":1517},{"style":526},[1518],{"type":26,"value":633},{"type":20,"tag":53,"props":1520,"children":1521},{"style":60},[1522],{"type":26,"value":1523},"main",{"type":20,"tag":53,"props":1525,"children":1526},{"style":526},[1527],{"type":26,"value":633},{"type":20,"tag":53,"props":1529,"children":1530},{"style":60},[1531],{"type":26,"value":1532},"name",{"type":20,"tag":53,"props":1534,"children":1535},{"style":816},[1536],{"type":26,"value":846},{"type":20,"tag":53,"props":1538,"children":1539},{"style":538},[1540],{"type":26,"value":1541},"/",{"type":20,"tag":53,"props":1543,"children":1544},{"style":816},[1545],{"type":26,"value":819},{"type":20,"tag":53,"props":1547,"children":1548},{"style":60},[1549],{"type":26,"value":1550},"aws_ecs_service",{"type":20,"tag":53,"props":1552,"children":1553},{"style":526},[1554],{"type":26,"value":633},{"type":20,"tag":53,"props":1556,"children":1557},{"style":60},[1558],{"type":26,"value":793},{"type":20,"tag":53,"props":1560,"children":1561},{"style":526},[1562],{"type":26,"value":633},{"type":20,"tag":53,"props":1564,"children":1565},{"style":60},[1566],{"type":26,"value":1532},{"type":20,"tag":53,"props":1568,"children":1569},{"style":816},[1570],{"type":26,"value":846},{"type":20,"tag":53,"props":1572,"children":1573},{"style":532},[1574],{"type":26,"value":546},{"type":20,"tag":53,"props":1576,"children":1577},{"class":55,"line":93},[1578,1583,1587,1591,1596],{"type":20,"tag":53,"props":1579,"children":1580},{"style":60},[1581],{"type":26,"value":1582},"  scalable_dimension",{"type":20,"tag":53,"props":1584,"children":1585},{"style":526},[1586],{"type":26,"value":585},{"type":20,"tag":53,"props":1588,"children":1589},{"style":532},[1590],{"type":26,"value":535},{"type":20,"tag":53,"props":1592,"children":1593},{"style":538},[1594],{"type":26,"value":1595},"ecs:service:DesiredCount",{"type":20,"tag":53,"props":1597,"children":1598},{"style":532},[1599],{"type":26,"value":546},{"type":20,"tag":53,"props":1601,"children":1602},{"class":55,"line":102},[1603,1608,1612,1616,1620],{"type":20,"tag":53,"props":1604,"children":1605},{"style":60},[1606],{"type":26,"value":1607},"  service_namespace",{"type":20,"tag":53,"props":1609,"children":1610},{"style":526},[1611],{"type":26,"value":784},{"type":20,"tag":53,"props":1613,"children":1614},{"style":532},[1615],{"type":26,"value":535},{"type":20,"tag":53,"props":1617,"children":1618},{"style":538},[1619],{"type":26,"value":12},{"type":20,"tag":53,"props":1621,"children":1622},{"style":532},[1623],{"type":26,"value":546},{"type":20,"tag":53,"props":1625,"children":1626},{"class":55,"line":111},[1627],{"type":20,"tag":53,"props":1628,"children":1629},{"style":512},[1630],{"type":26,"value":1395},{"type":20,"tag":53,"props":1632,"children":1633},{"class":55,"line":120},[1634],{"type":20,"tag":53,"props":1635,"children":1636},{"emptyLinePlaceholder":124},[1637],{"type":26,"value":127},{"type":20,"tag":53,"props":1639,"children":1640},{"class":55,"line":130},[1641],{"type":20,"tag":53,"props":1642,"children":1644},{"style":1643},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#6A737D;--shiki-default-font-style:inherit;--shiki-dark:#6A737D;--shiki-dark-font-style:inherit",[1645],{"type":26,"value":1646},"# Scale based on CPU utilization\n",{"type":20,"tag":53,"props":1648,"children":1649},{"class":55,"line":139},[1650,1654,1659,1664],{"type":20,"tag":53,"props":1651,"children":1652},{"style":495},[1653],{"type":26,"value":498},{"type":20,"tag":53,"props":1655,"children":1656},{"style":501},[1657],{"type":26,"value":1658}," \"aws_appautoscaling_policy\"",{"type":20,"tag":53,"props":1660,"children":1661},{"style":501},[1662],{"type":26,"value":1663}," \"cpu\"",{"type":20,"tag":53,"props":1665,"children":1666},{"style":512},[1667],{"type":26,"value":515},{"type":20,"tag":53,"props":1669,"children":1670},{"class":55,"line":148},[1671,1676,1681,1685,1689,1693,1697,1702,1706,1711],{"type":20,"tag":53,"props":1672,"children":1673},{"style":60},[1674],{"type":26,"value":1675},"  name",{"type":20,"tag":53,"props":1677,"children":1678},{"style":526},[1679],{"type":26,"value":1680},"               =",{"type":20,"tag":53,"props":1682,"children":1683},{"style":532},[1684],{"type":26,"value":535},{"type":20,"tag":53,"props":1686,"children":1687},{"style":816},[1688],{"type":26,"value":819},{"type":20,"tag":53,"props":1690,"children":1691},{"style":60},[1692],{"type":26,"value":860},{"type":20,"tag":53,"props":1694,"children":1695},{"style":526},[1696],{"type":26,"value":633},{"type":20,"tag":53,"props":1698,"children":1699},{"style":60},[1700],{"type":26,"value":1701},"service_name",{"type":20,"tag":53,"props":1703,"children":1704},{"style":816},[1705],{"type":26,"value":846},{"type":20,"tag":53,"props":1707,"children":1708},{"style":538},[1709],{"type":26,"value":1710},"-cpu-scaling",{"type":20,"tag":53,"props":1712,"children":1713},{"style":532},[1714],{"type":26,"value":546},{"type":20,"tag":53,"props":1716,"children":1717},{"class":55,"line":157},[1718,1723,1727,1731,1736],{"type":20,"tag":53,"props":1719,"children":1720},{"style":60},[1721],{"type":26,"value":1722},"  policy_type",{"type":20,"tag":53,"props":1724,"children":1725},{"style":526},[1726],{"type":26,"value":1082},{"type":20,"tag":53,"props":1728,"children":1729},{"style":532},[1730],{"type":26,"value":535},{"type":20,"tag":53,"props":1732,"children":1733},{"style":538},[1734],{"type":26,"value":1735},"TargetTrackingScaling",{"type":20,"tag":53,"props":1737,"children":1738},{"style":532},[1739],{"type":26,"value":546},{"type":20,"tag":53,"props":1741,"children":1742},{"class":55,"line":166},[1743,1747,1751,1756,1760,1764,1768],{"type":20,"tag":53,"props":1744,"children":1745},{"style":60},[1746],{"type":26,"value":1492},{"type":20,"tag":53,"props":1748,"children":1749},{"style":526},[1750],{"type":26,"value":1082},{"type":20,"tag":53,"props":1752,"children":1753},{"style":625},[1754],{"type":26,"value":1755}," aws_appautoscaling_target",{"type":20,"tag":53,"props":1757,"children":1758},{"style":526},[1759],{"type":26,"value":633},{"type":20,"tag":53,"props":1761,"children":1762},{"style":60},[1763],{"type":26,"value":12},{"type":20,"tag":53,"props":1765,"children":1766},{"style":526},[1767],{"type":26,"value":633},{"type":20,"tag":53,"props":1769,"children":1770},{"style":60},[1771],{"type":26,"value":1772},"resource_id\n",{"type":20,"tag":53,"props":1774,"children":1775},{"class":55,"line":174},[1776,1780,1784,1788,1792,1796,1800],{"type":20,"tag":53,"props":1777,"children":1778},{"style":60},[1779],{"type":26,"value":1582},{"type":20,"tag":53,"props":1781,"children":1782},{"style":526},[1783],{"type":26,"value":585},{"type":20,"tag":53,"props":1785,"children":1786},{"style":625},[1787],{"type":26,"value":1755},{"type":20,"tag":53,"props":1789,"children":1790},{"style":526},[1791],{"type":26,"value":633},{"type":20,"tag":53,"props":1793,"children":1794},{"style":60},[1795],{"type":26,"value":12},{"type":20,"tag":53,"props":1797,"children":1798},{"style":526},[1799],{"type":26,"value":633},{"type":20,"tag":53,"props":1801,"children":1802},{"style":60},[1803],{"type":26,"value":1804},"scalable_dimension\n",{"type":20,"tag":53,"props":1806,"children":1807},{"class":55,"line":182},[1808,1812,1816,1820,1824,1828,1832],{"type":20,"tag":53,"props":1809,"children":1810},{"style":60},[1811],{"type":26,"value":1607},{"type":20,"tag":53,"props":1813,"children":1814},{"style":526},[1815],{"type":26,"value":784},{"type":20,"tag":53,"props":1817,"children":1818},{"style":625},[1819],{"type":26,"value":1755},{"type":20,"tag":53,"props":1821,"children":1822},{"style":526},[1823],{"type":26,"value":633},{"type":20,"tag":53,"props":1825,"children":1826},{"style":60},[1827],{"type":26,"value":12},{"type":20,"tag":53,"props":1829,"children":1830},{"style":526},[1831],{"type":26,"value":633},{"type":20,"tag":53,"props":1833,"children":1834},{"style":60},[1835],{"type":26,"value":1836},"service_namespace\n",{"type":20,"tag":53,"props":1838,"children":1839},{"class":55,"line":191},[1840],{"type":20,"tag":53,"props":1841,"children":1842},{"emptyLinePlaceholder":124},[1843],{"type":26,"value":127},{"type":20,"tag":53,"props":1845,"children":1846},{"class":55,"line":200},[1847,1852],{"type":20,"tag":53,"props":1848,"children":1849},{"style":495},[1850],{"type":26,"value":1851},"  target_tracking_scaling_policy_configuration",{"type":20,"tag":53,"props":1853,"children":1854},{"style":512},[1855],{"type":26,"value":515},{"type":20,"tag":53,"props":1857,"children":1858},{"class":55,"line":209},[1859,1864,1868,1873,1878],{"type":20,"tag":53,"props":1860,"children":1861},{"style":60},[1862],{"type":26,"value":1863},"    target_value",{"type":20,"tag":53,"props":1865,"children":1866},{"style":526},[1867],{"type":26,"value":676},{"type":20,"tag":53,"props":1869,"children":1870},{"style":925},[1871],{"type":26,"value":1872}," 60",{"type":20,"tag":53,"props":1874,"children":1876},{"style":1875},"--shiki-light:#39ADB5;--shiki-default:#005CC5;--shiki-dark:#79B8FF",[1877],{"type":26,"value":633},{"type":20,"tag":53,"props":1879,"children":1880},{"style":925},[1881],{"type":26,"value":1882},"0\n",{"type":20,"tag":53,"props":1884,"children":1885},{"class":55,"line":218},[1886,1891,1895],{"type":20,"tag":53,"props":1887,"children":1888},{"style":60},[1889],{"type":26,"value":1890},"    scale_in_cooldown",{"type":20,"tag":53,"props":1892,"children":1893},{"style":526},[1894],{"type":26,"value":784},{"type":20,"tag":53,"props":1896,"children":1897},{"style":925},[1898],{"type":26,"value":1899}," 300\n",{"type":20,"tag":53,"props":1901,"children":1902},{"class":55,"line":226},[1903,1908,1912],{"type":20,"tag":53,"props":1904,"children":1905},{"style":60},[1906],{"type":26,"value":1907},"    scale_out_cooldown",{"type":20,"tag":53,"props":1909,"children":1910},{"style":526},[1911],{"type":26,"value":585},{"type":20,"tag":53,"props":1913,"children":1914},{"style":925},[1915],{"type":26,"value":1278},{"type":20,"tag":53,"props":1917,"children":1918},{"class":55,"line":234},[1919],{"type":20,"tag":53,"props":1920,"children":1921},{"emptyLinePlaceholder":124},[1922],{"type":26,"value":127},{"type":20,"tag":53,"props":1924,"children":1925},{"class":55,"line":243},[1926,1931],{"type":20,"tag":53,"props":1927,"children":1928},{"style":495},[1929],{"type":26,"value":1930},"    predefined_metric_specification",{"type":20,"tag":53,"props":1932,"children":1933},{"style":512},[1934],{"type":26,"value":515},{"type":20,"tag":53,"props":1936,"children":1937},{"class":55,"line":252},[1938,1943,1947,1951,1956],{"type":20,"tag":53,"props":1939,"children":1940},{"style":60},[1941],{"type":26,"value":1942},"      predefined_metric_type",{"type":20,"tag":53,"props":1944,"children":1945},{"style":526},[1946],{"type":26,"value":585},{"type":20,"tag":53,"props":1948,"children":1949},{"style":532},[1950],{"type":26,"value":535},{"type":20,"tag":53,"props":1952,"children":1953},{"style":538},[1954],{"type":26,"value":1955},"ECSServiceAverageCPUUtilization",{"type":20,"tag":53,"props":1957,"children":1958},{"style":532},[1959],{"type":26,"value":546},{"type":20,"tag":53,"props":1961,"children":1962},{"class":55,"line":261},[1963],{"type":20,"tag":53,"props":1964,"children":1965},{"style":512},[1966],{"type":26,"value":1379},{"type":20,"tag":53,"props":1968,"children":1969},{"class":55,"line":270},[1970],{"type":20,"tag":53,"props":1971,"children":1972},{"style":512},[1973],{"type":26,"value":1974},"  }\n",{"type":20,"tag":53,"props":1976,"children":1977},{"class":55,"line":278},[1978],{"type":20,"tag":53,"props":1979,"children":1980},{"style":512},[1981],{"type":26,"value":1395},{"type":20,"tag":53,"props":1983,"children":1984},{"class":55,"line":286},[1985],{"type":20,"tag":53,"props":1986,"children":1987},{"emptyLinePlaceholder":124},[1988],{"type":26,"value":127},{"type":20,"tag":53,"props":1990,"children":1991},{"class":55,"line":295},[1992],{"type":20,"tag":53,"props":1993,"children":1994},{"style":1643},[1995],{"type":26,"value":1996},"# Scale based on Memory utilization\n",{"type":20,"tag":53,"props":1998,"children":1999},{"class":55,"line":304},[2000,2004,2008,2013],{"type":20,"tag":53,"props":2001,"children":2002},{"style":495},[2003],{"type":26,"value":498},{"type":20,"tag":53,"props":2005,"children":2006},{"style":501},[2007],{"type":26,"value":1658},{"type":20,"tag":53,"props":2009,"children":2010},{"style":501},[2011],{"type":26,"value":2012}," \"memory\"",{"type":20,"tag":53,"props":2014,"children":2015},{"style":512},[2016],{"type":26,"value":515},{"type":20,"tag":53,"props":2018,"children":2019},{"class":55,"line":313},[2020,2024,2028,2032,2036,2040,2044,2048,2052,2057],{"type":20,"tag":53,"props":2021,"children":2022},{"style":60},[2023],{"type":26,"value":1675},{"type":20,"tag":53,"props":2025,"children":2026},{"style":526},[2027],{"type":26,"value":1680},{"type":20,"tag":53,"props":2029,"children":2030},{"style":532},[2031],{"type":26,"value":535},{"type":20,"tag":53,"props":2033,"children":2034},{"style":816},[2035],{"type":26,"value":819},{"type":20,"tag":53,"props":2037,"children":2038},{"style":60},[2039],{"type":26,"value":860},{"type":20,"tag":53,"props":2041,"children":2042},{"style":526},[2043],{"type":26,"value":633},{"type":20,"tag":53,"props":2045,"children":2046},{"style":60},[2047],{"type":26,"value":1701},{"type":20,"tag":53,"props":2049,"children":2050},{"style":816},[2051],{"type":26,"value":846},{"type":20,"tag":53,"props":2053,"children":2054},{"style":538},[2055],{"type":26,"value":2056},"-memory-scaling",{"type":20,"tag":53,"props":2058,"children":2059},{"style":532},[2060],{"type":26,"value":546},{"type":20,"tag":53,"props":2062,"children":2063},{"class":55,"line":321},[2064,2068,2072,2076,2080],{"type":20,"tag":53,"props":2065,"children":2066},{"style":60},[2067],{"type":26,"value":1722},{"type":20,"tag":53,"props":2069,"children":2070},{"style":526},[2071],{"type":26,"value":1082},{"type":20,"tag":53,"props":2073,"children":2074},{"style":532},[2075],{"type":26,"value":535},{"type":20,"tag":53,"props":2077,"children":2078},{"style":538},[2079],{"type":26,"value":1735},{"type":20,"tag":53,"props":2081,"children":2082},{"style":532},[2083],{"type":26,"value":546},{"type":20,"tag":53,"props":2085,"children":2086},{"class":55,"line":330},[2087,2091,2095,2099,2103,2107,2111],{"type":20,"tag":53,"props":2088,"children":2089},{"style":60},[2090],{"type":26,"value":1492},{"type":20,"tag":53,"props":2092,"children":2093},{"style":526},[2094],{"type":26,"value":1082},{"type":20,"tag":53,"props":2096,"children":2097},{"style":625},[2098],{"type":26,"value":1755},{"type":20,"tag":53,"props":2100,"children":2101},{"style":526},[2102],{"type":26,"value":633},{"type":20,"tag":53,"props":2104,"children":2105},{"style":60},[2106],{"type":26,"value":12},{"type":20,"tag":53,"props":2108,"children":2109},{"style":526},[2110],{"type":26,"value":633},{"type":20,"tag":53,"props":2112,"children":2113},{"style":60},[2114],{"type":26,"value":1772},{"type":20,"tag":53,"props":2116,"children":2117},{"class":55,"line":339},[2118,2122,2126,2130,2134,2138,2142],{"type":20,"tag":53,"props":2119,"children":2120},{"style":60},[2121],{"type":26,"value":1582},{"type":20,"tag":53,"props":2123,"children":2124},{"style":526},[2125],{"type":26,"value":585},{"type":20,"tag":53,"props":2127,"children":2128},{"style":625},[2129],{"type":26,"value":1755},{"type":20,"tag":53,"props":2131,"children":2132},{"style":526},[2133],{"type":26,"value":633},{"type":20,"tag":53,"props":2135,"children":2136},{"style":60},[2137],{"type":26,"value":12},{"type":20,"tag":53,"props":2139,"children":2140},{"style":526},[2141],{"type":26,"value":633},{"type":20,"tag":53,"props":2143,"children":2144},{"style":60},[2145],{"type":26,"value":1804},{"type":20,"tag":53,"props":2147,"children":2148},{"class":55,"line":348},[2149,2153,2157,2161,2165,2169,2173],{"type":20,"tag":53,"props":2150,"children":2151},{"style":60},[2152],{"type":26,"value":1607},{"type":20,"tag":53,"props":2154,"children":2155},{"style":526},[2156],{"type":26,"value":784},{"type":20,"tag":53,"props":2158,"children":2159},{"style":625},[2160],{"type":26,"value":1755},{"type":20,"tag":53,"props":2162,"children":2163},{"style":526},[2164],{"type":26,"value":633},{"type":20,"tag":53,"props":2166,"children":2167},{"style":60},[2168],{"type":26,"value":12},{"type":20,"tag":53,"props":2170,"children":2171},{"style":526},[2172],{"type":26,"value":633},{"type":20,"tag":53,"props":2174,"children":2175},{"style":60},[2176],{"type":26,"value":1836},{"type":20,"tag":53,"props":2178,"children":2179},{"class":55,"line":357},[2180],{"type":20,"tag":53,"props":2181,"children":2182},{"emptyLinePlaceholder":124},[2183],{"type":26,"value":127},{"type":20,"tag":53,"props":2185,"children":2186},{"class":55,"line":366},[2187,2191],{"type":20,"tag":53,"props":2188,"children":2189},{"style":495},[2190],{"type":26,"value":1851},{"type":20,"tag":53,"props":2192,"children":2193},{"style":512},[2194],{"type":26,"value":515},{"type":20,"tag":53,"props":2196,"children":2197},{"class":55,"line":375},[2198,2202,2206,2211,2215],{"type":20,"tag":53,"props":2199,"children":2200},{"style":60},[2201],{"type":26,"value":1863},{"type":20,"tag":53,"props":2203,"children":2204},{"style":526},[2205],{"type":26,"value":676},{"type":20,"tag":53,"props":2207,"children":2208},{"style":925},[2209],{"type":26,"value":2210}," 70",{"type":20,"tag":53,"props":2212,"children":2213},{"style":1875},[2214],{"type":26,"value":633},{"type":20,"tag":53,"props":2216,"children":2217},{"style":925},[2218],{"type":26,"value":1882},{"type":20,"tag":53,"props":2220,"children":2221},{"class":55,"line":384},[2222,2226,2230],{"type":20,"tag":53,"props":2223,"children":2224},{"style":60},[2225],{"type":26,"value":1890},{"type":20,"tag":53,"props":2227,"children":2228},{"style":526},[2229],{"type":26,"value":784},{"type":20,"tag":53,"props":2231,"children":2232},{"style":925},[2233],{"type":26,"value":1899},{"type":20,"tag":53,"props":2235,"children":2236},{"class":55,"line":393},[2237,2241,2245],{"type":20,"tag":53,"props":2238,"children":2239},{"style":60},[2240],{"type":26,"value":1907},{"type":20,"tag":53,"props":2242,"children":2243},{"style":526},[2244],{"type":26,"value":585},{"type":20,"tag":53,"props":2246,"children":2247},{"style":925},[2248],{"type":26,"value":1278},{"type":20,"tag":53,"props":2250,"children":2251},{"class":55,"line":401},[2252],{"type":20,"tag":53,"props":2253,"children":2254},{"emptyLinePlaceholder":124},[2255],{"type":26,"value":127},{"type":20,"tag":53,"props":2257,"children":2258},{"class":55,"line":410},[2259,2263],{"type":20,"tag":53,"props":2260,"children":2261},{"style":495},[2262],{"type":26,"value":1930},{"type":20,"tag":53,"props":2264,"children":2265},{"style":512},[2266],{"type":26,"value":515},{"type":20,"tag":53,"props":2268,"children":2269},{"class":55,"line":419},[2270,2274,2278,2282,2287],{"type":20,"tag":53,"props":2271,"children":2272},{"style":60},[2273],{"type":26,"value":1942},{"type":20,"tag":53,"props":2275,"children":2276},{"style":526},[2277],{"type":26,"value":585},{"type":20,"tag":53,"props":2279,"children":2280},{"style":532},[2281],{"type":26,"value":535},{"type":20,"tag":53,"props":2283,"children":2284},{"style":538},[2285],{"type":26,"value":2286},"ECSServiceAverageMemoryUtilization",{"type":20,"tag":53,"props":2288,"children":2289},{"style":532},[2290],{"type":26,"value":546},{"type":20,"tag":53,"props":2292,"children":2293},{"class":55,"line":428},[2294],{"type":20,"tag":53,"props":2295,"children":2296},{"style":512},[2297],{"type":26,"value":1379},{"type":20,"tag":53,"props":2299,"children":2300},{"class":55,"line":437},[2301],{"type":20,"tag":53,"props":2302,"children":2303},{"style":512},[2304],{"type":26,"value":1974},{"type":20,"tag":53,"props":2306,"children":2307},{"class":55,"line":445},[2308],{"type":20,"tag":53,"props":2309,"children":2310},{"style":512},[2311],{"type":26,"value":1395},{"type":20,"tag":35,"props":2313,"children":2315},{"id":2314},"service-configuration-with-deployment-circuit-breaker",[2316],{"type":26,"value":2317},"Service Configuration with Deployment Circuit Breaker",{"type":20,"tag":29,"props":2319,"children":2320},{},[2321],{"type":26,"value":2322},"The circuit breaker is critical — it prevents bad deployments from taking down your entire service:",{"type":20,"tag":42,"props":2324,"children":2326},{"className":483,"code":2325,"language":485,"meta":7,"style":7},"resource \"aws_ecs_service\" \"app\" {\n  name            = var.service_name\n  cluster         = aws_ecs_cluster.main.id\n  task_definition = aws_ecs_task_definition.service.arn\n  desired_count   = var.desired_count\n  launch_type     = \"FARGATE\"\n\n  network_configuration {\n    subnets         = var.private_subnet_ids\n    security_groups = [aws_security_group.ecs_tasks.id]\n  }\n\n  load_balancer {\n    target_group_arn = aws_lb_target_group.app.arn\n    container_name   = \"app\"\n    container_port   = 8080\n  }\n\n  deployment_circuit_breaker {\n    enable   = true\n    rollback = true\n  }\n\n  deployment_controller {\n    type = \"ECS\"\n  }\n\n  lifecycle {\n    ignore_changes = [desired_count]\n  }\n}\n",[2327],{"type":20,"tag":49,"props":2328,"children":2329},{"__ignoreMap":7},[2330,2351,2375,2409,2443,2469,2493,2500,2512,2537,2580,2587,2594,2606,2639,2663,2679,2686,2693,2705,2722,2738,2745,2752,2764,2789,2796,2803,2815,2840,2847],{"type":20,"tag":53,"props":2331,"children":2332},{"class":55,"line":56},[2333,2337,2342,2347],{"type":20,"tag":53,"props":2334,"children":2335},{"style":495},[2336],{"type":26,"value":498},{"type":20,"tag":53,"props":2338,"children":2339},{"style":501},[2340],{"type":26,"value":2341}," \"aws_ecs_service\"",{"type":20,"tag":53,"props":2343,"children":2344},{"style":501},[2345],{"type":26,"value":2346}," \"app\"",{"type":20,"tag":53,"props":2348,"children":2349},{"style":512},[2350],{"type":26,"value":515},{"type":20,"tag":53,"props":2352,"children":2353},{"class":55,"line":66},[2354,2358,2362,2366,2370],{"type":20,"tag":53,"props":2355,"children":2356},{"style":60},[2357],{"type":26,"value":1675},{"type":20,"tag":53,"props":2359,"children":2360},{"style":526},[2361],{"type":26,"value":712},{"type":20,"tag":53,"props":2363,"children":2364},{"style":625},[2365],{"type":26,"value":628},{"type":20,"tag":53,"props":2367,"children":2368},{"style":526},[2369],{"type":26,"value":633},{"type":20,"tag":53,"props":2371,"children":2372},{"style":60},[2373],{"type":26,"value":2374},"service_name\n",{"type":20,"tag":53,"props":2376,"children":2377},{"class":55,"line":75},[2378,2383,2387,2392,2396,2400,2404],{"type":20,"tag":53,"props":2379,"children":2380},{"style":60},[2381],{"type":26,"value":2382},"  cluster",{"type":20,"tag":53,"props":2384,"children":2385},{"style":526},[2386],{"type":26,"value":1056},{"type":20,"tag":53,"props":2388,"children":2389},{"style":625},[2390],{"type":26,"value":2391}," aws_ecs_cluster",{"type":20,"tag":53,"props":2393,"children":2394},{"style":526},[2395],{"type":26,"value":633},{"type":20,"tag":53,"props":2397,"children":2398},{"style":60},[2399],{"type":26,"value":1523},{"type":20,"tag":53,"props":2401,"children":2402},{"style":526},[2403],{"type":26,"value":633},{"type":20,"tag":53,"props":2405,"children":2406},{"style":60},[2407],{"type":26,"value":2408},"id\n",{"type":20,"tag":53,"props":2410,"children":2411},{"class":55,"line":84},[2412,2417,2421,2426,2430,2435,2439],{"type":20,"tag":53,"props":2413,"children":2414},{"style":60},[2415],{"type":26,"value":2416},"  task_definition",{"type":20,"tag":53,"props":2418,"children":2419},{"style":526},[2420],{"type":26,"value":585},{"type":20,"tag":53,"props":2422,"children":2423},{"style":625},[2424],{"type":26,"value":2425}," aws_ecs_task_definition",{"type":20,"tag":53,"props":2427,"children":2428},{"style":526},[2429],{"type":26,"value":633},{"type":20,"tag":53,"props":2431,"children":2432},{"style":60},[2433],{"type":26,"value":2434},"service",{"type":20,"tag":53,"props":2436,"children":2437},{"style":526},[2438],{"type":26,"value":633},{"type":20,"tag":53,"props":2440,"children":2441},{"style":60},[2442],{"type":26,"value":699},{"type":20,"tag":53,"props":2444,"children":2445},{"class":55,"line":93},[2446,2451,2456,2460,2464],{"type":20,"tag":53,"props":2447,"children":2448},{"style":60},[2449],{"type":26,"value":2450},"  desired_count",{"type":20,"tag":53,"props":2452,"children":2453},{"style":526},[2454],{"type":26,"value":2455},"   =",{"type":20,"tag":53,"props":2457,"children":2458},{"style":625},[2459],{"type":26,"value":628},{"type":20,"tag":53,"props":2461,"children":2462},{"style":526},[2463],{"type":26,"value":633},{"type":20,"tag":53,"props":2465,"children":2466},{"style":60},[2467],{"type":26,"value":2468},"desired_count\n",{"type":20,"tag":53,"props":2470,"children":2471},{"class":55,"line":102},[2472,2477,2481,2485,2489],{"type":20,"tag":53,"props":2473,"children":2474},{"style":60},[2475],{"type":26,"value":2476},"  launch_type",{"type":20,"tag":53,"props":2478,"children":2479},{"style":526},[2480],{"type":26,"value":1170},{"type":20,"tag":53,"props":2482,"children":2483},{"style":532},[2484],{"type":26,"value":535},{"type":20,"tag":53,"props":2486,"children":2487},{"style":538},[2488],{"type":26,"value":600},{"type":20,"tag":53,"props":2490,"children":2491},{"style":532},[2492],{"type":26,"value":546},{"type":20,"tag":53,"props":2494,"children":2495},{"class":55,"line":111},[2496],{"type":20,"tag":53,"props":2497,"children":2498},{"emptyLinePlaceholder":124},[2499],{"type":26,"value":127},{"type":20,"tag":53,"props":2501,"children":2502},{"class":55,"line":120},[2503,2508],{"type":20,"tag":53,"props":2504,"children":2505},{"style":495},[2506],{"type":26,"value":2507},"  network_configuration",{"type":20,"tag":53,"props":2509,"children":2510},{"style":512},[2511],{"type":26,"value":515},{"type":20,"tag":53,"props":2513,"children":2514},{"class":55,"line":130},[2515,2520,2524,2528,2532],{"type":20,"tag":53,"props":2516,"children":2517},{"style":60},[2518],{"type":26,"value":2519},"    subnets",{"type":20,"tag":53,"props":2521,"children":2522},{"style":526},[2523],{"type":26,"value":1056},{"type":20,"tag":53,"props":2525,"children":2526},{"style":625},[2527],{"type":26,"value":628},{"type":20,"tag":53,"props":2529,"children":2530},{"style":526},[2531],{"type":26,"value":633},{"type":20,"tag":53,"props":2533,"children":2534},{"style":60},[2535],{"type":26,"value":2536},"private_subnet_ids\n",{"type":20,"tag":53,"props":2538,"children":2539},{"class":55,"line":139},[2540,2545,2549,2553,2558,2562,2567,2571,2576],{"type":20,"tag":53,"props":2541,"children":2542},{"style":60},[2543],{"type":26,"value":2544},"    security_groups",{"type":20,"tag":53,"props":2546,"children":2547},{"style":526},[2548],{"type":26,"value":585},{"type":20,"tag":53,"props":2550,"children":2551},{"style":512},[2552],{"type":26,"value":590},{"type":20,"tag":53,"props":2554,"children":2555},{"style":60},[2556],{"type":26,"value":2557},"aws_security_group",{"type":20,"tag":53,"props":2559,"children":2560},{"style":526},[2561],{"type":26,"value":633},{"type":20,"tag":53,"props":2563,"children":2564},{"style":60},[2565],{"type":26,"value":2566},"ecs_tasks",{"type":20,"tag":53,"props":2568,"children":2569},{"style":526},[2570],{"type":26,"value":633},{"type":20,"tag":53,"props":2572,"children":2573},{"style":60},[2574],{"type":26,"value":2575},"id",{"type":20,"tag":53,"props":2577,"children":2578},{"style":512},[2579],{"type":26,"value":609},{"type":20,"tag":53,"props":2581,"children":2582},{"class":55,"line":148},[2583],{"type":20,"tag":53,"props":2584,"children":2585},{"style":512},[2586],{"type":26,"value":1974},{"type":20,"tag":53,"props":2588,"children":2589},{"class":55,"line":157},[2590],{"type":20,"tag":53,"props":2591,"children":2592},{"emptyLinePlaceholder":124},[2593],{"type":26,"value":127},{"type":20,"tag":53,"props":2595,"children":2596},{"class":55,"line":166},[2597,2602],{"type":20,"tag":53,"props":2598,"children":2599},{"style":495},[2600],{"type":26,"value":2601},"  load_balancer",{"type":20,"tag":53,"props":2603,"children":2604},{"style":512},[2605],{"type":26,"value":515},{"type":20,"tag":53,"props":2607,"children":2608},{"class":55,"line":174},[2609,2614,2618,2623,2627,2631,2635],{"type":20,"tag":53,"props":2610,"children":2611},{"style":60},[2612],{"type":26,"value":2613},"    target_group_arn",{"type":20,"tag":53,"props":2615,"children":2616},{"style":526},[2617],{"type":26,"value":585},{"type":20,"tag":53,"props":2619,"children":2620},{"style":625},[2621],{"type":26,"value":2622}," aws_lb_target_group",{"type":20,"tag":53,"props":2624,"children":2625},{"style":526},[2626],{"type":26,"value":633},{"type":20,"tag":53,"props":2628,"children":2629},{"style":60},[2630],{"type":26,"value":793},{"type":20,"tag":53,"props":2632,"children":2633},{"style":526},[2634],{"type":26,"value":633},{"type":20,"tag":53,"props":2636,"children":2637},{"style":60},[2638],{"type":26,"value":699},{"type":20,"tag":53,"props":2640,"children":2641},{"class":55,"line":182},[2642,2647,2651,2655,2659],{"type":20,"tag":53,"props":2643,"children":2644},{"style":60},[2645],{"type":26,"value":2646},"    container_name",{"type":20,"tag":53,"props":2648,"children":2649},{"style":526},[2650],{"type":26,"value":2455},{"type":20,"tag":53,"props":2652,"children":2653},{"style":532},[2654],{"type":26,"value":535},{"type":20,"tag":53,"props":2656,"children":2657},{"style":538},[2658],{"type":26,"value":793},{"type":20,"tag":53,"props":2660,"children":2661},{"style":532},[2662],{"type":26,"value":546},{"type":20,"tag":53,"props":2664,"children":2665},{"class":55,"line":191},[2666,2671,2675],{"type":20,"tag":53,"props":2667,"children":2668},{"style":60},[2669],{"type":26,"value":2670},"    container_port",{"type":20,"tag":53,"props":2672,"children":2673},{"style":526},[2674],{"type":26,"value":2455},{"type":20,"tag":53,"props":2676,"children":2677},{"style":925},[2678],{"type":26,"value":928},{"type":20,"tag":53,"props":2680,"children":2681},{"class":55,"line":200},[2682],{"type":20,"tag":53,"props":2683,"children":2684},{"style":512},[2685],{"type":26,"value":1974},{"type":20,"tag":53,"props":2687,"children":2688},{"class":55,"line":209},[2689],{"type":20,"tag":53,"props":2690,"children":2691},{"emptyLinePlaceholder":124},[2692],{"type":26,"value":127},{"type":20,"tag":53,"props":2694,"children":2695},{"class":55,"line":218},[2696,2701],{"type":20,"tag":53,"props":2697,"children":2698},{"style":495},[2699],{"type":26,"value":2700},"  deployment_circuit_breaker",{"type":20,"tag":53,"props":2702,"children":2703},{"style":512},[2704],{"type":26,"value":515},{"type":20,"tag":53,"props":2706,"children":2707},{"class":55,"line":226},[2708,2713,2717],{"type":20,"tag":53,"props":2709,"children":2710},{"style":60},[2711],{"type":26,"value":2712},"    enable",{"type":20,"tag":53,"props":2714,"children":2715},{"style":526},[2716],{"type":26,"value":2455},{"type":20,"tag":53,"props":2718,"children":2719},{"style":1875},[2720],{"type":26,"value":2721}," true\n",{"type":20,"tag":53,"props":2723,"children":2724},{"class":55,"line":234},[2725,2730,2734],{"type":20,"tag":53,"props":2726,"children":2727},{"style":60},[2728],{"type":26,"value":2729},"    rollback",{"type":20,"tag":53,"props":2731,"children":2732},{"style":526},[2733],{"type":26,"value":585},{"type":20,"tag":53,"props":2735,"children":2736},{"style":1875},[2737],{"type":26,"value":2721},{"type":20,"tag":53,"props":2739,"children":2740},{"class":55,"line":243},[2741],{"type":20,"tag":53,"props":2742,"children":2743},{"style":512},[2744],{"type":26,"value":1974},{"type":20,"tag":53,"props":2746,"children":2747},{"class":55,"line":252},[2748],{"type":20,"tag":53,"props":2749,"children":2750},{"emptyLinePlaceholder":124},[2751],{"type":26,"value":127},{"type":20,"tag":53,"props":2753,"children":2754},{"class":55,"line":261},[2755,2760],{"type":20,"tag":53,"props":2756,"children":2757},{"style":495},[2758],{"type":26,"value":2759},"  deployment_controller",{"type":20,"tag":53,"props":2761,"children":2762},{"style":512},[2763],{"type":26,"value":515},{"type":20,"tag":53,"props":2765,"children":2766},{"class":55,"line":270},[2767,2772,2776,2780,2785],{"type":20,"tag":53,"props":2768,"children":2769},{"style":60},[2770],{"type":26,"value":2771},"    type",{"type":20,"tag":53,"props":2773,"children":2774},{"style":526},[2775],{"type":26,"value":585},{"type":20,"tag":53,"props":2777,"children":2778},{"style":532},[2779],{"type":26,"value":535},{"type":20,"tag":53,"props":2781,"children":2782},{"style":538},[2783],{"type":26,"value":2784},"ECS",{"type":20,"tag":53,"props":2786,"children":2787},{"style":532},[2788],{"type":26,"value":546},{"type":20,"tag":53,"props":2790,"children":2791},{"class":55,"line":278},[2792],{"type":20,"tag":53,"props":2793,"children":2794},{"style":512},[2795],{"type":26,"value":1974},{"type":20,"tag":53,"props":2797,"children":2798},{"class":55,"line":286},[2799],{"type":20,"tag":53,"props":2800,"children":2801},{"emptyLinePlaceholder":124},[2802],{"type":26,"value":127},{"type":20,"tag":53,"props":2804,"children":2805},{"class":55,"line":295},[2806,2811],{"type":20,"tag":53,"props":2807,"children":2808},{"style":495},[2809],{"type":26,"value":2810},"  lifecycle",{"type":20,"tag":53,"props":2812,"children":2813},{"style":512},[2814],{"type":26,"value":515},{"type":20,"tag":53,"props":2816,"children":2817},{"class":55,"line":304},[2818,2823,2827,2831,2836],{"type":20,"tag":53,"props":2819,"children":2820},{"style":60},[2821],{"type":26,"value":2822},"    ignore_changes",{"type":20,"tag":53,"props":2824,"children":2825},{"style":526},[2826],{"type":26,"value":585},{"type":20,"tag":53,"props":2828,"children":2829},{"style":512},[2830],{"type":26,"value":590},{"type":20,"tag":53,"props":2832,"children":2833},{"style":60},[2834],{"type":26,"value":2835},"desired_count",{"type":20,"tag":53,"props":2837,"children":2838},{"style":512},[2839],{"type":26,"value":609},{"type":20,"tag":53,"props":2841,"children":2842},{"class":55,"line":313},[2843],{"type":20,"tag":53,"props":2844,"children":2845},{"style":512},[2846],{"type":26,"value":1974},{"type":20,"tag":53,"props":2848,"children":2849},{"class":55,"line":321},[2850],{"type":20,"tag":53,"props":2851,"children":2852},{"style":512},[2853],{"type":26,"value":1395},{"type":20,"tag":35,"props":2855,"children":2857},{"id":2856},"key-design-decisions",[2858],{"type":26,"value":2859},"Key Design Decisions",{"type":20,"tag":2861,"props":2862,"children":2863},"ol",{},[2864,2876,2886,2896,2912],{"type":20,"tag":2865,"props":2866,"children":2867},"li",{},[2868,2874],{"type":20,"tag":2869,"props":2870,"children":2871},"strong",{},[2872],{"type":26,"value":2873},"Scale-out cooldown at 60s",{"type":26,"value":2875}," — Aggressive scale-out ensures we handle traffic spikes quickly",{"type":20,"tag":2865,"props":2877,"children":2878},{},[2879,2884],{"type":20,"tag":2869,"props":2880,"children":2881},{},[2882],{"type":26,"value":2883},"Scale-in cooldown at 300s",{"type":26,"value":2885}," — Conservative scale-in prevents thrashing during fluctuating load",{"type":20,"tag":2865,"props":2887,"children":2888},{},[2889,2894],{"type":20,"tag":2869,"props":2890,"children":2891},{},[2892],{"type":26,"value":2893},"Circuit breaker with rollback",{"type":26,"value":2895}," — Bad deploys auto-revert without manual intervention",{"type":20,"tag":2865,"props":2897,"children":2898},{},[2899,2910],{"type":20,"tag":2869,"props":2900,"children":2901},{},[2902,2908],{"type":20,"tag":49,"props":2903,"children":2905},{"className":2904},[],[2906],{"type":26,"value":2907},"ignore_changes",{"type":26,"value":2909}," on desired_count",{"type":26,"value":2911}," — Terraform won't fight autoscaling decisions",{"type":20,"tag":2865,"props":2913,"children":2914},{},[2915,2920],{"type":20,"tag":2869,"props":2916,"children":2917},{},[2918],{"type":26,"value":2919},"Health check with startPeriod",{"type":26,"value":2921}," — Gives containers 60s to warm up before health checks kick in",{"type":20,"tag":35,"props":2923,"children":2925},{"id":2924},"results",[2926],{"type":26,"value":2927},"Results",{"type":20,"tag":2929,"props":2930,"children":2931},"ul",{},[2932,2942,2952],{"type":20,"tag":2865,"props":2933,"children":2934},{},[2935,2940],{"type":20,"tag":2869,"props":2936,"children":2937},{},[2938],{"type":26,"value":2939},"99.99% uptime",{"type":26,"value":2941}," maintained across 100+ microservices",{"type":20,"tag":2865,"props":2943,"children":2944},{},[2945,2950],{"type":20,"tag":2869,"props":2946,"children":2947},{},[2948],{"type":26,"value":2949},"60% better resource utilization",{"type":26,"value":2951}," vs fixed-capacity provisioning",{"type":20,"tag":2865,"props":2953,"children":2954},{},[2955,2960],{"type":20,"tag":2869,"props":2956,"children":2957},{},[2958],{"type":26,"value":2959},"Zero manual scaling interventions",{"type":26,"value":2961}," — autoscaling handles everything from 3 AM traffic dips to Black Friday spikes",{"type":20,"tag":2963,"props":2964,"children":2965},"style",{},[2966],{"type":26,"value":2967},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":7,"searchDepth":66,"depth":66,"links":2969},[2970,2971,2972,2973,2974,2975],{"id":37,"depth":66,"text":40},{"id":472,"depth":66,"text":475},{"id":1398,"depth":66,"text":1401},{"id":2314,"depth":66,"text":2317},{"id":2856,"depth":66,"text":2859},{"id":2924,"depth":66,"text":2927},"markdown","content:codes:ecs-fargate-autoscaling.md","content","codes/ecs-fargate-autoscaling.md","codes/ecs-fargate-autoscaling","md",1782460598423]