-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_learning.html
More file actions
612 lines (456 loc) · 89 KB
/
Copy pathbasic_learning.html
File metadata and controls
612 lines (456 loc) · 89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
<!DOCTYPE html>
<html lang="en" dir="ltr"><head><title>basic_learning</title><meta charset="utf-8"/><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com"/><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Schibsted Grotesk:wght@400;700&family=Source Sans Pro:ital,wght@0,400;0,600;1,400;1,600&family=IBM Plex Mono:wght@400;600&display=swap"/><link rel="preconnect" href="https://cdnjs.cloudflare.com" crossorigin="anonymous"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta name="og:site_name" content="Shadab · Learning Notes"/><meta property="og:title" content="basic_learning"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:title" content="basic_learning"/><meta name="twitter:description" content="Cloud Computing: From First Principles to Production A learning document covering the mental models, mathematics, architecture, and practical deployment patterns of modern cloud computing."/><meta property="og:description" content="Cloud Computing: From First Principles to Production A learning document covering the mental models, mathematics, architecture, and practical deployment patterns of modern cloud computing."/><meta property="og:image:alt" content="Cloud Computing: From First Principles to Production A learning document covering the mental models, mathematics, architecture, and practical deployment patterns of modern cloud computing."/><meta property="og:image" content="https://study.tpresearcher.online/static/og-image.png"/><meta property="og:image:url" content="https://study.tpresearcher.online/static/og-image.png"/><meta name="twitter:image" content="https://study.tpresearcher.online/static/og-image.png"/><meta property="og:image:type" content="image/.png"/><meta property="twitter:domain" content="study.tpresearcher.online"/><meta property="og:url" content="https://study.tpresearcher.online/cloud/basic_learning"/><meta property="twitter:url" content="https://study.tpresearcher.online/cloud/basic_learning"/><link rel="icon" href="../static/icon.png"/><meta name="description" content="Cloud Computing: From First Principles to Production A learning document covering the mental models, mathematics, architecture, and practical deployment patterns of modern cloud computing."/><meta name="generator" content="Quartz"/><link href="../index.css" rel="stylesheet" type="text/css" spa-preserve/><style>.expand-button {
position: absolute;
display: flex;
float: right;
padding: 0.4rem;
margin: 0.3rem;
right: 0;
color: var(--gray);
border-color: var(--dark);
background-color: var(--light);
border: 1px solid;
border-radius: 5px;
opacity: 0;
transition: 0.2s;
}
.expand-button > svg {
fill: var(--light);
filter: contrast(0.3);
}
.expand-button:hover {
cursor: pointer;
border-color: var(--secondary);
}
.expand-button:focus {
outline: 0;
}
pre:hover > .expand-button {
opacity: 1;
transition: 0.2s;
}
#mermaid-container {
position: fixed;
contain: layout;
z-index: 999;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
overflow: hidden;
display: none;
backdrop-filter: blur(4px);
background: rgba(0, 0, 0, 0.5);
}
#mermaid-container.active {
display: inline-block;
}
#mermaid-container > #mermaid-space {
border: 1px solid var(--lightgray);
background-color: var(--light);
border-radius: 5px;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
height: 80vh;
width: 80vw;
overflow: hidden;
}
#mermaid-container > #mermaid-space > .mermaid-content {
padding: 2rem;
position: relative;
transform-origin: 0 0;
transition: transform 0.1s ease;
overflow: visible;
min-height: 200px;
min-width: 200px;
}
#mermaid-container > #mermaid-space > .mermaid-content pre {
margin: 0;
border: none;
}
#mermaid-container > #mermaid-space > .mermaid-content svg {
max-width: none;
height: auto;
}
#mermaid-container > #mermaid-space > .mermaid-controls {
position: absolute;
bottom: 20px;
right: 20px;
display: flex;
gap: 8px;
padding: 8px;
background: var(--light);
border: 1px solid var(--lightgray);
border-radius: 6px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
z-index: 2;
}
#mermaid-container > #mermaid-space > .mermaid-controls .mermaid-control-button {
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
padding: 0;
border: 1px solid var(--lightgray);
background: var(--light);
color: var(--dark);
border-radius: 4px;
cursor: pointer;
font-size: 16px;
font-family: var(--bodyFont);
transition: all 0.2s ease;
}
#mermaid-container > #mermaid-space > .mermaid-controls .mermaid-control-button:hover {
background: var(--lightgray);
}
#mermaid-container > #mermaid-space > .mermaid-controls .mermaid-control-button:active {
transform: translateY(1px);
}
#mermaid-container > #mermaid-space > .mermaid-controls .mermaid-control-button:nth-child(2) {
width: auto;
padding: 0 12px;
font-size: 14px;
}
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VSb290IjoiL3RtcC9xdWFydHovcXVhcnR6L2NvbXBvbmVudHMvc3R5bGVzIiwic291cmNlcyI6WyJtZXJtYWlkLmlubGluZS5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0VBQ0U7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7O0FBRUE7RUFDRTtFQUNBOztBQUdGO0VBQ0U7RUFDQTs7QUFHRjtFQUNFOzs7QUFLRjtFQUNFO0VBQ0E7OztBQUlKO0VBQ0U7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTs7QUFFQTtFQUNFOztBQUdGO0VBQ0U7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7O0FBRUE7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTs7QUFFQTtFQUNFO0VBQ0E7O0FBR0Y7RUFDRTtFQUNBOztBQUlKO0VBQ0U7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTs7QUFFQTtFQUNFO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7O0FBRUE7RUFDRTs7QUFHRjtFQUNFOztBQUlGO0VBQ0U7RUFDQTtFQUNBIiwic291cmNlc0NvbnRlbnQiOlsiLmV4cGFuZC1idXR0b24ge1xuICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGZsb2F0OiByaWdodDtcbiAgcGFkZGluZzogMC40cmVtO1xuICBtYXJnaW46IDAuM3JlbTtcbiAgcmlnaHQ6IDA7IC8vIE5PVEU6IHJpZ2h0IHdpbGwgYmUgc2V0IGluIG1lcm1haWQuaW5saW5lLnRzXG4gIGNvbG9yOiB2YXIoLS1ncmF5KTtcbiAgYm9yZGVyLWNvbG9yOiB2YXIoLS1kYXJrKTtcbiAgYmFja2dyb3VuZC1jb2xvcjogdmFyKC0tbGlnaHQpO1xuICBib3JkZXI6IDFweCBzb2xpZDtcbiAgYm9yZGVyLXJhZGl1czogNXB4O1xuICBvcGFjaXR5OiAwO1xuICB0cmFuc2l0aW9uOiAwLjJzO1xuXG4gICYgPiBzdmcge1xuICAgIGZpbGw6IHZhcigtLWxpZ2h0KTtcbiAgICBmaWx0ZXI6IGNvbnRyYXN0KDAuMyk7XG4gIH1cblxuICAmOmhvdmVyIHtcbiAgICBjdXJzb3I6IHBvaW50ZXI7XG4gICAgYm9yZGVyLWNvbG9yOiB2YXIoLS1zZWNvbmRhcnkpO1xuICB9XG5cbiAgJjpmb2N1cyB7XG4gICAgb3V0bGluZTogMDtcbiAgfVxufVxuXG5wcmUge1xuICAmOmhvdmVyID4gLmV4cGFuZC1idXR0b24ge1xuICAgIG9wYWNpdHk6IDE7XG4gICAgdHJhbnNpdGlvbjogMC4ycztcbiAgfVxufVxuXG4jbWVybWFpZC1jb250YWluZXIge1xuICBwb3NpdGlvbjogZml4ZWQ7XG4gIGNvbnRhaW46IGxheW91dDtcbiAgei1pbmRleDogOTk5O1xuICBsZWZ0OiAwO1xuICB0b3A6IDA7XG4gIHdpZHRoOiAxMDB2dztcbiAgaGVpZ2h0OiAxMDB2aDtcbiAgb3ZlcmZsb3c6IGhpZGRlbjtcbiAgZGlzcGxheTogbm9uZTtcbiAgYmFja2Ryb3AtZmlsdGVyOiBibHVyKDRweCk7XG4gIGJhY2tncm91bmQ6IHJnYmEoMCwgMCwgMCwgMC41KTtcblxuICAmLmFjdGl2ZSB7XG4gICAgZGlzcGxheTogaW5saW5lLWJsb2NrO1xuICB9XG5cbiAgJiA+ICNtZXJtYWlkLXNwYWNlIHtcbiAgICBib3JkZXI6IDFweCBzb2xpZCB2YXIoLS1saWdodGdyYXkpO1xuICAgIGJhY2tncm91bmQtY29sb3I6IHZhcigtLWxpZ2h0KTtcbiAgICBib3JkZXItcmFkaXVzOiA1cHg7XG4gICAgcG9zaXRpb246IGZpeGVkO1xuICAgIHRvcDogNTAlO1xuICAgIGxlZnQ6IDUwJTtcbiAgICB0cmFuc2Zvcm06IHRyYW5zbGF0ZSgtNTAlLCAtNTAlKTtcbiAgICBoZWlnaHQ6IDgwdmg7XG4gICAgd2lkdGg6IDgwdnc7XG4gICAgb3ZlcmZsb3c6IGhpZGRlbjtcblxuICAgICYgPiAubWVybWFpZC1jb250ZW50IHtcbiAgICAgIHBhZGRpbmc6IDJyZW07XG4gICAgICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gICAgICB0cmFuc2Zvcm0tb3JpZ2luOiAwIDA7XG4gICAgICB0cmFuc2l0aW9uOiB0cmFuc2Zvcm0gMC4xcyBlYXNlO1xuICAgICAgb3ZlcmZsb3c6IHZpc2libGU7XG4gICAgICBtaW4taGVpZ2h0OiAyMDBweDtcbiAgICAgIG1pbi13aWR0aDogMjAwcHg7XG5cbiAgICAgIHByZSB7XG4gICAgICAgIG1hcmdpbjogMDtcbiAgICAgICAgYm9yZGVyOiBub25lO1xuICAgICAgfVxuXG4gICAgICBzdmcge1xuICAgICAgICBtYXgtd2lkdGg6IG5vbmU7XG4gICAgICAgIGhlaWdodDogYXV0bztcbiAgICAgIH1cbiAgICB9XG5cbiAgICAmID4gLm1lcm1haWQtY29udHJvbHMge1xuICAgICAgcG9zaXRpb246IGFic29sdXRlO1xuICAgICAgYm90dG9tOiAyMHB4O1xuICAgICAgcmlnaHQ6IDIwcHg7XG4gICAgICBkaXNwbGF5OiBmbGV4O1xuICAgICAgZ2FwOiA4cHg7XG4gICAgICBwYWRkaW5nOiA4cHg7XG4gICAgICBiYWNrZ3JvdW5kOiB2YXIoLS1saWdodCk7XG4gICAgICBib3JkZXI6IDFweCBzb2xpZCB2YXIoLS1saWdodGdyYXkpO1xuICAgICAgYm9yZGVyLXJhZGl1czogNnB4O1xuICAgICAgYm94LXNoYWRvdzogMCAycHggNHB4IHJnYmEoMCwgMCwgMCwgMC4xKTtcbiAgICAgIHotaW5kZXg6IDI7XG5cbiAgICAgIC5tZXJtYWlkLWNvbnRyb2wtYnV0dG9uIHtcbiAgICAgICAgZGlzcGxheTogZmxleDtcbiAgICAgICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgICAgICAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gICAgICAgIHdpZHRoOiAzMnB4O1xuICAgICAgICBoZWlnaHQ6IDMycHg7XG4gICAgICAgIHBhZGRpbmc6IDA7XG4gICAgICAgIGJvcmRlcjogMXB4IHNvbGlkIHZhcigtLWxpZ2h0Z3JheSk7XG4gICAgICAgIGJhY2tncm91bmQ6IHZhcigtLWxpZ2h0KTtcbiAgICAgICAgY29sb3I6IHZhcigtLWRhcmspO1xuICAgICAgICBib3JkZXItcmFkaXVzOiA0cHg7XG4gICAgICAgIGN1cnNvcjogcG9pbnRlcjtcbiAgICAgICAgZm9udC1zaXplOiAxNnB4O1xuICAgICAgICBmb250LWZhbWlseTogdmFyKC0tYm9keUZvbnQpO1xuICAgICAgICB0cmFuc2l0aW9uOiBhbGwgMC4ycyBlYXNlO1xuXG4gICAgICAgICY6aG92ZXIge1xuICAgICAgICAgIGJhY2tncm91bmQ6IHZhcigtLWxpZ2h0Z3JheSk7XG4gICAgICAgIH1cblxuICAgICAgICAmOmFjdGl2ZSB7XG4gICAgICAgICAgdHJhbnNmb3JtOiB0cmFuc2xhdGVZKDFweCk7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBTdHlsZSB0aGUgcmVzZXQgYnV0dG9uIGRpZmZlcmVudGx5XG4gICAgICAgICY6bnRoLWNoaWxkKDIpIHtcbiAgICAgICAgICB3aWR0aDogYXV0bztcbiAgICAgICAgICBwYWRkaW5nOiAwIDEycHg7XG4gICAgICAgICAgZm9udC1zaXplOiAxNHB4O1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuICB9XG59XG4iXX0= */</style><link href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" rel="stylesheet" type="text/css" spa-preserve/><script src="../prescript.js" type="application/javascript" spa-preserve></script><script type="application/javascript" spa-preserve>const fetchData = fetch("../static/contentIndex.json").then(data => data.json())</script><link rel="alternate" type="application/rss+xml" title="RSS Feed" href="https://study.tpresearcher.online/index.xml"/></head><body data-slug="cloud/basic_learning"><div id="quartz-root" class="page"><div id="quartz-body"><div class="left sidebar"><h2 class="page-title"><a href="..">Shadab · Learning Notes</a></h2><div class="spacer mobile-only"></div><div class="flex-component" style="flex-direction: row; flex-wrap: nowrap; gap: 1rem;"><div style="flex-grow: 1; flex-shrink: 1; flex-basis: auto; order: 0; align-self: center; justify-self: center;"><div class="search"><button class="search-button"><svg role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.9 19.7"><title>Search</title><g class="search-path" fill="none"><path stroke-linecap="square" d="M18.5 18.3l-5.4-5.4"></path><circle cx="8" cy="8" r="7"></circle></g></svg><p>Search</p></button><div class="search-container"><div class="search-space"><input autocomplete="off" class="search-bar" name="search" type="text" aria-label="Search for something" placeholder="Search for something"/><div class="search-layout" data-preview="true"></div></div></div></div></div><div style="flex-grow: 0; flex-shrink: 1; flex-basis: auto; order: 0; align-self: center; justify-self: center;"><button class="darkmode"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" class="dayIcon" x="0px" y="0px" viewBox="0 0 35 35" style="enable-background:new 0 0 35 35" xml:space="preserve" aria-label="Dark mode"><title>Dark mode</title><path d="M6,17.5C6,16.672,5.328,16,4.5,16h-3C0.672,16,0,16.672,0,17.5 S0.672,19,1.5,19h3C5.328,19,6,18.328,6,17.5z M7.5,26c-0.414,0-0.789,0.168-1.061,0.439l-2,2C4.168,28.711,4,29.086,4,29.5 C4,30.328,4.671,31,5.5,31c0.414,0,0.789-0.168,1.06-0.44l2-2C8.832,28.289,9,27.914,9,27.5C9,26.672,8.329,26,7.5,26z M17.5,6 C18.329,6,19,5.328,19,4.5v-3C19,0.672,18.329,0,17.5,0S16,0.672,16,1.5v3C16,5.328,16.671,6,17.5,6z M27.5,9 c0.414,0,0.789-0.168,1.06-0.439l2-2C30.832,6.289,31,5.914,31,5.5C31,4.672,30.329,4,29.5,4c-0.414,0-0.789,0.168-1.061,0.44 l-2,2C26.168,6.711,26,7.086,26,7.5C26,8.328,26.671,9,27.5,9z M6.439,8.561C6.711,8.832,7.086,9,7.5,9C8.328,9,9,8.328,9,7.5 c0-0.414-0.168-0.789-0.439-1.061l-2-2C6.289,4.168,5.914,4,5.5,4C4.672,4,4,4.672,4,5.5c0,0.414,0.168,0.789,0.439,1.06 L6.439,8.561z M33.5,16h-3c-0.828,0-1.5,0.672-1.5,1.5s0.672,1.5,1.5,1.5h3c0.828,0,1.5-0.672,1.5-1.5S34.328,16,33.5,16z M28.561,26.439C28.289,26.168,27.914,26,27.5,26c-0.828,0-1.5,0.672-1.5,1.5c0,0.414,0.168,0.789,0.439,1.06l2,2 C28.711,30.832,29.086,31,29.5,31c0.828,0,1.5-0.672,1.5-1.5c0-0.414-0.168-0.789-0.439-1.061L28.561,26.439z M17.5,29 c-0.829,0-1.5,0.672-1.5,1.5v3c0,0.828,0.671,1.5,1.5,1.5s1.5-0.672,1.5-1.5v-3C19,29.672,18.329,29,17.5,29z M17.5,7 C11.71,7,7,11.71,7,17.5S11.71,28,17.5,28S28,23.29,28,17.5S23.29,7,17.5,7z M17.5,25c-4.136,0-7.5-3.364-7.5-7.5 c0-4.136,3.364-7.5,7.5-7.5c4.136,0,7.5,3.364,7.5,7.5C25,21.636,21.636,25,17.5,25z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" class="nightIcon" x="0px" y="0px" viewBox="0 0 100 100" style="enable-background:new 0 0 100 100" xml:space="preserve" aria-label="Light mode"><title>Light mode</title><path d="M96.76,66.458c-0.853-0.852-2.15-1.064-3.23-0.534c-6.063,2.991-12.858,4.571-19.655,4.571 C62.022,70.495,50.88,65.88,42.5,57.5C29.043,44.043,25.658,23.536,34.076,6.47c0.532-1.08,0.318-2.379-0.534-3.23 c-0.851-0.852-2.15-1.064-3.23-0.534c-4.918,2.427-9.375,5.619-13.246,9.491c-9.447,9.447-14.65,22.008-14.65,35.369 c0,13.36,5.203,25.921,14.65,35.368s22.008,14.65,35.368,14.65c13.361,0,25.921-5.203,35.369-14.65 c3.872-3.871,7.064-8.328,9.491-13.246C97.826,68.608,97.611,67.309,96.76,66.458z"></path></svg></button></div><div style="flex-grow: 0; flex-shrink: 1; flex-basis: auto; order: 0; align-self: center; justify-self: center;"><button class="readermode"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" class="readerIcon" fill="currentColor" stroke="currentColor" stroke-width="0.2" stroke-linecap="round" stroke-linejoin="round" width="64px" height="64px" viewBox="0 0 24 24" aria-label="Reader mode"><title>Reader mode</title><g transform="translate(-1.8, -1.8) scale(1.15, 1.2)"><path d="M8.9891247,2.5 C10.1384702,2.5 11.2209868,2.96705384 12.0049645,3.76669482 C12.7883914,2.96705384 13.8709081,2.5 15.0202536,2.5 L18.7549359,2.5 C19.1691495,2.5 19.5049359,2.83578644 19.5049359,3.25 L19.5046891,4.004 L21.2546891,4.00457396 C21.6343849,4.00457396 21.9481801,4.28672784 21.9978425,4.6528034 L22.0046891,4.75457396 L22.0046891,20.25 C22.0046891,20.6296958 21.7225353,20.943491 21.3564597,20.9931534 L21.2546891,21 L2.75468914,21 C2.37499337,21 2.06119817,20.7178461 2.01153575,20.3517706 L2.00468914,20.25 L2.00468914,4.75457396 C2.00468914,4.37487819 2.28684302,4.061083 2.65291858,4.01142057 L2.75468914,4.00457396 L4.50368914,4.004 L4.50444233,3.25 C4.50444233,2.87030423 4.78659621,2.55650904 5.15267177,2.50684662 L5.25444233,2.5 L8.9891247,2.5 Z M4.50368914,5.504 L3.50468914,5.504 L3.50468914,19.5 L10.9478955,19.4998273 C10.4513189,18.9207296 9.73864328,18.5588115 8.96709342,18.5065584 L8.77307039,18.5 L5.25444233,18.5 C4.87474657,18.5 4.56095137,18.2178461 4.51128895,17.8517706 L4.50444233,17.75 L4.50368914,5.504 Z M19.5049359,17.75 C19.5049359,18.1642136 19.1691495,18.5 18.7549359,18.5 L15.2363079,18.5 C14.3910149,18.5 13.5994408,18.8724714 13.0614828,19.4998273 L20.5046891,19.5 L20.5046891,5.504 L19.5046891,5.504 L19.5049359,17.75 Z M18.0059359,3.999 L15.0202536,4 L14.8259077,4.00692283 C13.9889509,4.06666544 13.2254227,4.50975805 12.7549359,5.212 L12.7549359,17.777 L12.7782651,17.7601316 C13.4923805,17.2719483 14.3447024,17 15.2363079,17 L18.0059359,16.999 L18.0056891,4.798 L18.0033792,4.75457396 L18.0056891,4.71 L18.0059359,3.999 Z M8.9891247,4 L6.00368914,3.999 L6.00599909,4.75457396 L6.00599909,4.75457396 L6.00368914,4.783 L6.00368914,16.999 L8.77307039,17 C9.57551536,17 10.3461406,17.2202781 11.0128313,17.6202194 L11.2536891,17.776 L11.2536891,5.211 C10.8200889,4.56369974 10.1361548,4.13636104 9.37521067,4.02745763 L9.18347055,4.00692283 L8.9891247,4 Z"></path></g></svg></button></div></div><div class="explorer" data-behavior="link" data-collapsed="collapsed" data-savestate="true" data-data-fns="{"order":["filter","map","sort"],"sortFn":"(a,b)=>!a.isFolder&&!b.isFolder||a.isFolder&&b.isFolder?a.displayName.localeCompare(b.displayName,void 0,{numeric:!0,sensitivity:\"base\"}):!a.isFolder&&b.isFolder?1:-1","filterFn":"node=>node.slugSegment!==\"tags\"","mapFn":"node=>node"}"><button type="button" class="explorer-toggle mobile-explorer hide-until-loaded" data-mobile="true" aria-controls="explorer-47"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide-menu"><line x1="4" x2="20" y1="12" y2="12"></line><line x1="4" x2="20" y1="6" y2="6"></line><line x1="4" x2="20" y1="18" y2="18"></line></svg></button><button type="button" class="title-button explorer-toggle desktop-explorer" data-mobile="false" aria-expanded="true"><h2>Explorer</h2><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="5 8 14 8" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="fold"><polyline points="6 9 12 15 18 9"></polyline></svg></button><div id="explorer-47" class="explorer-content" aria-expanded="false" role="group"><ul class="explorer-ul overflow" id="list-0"><li class="overflow-end"></li></ul></div><template id="template-file"><li><a href="#"></a></li></template><template id="template-folder"><li><div class="folder-container"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="5 8 14 8" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="folder-icon"><polyline points="6 9 12 15 18 9"></polyline></svg><div><button class="folder-button"><span class="folder-title"></span></button></div></div><div class="folder-outer"><ul class="content"></ul></div></li></template></div></div><div class="center"><div class="page-header"><div class="popover-hint"><nav class="breadcrumb-container" aria-label="breadcrumbs"><div class="breadcrumb-element"><a href="../">Home</a><p> ❯ </p></div><div class="breadcrumb-element"><a href="../cloud/">cloud</a><p> ❯ </p></div><div class="breadcrumb-element"><a href>basic_learning</a></div></nav><h1 class="article-title">basic_learning</h1><p show-comma="true" class="content-meta"><time datetime="2026-06-20T04:35:36.516Z">Jun 20, 2026</time><span>14 min read</span></p></div></div><article class="popover-hint"><h1 id="cloud-computing-from-first-principles-to-production">Cloud Computing: From First Principles to Production<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#cloud-computing-from-first-principles-to-production" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h1>
<p>A learning document covering the mental models, mathematics, architecture,
and practical deployment patterns of modern cloud computing.</p>
<hr/>
<h2 id="1-mental-model-cloud-as-a-utility">1. Mental Model: Cloud as a Utility<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#1-mental-model-cloud-as-a-utility" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
<p>Before the power grid, every factory ran its own generator — buying equipment,
hiring engineers, and planning for peak demand even if peak was two hours/year.
The electric grid pooled generation across thousands of customers. Cloud is the
same transformation applied to compute, storage, and networking.</p>
<h3 id="three-first-principles">Three First Principles<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#three-first-principles" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<p><strong>Pooling</strong> — The provider aggregates resources into a shared pool across
tenants. Like a hotel: you rent a room when needed; the hotel serves more guests
per year than it has rooms because demand is staggered.</p>
<p><strong>Virtualization</strong> — Software layers abstract physical hardware into virtual
machines, networks, and disks. Like a taxi: you specify a destination without
owning the car. If one breaks down, another picks you up.</p>
<p><strong>Economies of Scale</strong> — Buying 100,000 servers costs ~60% less per unit than
buying 50. Savings pass through as lower prices than self-hosting.</p>
<pre><code>Individual company: 10 servers @ $8,000 each = $80,000
Cloud provider: 100,000 @ $3,200 each = bulk pricing
Per-unit savings: ~60%
</code></pre>
<p>These three principles compound. Pooling reduces waste, virtualization enables
pooling across heterogeneous workloads, and scale makes the whole operation
profitable even after passing savings to customers. Remove any one of the three
and cloud computing as an economic model collapses.</p>
<hr/>
<h2 id="2-architecture-how-the-cloud-is-built">2. Architecture: How the Cloud is Built<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#2-architecture-how-the-cloud-is-built" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
<h3 id="service-model-stack">Service Model Stack<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#service-model-stack" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<pre><code>+-----------------------------------------------------+
| SaaS (Gmail, Slack) You manage: nothing |
+-----------------------------------------------------+
| PaaS (Heroku, App Engine) You manage: code + data |
+-----------------------------------------------------+
| IaaS (EC2, Azure VMs) You manage: OS + runtime |
+-----------------------------------------------------+
| Physical (provider manages servers, power, cooling) |
+-----------------------------------------------------+
</code></pre>
<h3 id="vpc--az--subnet-layout">VPC / AZ / Subnet Layout<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#vpc--az--subnet-layout" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<pre><code>Region: us-east-1
+------------------------------------------------------------------+
| VPC: 10.0.0.0/16 |
| AZ: us-east-1a AZ: us-east-1b AZ: us-east-1c |
| +------------------+ +------------------+ +-------------- +|
| | Public 10.0.1/24 | | Public 10.0.3/24 | | Public 10.0.5 ||
| | [ALB] [NAT-GW] | | [ALB] | | [ALB] ||
| +------------------+ +------------------+ +---------------+|
| +------------------+ +------------------+ +---------------+|
| | Private 10.0.2/24| | Private 10.0.4/24| | Priv 10.0.6 ||
| | [EC2] [EC2] | | [EC2] [EC2] | | [EC2] [EC2] ||
| +------------------+ +------------------+ +---------------+|
| +------------------+ +------------------+ |
| | Data 10.0.7/24 | | Data 10.0.8/24 | (RDS Multi-AZ |
| | [RDS Primary] | | [RDS Standby] | auto-replicates)|
| +------------------+ +------------------+ |
| Internet GW --> Route Table --> Public Subnets |
| NAT GW ------> Route Table --> Private Subnets |
+------------------------------------------------------------------+
</code></pre>
<p><strong>Design rule</strong>: app servers in private subnets, only ALBs/NATs in public
subnets, databases in dedicated data subnets with strictest security groups.</p>
<h3 id="compute-evolution">Compute Evolution<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#compute-evolution" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<pre><code>2006 VMs (EC2) Full OS, minutes to provision, hypervisor isolation
2013 Containers (Docker) Shared kernel, seconds to start, namespace isolation
2015 Orchestration (K8s) Declarative scheduling, self-healing, auto-scaling
2014 Serverless (Lambda) No servers, ms startup, pay-per-invocation
2020s Convergence K8s + serverless (Knative), edge compute, Wasm
</code></pre>
<hr/>
<h2 id="3-math-foundation">3. Math Foundation<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#3-math-foundation" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
<h3 id="statistical-multiplexing-central-limit-theorem">Statistical Multiplexing (Central Limit Theorem)<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#statistical-multiplexing-central-limit-theorem" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<p>With <code>n</code> independent workloads each having mean <code>mu</code> and std dev <code>sigma</code>:</p>
<pre><code>Sum mean = n * mu
Sum std dev = sigma * sqrt(n)
CoV = sigma / (mu * sqrt(n)) <-- shrinks as 1/sqrt(n)
</code></pre>
<p><strong>Example with 1,000 VMs</strong> (each: <code>mu=0.40</code>, <code>sigma=0.20</code>):</p>
<pre><code>Single VM: CoV = 0.50, provision at mu+3*sigma = 1.00 core (100%)
1,000 VMs: Total mean = 400 cores, std dev = 6.32 cores
Provision at 400 + 3*6.32 = 419 cores (99.7% confidence)
Without pooling: 1,000 cores | With pooling: 419 cores | Savings: 58%
</code></pre>
<h3 id="availability-math">Availability Math<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#availability-math" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<pre><code>Nines Annual Downtime Formula (series): A = A1 * A2 * ... * An
99% 3.65 days Formula (parallel): A = 1 - (1-A1)(1-A2)...(1-An)
99.9% 8.77 hours
99.99% 52.6 minutes Six nines from two three-nine servers:
99.999% 5.26 minutes A = 1 - (0.001)^2 = 0.999999
99.9999% 31.5 seconds Two cheap servers > one expensive server
</code></pre>
<h3 id="load-balancing-algorithms">Load Balancing Algorithms<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#load-balancing-algorithms" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<p><strong>Round-Robin</strong>: requests cycle A<span>→</span>B<span>→</span>C<span>→</span>A. Simple, stateless, zero overhead.
Works well when all servers are identical and requests are uniform in cost.
Breaks when some requests are 100x heavier than others.</p>
<p><strong>Least-Connections</strong>: route to the server with fewest active connections.
Requires real-time connection tracking (state overhead), but handles variable
request durations well because busy servers naturally get fewer new requests.</p>
<p><strong>Weighted Round-Robin</strong>: assign weights proportional to server capacity.
An 8-core server gets weight 4, a 2-core gets weight 1 — so the big server
handles 4x the traffic. Useful in heterogeneous fleets during migrations.</p>
<h3 id="auto-scaling-formulas">Auto-Scaling Formulas<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#auto-scaling-formulas" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<p><strong>Target tracking</strong>: <code>desired = ceil(current_capacity * current_metric / target)</code>
Example: 4 instances at 80% CPU, target 50% <span>→</span> <code>ceil(4 * 80/50)</code> = 7 instances.</p>
<p><strong>Step scaling</strong>: fixed increments at threshold boundaries.</p>
<pre><code>CPU > 80%: add 3 instances (aggressive response to spikes)
CPU > 60%: add 1 instance (gentle scale-out)
CPU < 30%: remove 1 instance (gentle scale-in)
CPU < 15%: remove 2 instances (aggressive cost savings)
</code></pre>
<p>Step scaling reacts faster to sudden spikes but can overshoot. Target tracking
is smoother but slower to converge. Many production systems use both: target
tracking for steady-state, step scaling as a safety net for extreme spikes.</p>
<h3 id="reserved-vs-spot-cost-math">Reserved vs Spot Cost Math<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#reserved-vs-spot-cost-math" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<pre><code>Optimized 100-instance mix:
60 reserved @ $0.04/hr * 730h = $1,752/mo
28 spot @ $0.02/hr * 730h = $409/mo
12 on-demand @ $0.10/hr * 730h = $876/mo
Total: $3,037/mo vs $7,300 all on-demand = 58% savings
</code></pre>
<hr/>
<h2 id="4-step-by-step-aws-deployment-walkthrough">4. Step-by-Step: AWS Deployment Walkthrough<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#4-step-by-step-aws-deployment-walkthrough" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
<h3 id="step-1-vpc-creation">Step 1: VPC Creation<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#step-1-vpc-creation" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="bash" data-theme="github-light github-dark"><code data-language="bash" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">aws</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ec2</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> create-vpc</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --cidr-block</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 10.0.0.0/16</span></span>
<span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">aws</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ec2</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> create-internet-gateway</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # attach to VPC</span></span>
<span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">aws</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ec2</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> create-subnet</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --cidr-block</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 10.0.1.0/24</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --az</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> us-east-1a</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # public</span></span>
<span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">aws</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ec2</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> create-subnet</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --cidr-block</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 10.0.2.0/24</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --az</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> us-east-1a</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # private</span></span>
<span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">aws</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ec2</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> create-nat-gateway</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --subnet-id</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> <</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">public-subne</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">t</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">></span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # for private</span></span></code></pre></figure>
<h3 id="step-2-ec2-auto-scaling-group">Step 2: EC2 Auto Scaling Group<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#step-2-ec2-auto-scaling-group" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="bash" data-theme="github-light github-dark"><code data-language="bash" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">aws</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ec2</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> create-launch-template</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --instance-type</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> t3.medium</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --image-id</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ami-xxx</span></span>
<span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">aws</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> autoscaling</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> create-auto-scaling-group</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --min</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 2</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --max</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 20</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --desired</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 4</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \</span></span>
<span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --vpc-zone-identifier</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "subnet-priv1a,subnet-priv1b"</span></span>
<span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">aws</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> autoscaling</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> put-scaling-policy</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --policy-type</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> TargetTrackingScaling</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \</span></span>
<span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --target-value</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 50.0</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --metric</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ASGAverageCPUUtilization</span></span></code></pre></figure>
<h3 id="step-3-application-load-balancer">Step 3: Application Load Balancer<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#step-3-application-load-balancer" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="bash" data-theme="github-light github-dark"><code data-language="bash" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">aws</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> elbv2</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> create-load-balancer</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --type</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> application</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --subnets</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> pub1a</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> pub1b</span></span>
<span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">aws</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> elbv2</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> create-target-group</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --protocol</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> HTTP</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --port</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 80</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --health-check</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> /health</span></span>
<span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">aws</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> elbv2</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> create-listener</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --protocol</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> HTTPS</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --port</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 443</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --forward-to</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> target-group</span></span></code></pre></figure>
<h3 id="step-4-rds-multi-az">Step 4: RDS Multi-AZ<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#step-4-rds-multi-az" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="bash" data-theme="github-light github-dark"><code data-language="bash" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">aws</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> rds</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> create-db-instance</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --engine</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> postgres</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --multi-az</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \</span></span>
<span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --db-instance-class</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> db.r6g.xlarge</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --storage-encrypted</span></span>
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Synchronous standby in another AZ; automatic failover in 60-120s</span></span></code></pre></figure>
<h3 id="step-5-s3--cloudfront-cdn">Step 5: S3 + CloudFront CDN<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#step-5-s3--cloudfront-cdn" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="bash" data-theme="github-light github-dark"><code data-language="bash" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">aws</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> s3</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> mb</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> s3://prod-static-assets</span></span>
<span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">aws</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> cloudfront</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> create-distribution</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --origin</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> s3://prod-static-assets</span></span>
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 450+ edge locations: Tokyo user gets ~5ms vs ~150ms from Virginia origin</span></span></code></pre></figure>
<h3 id="step-6-cloudwatch-monitoring">Step 6: CloudWatch Monitoring<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#step-6-cloudwatch-monitoring" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="bash" data-theme="github-light github-dark"><code data-language="bash" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">aws</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> cloudwatch</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> put-metric-alarm</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --metric</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> CPUUtilization</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --threshold</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 85</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \</span></span>
<span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --alarm-actions</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> arn:aws:sns:...:ops-alerts</span></span></code></pre></figure>
<h3 id="traffic-spike-scenario">Traffic Spike Scenario<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#traffic-spike-scenario" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<pre><code>T+0m 500 req/s 4 instances CPU 35% steady state
T+3m 2000 req/s 4 instances CPU 78% traffic climbing
T+4m 2800 req/s 7 instances ASG scales: ceil(4*78/50) = 7
T+6m 4200 req/s 10 instances scales again: ceil(7*71/50) = 10
T+10m 5000 req/s 12 instances CPU 52% converged at target
T+30m 1000 req/s 8 instances scale-in begins (300s cooldown)
T+40m 500 req/s 4 instances back to steady state
</code></pre>
<p>Scale-out cooldown is short (60s) for fast reaction; scale-in cooldown
is long (300s) to prevent flapping. Over-provisioning during convergence
is intentional — better to spend $0.50 extra than drop requests.</p>
<hr/>
<h2 id="5-revolutionary-aspects">5. Revolutionary Aspects<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#5-revolutionary-aspects" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
<h3 id="capex-to-opex-transformation">CapEx to OpEx Transformation<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#capex-to-opex-transformation" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<pre><code>Traditional (5-year): $500K servers + $120K/yr datacenter + $200K/yr staff
Total: ~$1.95M
Cloud (5-year): ~$3K/mo scaling with revenue
Total: ~$180K for same workload (91% savings)
Hidden value: zero upfront capital, no hardware refresh, elastic spending
</code></pre>
<p>This didn’t just lower costs — it lowered the barrier to starting a company.
A startup that needed <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord">500</span><span class="mord mathnormal" style="margin-right:0.07153em;">K</span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mord mathnormal" style="margin-right:0.02778em;">or</span><span class="mord mathnormal">in</span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mord mathnormal" style="margin-right:0.02778em;">r</span><span class="mord mathnormal">a</span><span class="mord mathnormal">s</span><span class="mord mathnormal">t</span><span class="mord mathnormal" style="margin-right:0.02778em;">r</span><span class="mord mathnormal">u</span><span class="mord mathnormal">c</span><span class="mord mathnormal">t</span><span class="mord mathnormal">u</span><span class="mord mathnormal">re</span><span class="mord mathnormal">n</span><span class="mord mathnormal">o</span><span class="mord mathnormal" style="margin-right:0.01968em;">wl</span><span class="mord mathnormal">a</span><span class="mord mathnormal">u</span><span class="mord mathnormal">n</span><span class="mord mathnormal">c</span><span class="mord mathnormal">h</span><span class="mord mathnormal">es</span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mord mathnormal" style="margin-right:0.02778em;">or</span></span></span></span>50/month.</p>
<h3 id="vt-x-hardware-virtualization">VT-x Hardware Virtualization<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#vt-x-hardware-virtualization" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<p>Before Intel VT-x (2005), virtualization used binary translation: the
hypervisor intercepted and rewrote every privileged CPU instruction at
runtime. This imposed 20-40% performance overhead, making production
workloads on VMs impractical at scale.</p>
<p>VT-x introduced hardware-level support:</p>
<ul>
<li><strong>VMX root mode</strong>: hypervisor runs here with full hardware control</li>
<li><strong>VMX non-root mode</strong>: guest VMs run here; privileged instructions
automatically trap to root mode without binary translation</li>
<li><strong>Extended Page Tables (EPT)</strong>: hardware memory translation for guests,
eliminating costly shadow page tables</li>
<li><strong>VT-d (IOMMU)</strong>: direct device assignment so VMs get near-native I/O</li>
</ul>
<p>Result: overhead dropped from 20-40% to 2-5%. AWS EC2 launched in 2006,
one year after VT-x shipped — the hardware made the business model viable.</p>
<h3 id="dockerk8s-revolution">Docker/K8s Revolution<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#dockerk8s-revolution" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<p>Docker (2013) gave us “build once, run anywhere” with shared-kernel containers.
Kubernetes (2015, from Google’s Borg experience) won the orchestration wars with
its declarative desired-state model. By 2020, every major cloud offered managed
K8s (EKS/AKS/GKE). Impact: 10-50x density vs VMs, seconds to deploy, true
microservice portability.</p>
<h3 id="lambda-serverless">Lambda Serverless<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#lambda-serverless" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="python" data-theme="github-light github-dark"><code data-language="python" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> handler</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(event, context):</span></span>
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'statusCode'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">200</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'body'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Hello, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">event.get(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"name"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">!'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></figure>
<p>Upload a function, define a trigger, pay per millisecond of execution time.
Zero cost at zero traffic — the first truly pay-per-use compute model.</p>
<p>Serverless is ideal for:</p>
<ul>
<li>Event processing (S3 upload triggers image resize)</li>
<li>API backends (API Gateway routes to Lambda functions)</li>
<li>Scheduled tasks (nightly data processing, report generation)</li>
<li>Glue logic (connecting services without a persistent server)</li>
</ul>
<p>Serverless is NOT ideal for:</p>
<ul>
<li>Long-running processes (15-minute execution limit on Lambda)</li>
<li>Persistent connections (WebSockets require workarounds)</li>
<li>Latency-sensitive apps (cold starts range from 100ms to 5 seconds)</li>
<li>Constant high-throughput (cheaper to run reserved EC2 at steady load)</li>
</ul>
<hr/>
<h2 id="6-comparative-analysis">6. Comparative Analysis<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#6-comparative-analysis" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
<h3 id="a-deployment-models">(a) Deployment Models<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#a-deployment-models" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<div class="table-container"><table><thead><tr><th>Factor</th><th>On-Prem</th><th>IaaS</th><th>PaaS</th><th>Serverless</th></tr></thead><tbody><tr><td>Upfront Cost</td><td>Very High</td><td>None</td><td>None</td><td>None</td></tr><tr><td>Control</td><td>Full</td><td>High</td><td>Medium</td><td>Low</td></tr><tr><td>Scaling Speed</td><td>Days/Weeks</td><td>Minutes</td><td>Seconds</td><td>Milliseconds</td></tr><tr><td>Ops Burden</td><td>Heavy</td><td>Medium</td><td>Light</td><td>Minimal</td></tr><tr><td>Vendor Lock-in</td><td>None</td><td>Low</td><td>Medium</td><td>High</td></tr><tr><td>Best For</td><td>Regulated</td><td>Custom</td><td>Apps/APIs</td><td>Event-driven</td></tr></tbody></table></div>
<h3 id="b-cloud-providers">(b) Cloud Providers<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#b-cloud-providers" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<div class="table-container"><table><thead><tr><th>Category</th><th>AWS</th><th>Azure</th><th>GCP</th></tr></thead><tbody><tr><td>Compute</td><td>EC2, Lambda, EKS</td><td>VMs, Functions, AKS</td><td>GCE, Cloud Run, GKE</td></tr><tr><td>Storage</td><td>S3, EBS, EFS</td><td>Blob, Managed Disks</td><td>GCS, Persistent Disk</td></tr><tr><td>Database</td><td>RDS, DynamoDB, Aurora</td><td>SQL DB, Cosmos DB</td><td>Cloud SQL, Spanner</td></tr><tr><td>ML/AI</td><td>SageMaker, Bedrock</td><td>Azure ML, OpenAI Svc</td><td>Vertex AI, Gemini</td></tr><tr><td>Pricing</td><td>Reserved/Spot/Savings</td><td>Reserved/Spot/DevTest</td><td>CUD/Spot/Sustained</td></tr><tr><td>Strength</td><td>Broadest catalog</td><td>Enterprise/hybrid</td><td>Data/ML, simplicity</td></tr><tr><td>Share</td><td>~31%</td><td>~25%</td><td>~11%</td></tr></tbody></table></div>
<h3 id="c-compute-units">(c) Compute Units<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#c-compute-units" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<div class="table-container"><table><thead><tr><th>Factor</th><th>VMs</th><th>Containers</th><th>Serverless</th></tr></thead><tbody><tr><td>Startup</td><td>30-120 seconds</td><td>1-5 seconds</td><td>100-5000 ms</td></tr><tr><td>Isolation</td><td>Hypervisor (HW)</td><td>Namespaces (OS)</td><td>MicroVM (Firecracker)</td></tr><tr><td>Density</td><td>10-20/host</td><td>100-500/host</td><td>1000s/host</td></tr><tr><td>OS Overhead</td><td>1-10 GB</td><td>~50 MB</td><td>0 MB</td></tr><tr><td>State</td><td>Stateful default</td><td>Stateless by norm</td><td>Stateless by design</td></tr><tr><td>Use Cases</td><td>Legacy, DBs</td><td>Microservices</td><td>Events, APIs, glue</td></tr></tbody></table></div>
<hr/>
<h2 id="7-math-connections">7. Math Connections<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#7-math-connections" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
<h3 id="probability-and-statistics">Probability and Statistics<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#probability-and-statistics" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<p>Availability SLAs are probabilistic guarantees derived from component failure
data. Model server failure as a Poisson process: if a server fails on average
once per 1,000 hours (<code>lambda = 0.001/hr</code>), the probability of surviving a
24-hour window is:</p>
<pre><code>P(0 failures in 24h) = e^(-0.001 * 24) = e^(-0.024) = 0.9763
</code></pre>
<p>That’s 97.6% per day. Over a year: <code>0.9763^365 = 0.0001</code> — near-certain
failure. This is why redundancy is mandatory, not optional.</p>
<p>Traffic modeling also uses Poisson arrivals: if your mean rate is 200 req/s,
you can calculate the probability of exceeding 300 req/s and set auto-scaling
thresholds based on statistical confidence rather than guesswork.</p>
<h3 id="convex-optimization">Convex Optimization<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#convex-optimization" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<p>Cloud cost optimization is a constrained optimization problem:</p>
<pre><code>Minimize: C = sum(c_i * x_i) (total cost across resource types)
Subject to: sum(x_i) >= D (meet total demand)
x_i >= 0 (non-negative allocations)
x_reserved <= budget (capital budget constraint)
</code></pre>
<p>Costs are linear in allocation quantities, constraints are linear inequalities,
so the feasible region is convex and a global optimum is guaranteed. Tools like
AWS Cost Explorer and third-party optimizers (Spot.io, CloudHealth) solve
variants of this program continuously.</p>
<h3 id="graph-theory">Graph Theory<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#graph-theory" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<p>Cloud networks are graphs. CDN routing uses shortest-path (Dijkstra). VPC
peering across N regions uses minimum spanning trees (Kruskal/Prim) to
minimize connections. Capacity planning uses max-flow/min-cut (Ford-Fulkerson)
to find bottlenecks.</p>
<h3 id="distributed-consensus-and-raft">Distributed Consensus and Raft<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#distributed-consensus-and-raft" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<p>Distributed systems need to agree on a single value (who is leader, what
the next log entry is) even when nodes fail. This is the <strong>consensus problem</strong>.
Raft (2014, Ongaro & Ousterhout) solves it with three mechanisms:</p>
<ol>
<li><strong>Leader election</strong> — randomized timeouts + majority vote ensure exactly
one leader per term. Two leaders cannot coexist because two majorities
must overlap on at least one node (quorum intersection).</li>
<li><strong>Log replication</strong> — leader appends, broadcasts, commits once a majority
ACK. Followers apply committed entries to their state machines in order.</li>
<li><strong>Safety</strong> — only a candidate with the most up-to-date log can win an
election, so committed entries are never overwritten.</li>
</ol>
<p>The quorum math: an n-node cluster tolerates <code>⌊(n-1)/2⌋</code> failures.
n=3 tolerates 1; n=5 tolerates 2. Odd sizes are standard — n=4 still only
tolerates 1 failure (needs 3 ACKs) but has higher write latency than n=3.</p>
<p>Real-world usage: etcd (Kubernetes config), CockroachDB (per-range Raft
groups), TiKV, Consul. Without consensus, redundant nodes produce
split-brain — two nodes accepting conflicting writes simultaneously.
See <code>MentalModels/04_fault_tolerance.md</code> for the full mental model with
diagrams and quorum tables.</p>
<h3 id="permutations-and-consistent-hashing">Permutations and Consistent Hashing<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#permutations-and-consistent-hashing" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<p>Distributed caches map servers and keys onto a circular hash ring. When a
server is added/removed, only <code>K/n</code> keys remap (not all K). With virtual
nodes, each server gets approximately <code>K/n</code> keys with <code>O(log n)</code> deviation.
Total possible assignments: <code>n^K</code> (permutations with repetition).</p>
<h3 id="number-theory-cryptography">Number Theory (Cryptography)<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#number-theory-cryptography" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<p>Every HTTPS call uses TLS built on number theory. RSA: factoring semiprimes.
ECC: discrete logarithm on elliptic curves (256-bit ECC = 3072-bit RSA).
AWS SigV4 signs every API request via iterated HMAC-SHA256:</p>
<pre><code>SigningKey = HMAC(HMAC(HMAC(HMAC("AWS4"+Secret, Date), Region), Service), "aws4_request")
</code></pre>
<p>This chain design ensures a compromised signing key for one region/service/date
cannot be reused elsewhere. The security rests on the preimage resistance of
SHA-256 — a property rooted in number-theoretic hardness assumptions.</p>
<hr/>
<h2 id="dsa-connections">DSA Connections<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#dsa-connections" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
<h3 id="consistent-hashing--distributed-cache-scaling">Consistent Hashing — Distributed Cache Scaling<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#consistent-hashing--distributed-cache-scaling" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<p>Consistent hashing arranges both servers and keys on a virtual ring, so adding or removing a node only redistributes keys from its immediate neighbors — O(K/n) keys move instead of O(K). The document’s discussion of auto-scaling and stateless horizontal scaling directly depends on this: when an ElastiCache Memcached cluster scales out, consistent hashing ensures that only the keys between the new node and its ring predecessor need to migrate. Without it, adding a cache node would invalidate the entire cache (a full rehash), causing a thundering herd to the database. The “permutations and consistent hashing” section in this document notes that virtual nodes reduce deviation to O(log n), which is what makes elastic scaling of caches practical at the 100,000+ key scale that production systems require.</p>
<h3 id="dynamic-programming--optimal-reservedspoton-demand-mix">Dynamic Programming — Optimal Reserved/Spot/On-Demand Mix<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#dynamic-programming--optimal-reservedspoton-demand-mix" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<p>The document’s cost math section frames the pricing mix as a linear optimization problem: minimize <code>C = sum(c_i * x_i)</code> subject to demand and budget constraints. This is solvable as a linear program, but the more general version — choosing commitment durations (1-year vs 3-year), payment options (no upfront vs all upfront), and instance families across multiple workloads with varying demand profiles — has overlapping subproblems that make it a dynamic programming problem. The “optimized 100-instance mix” example (60 reserved + 28 spot + 12 on-demand = 58% savings) is the output of such an optimization. Each subproblem asks: “given this workload’s demand distribution, what is the cheapest coverage strategy for the next month, given commitments already made?” The optimal solution at month 12 depends on choices at months 1-11 — classic DP structure.</p>
<h3 id="graph-theory-shortest-path-spanning-trees--network-architecture">Graph Theory (Shortest Path, Spanning Trees) — Network Architecture<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#graph-theory-shortest-path-spanning-trees--network-architecture" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<p>The VPC/AZ/subnet layout in this document is a graph: regions are disconnected components, AZs are vertices within a region, and subnets are sub-vertices connected by route table edges. CDN routing from a Tokyo user to a Virginia origin traverses the shortest-latency path across AWS’s backbone graph — a Dijkstra problem where edge weights are propagation delays. The document notes that VPC peering across N regions uses minimum spanning trees (Kruskal/Prim) to minimize connections, and that capacity planning uses max-flow/min-cut (Ford-Fulkerson) to identify bottlenecks. The ALB’s path-based routing (/api/* to one target, /static/* to another) is a trie-based dispatch at the application layer, mapping URL prefixes to backend target groups in O(prefix length) time.</p>
<h3 id="poisson-processes-and-queuing-theory--availability-and-scaling-thresholds">Poisson Processes and Queuing Theory — Availability and Scaling Thresholds<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#poisson-processes-and-queuing-theory--availability-and-scaling-thresholds" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
<p>The document models server failure as a Poisson process with rate lambda=0.001/hr, yielding P(survival over 24h) = e^(-0.024) = 97.6%. This is the same exponential distribution that underlies M/M/1 and M/M/c queuing models used for capacity planning. The auto-scaling formula <code>desired = ceil(current_capacity * current_metric / target)</code> is a deterministic approximation of the queue-theoretic result that for an M/M/c queue, utilization must stay below a threshold to maintain bounded waiting times. The document’s step-scaling policy (add 3 instances at CPU > 80%, add 1 at CPU > 60%) is a piecewise-linear approximation of the nonlinear relationship between utilization and response time in queuing theory — response time grows as 1/(1-rho), so the system must scale more aggressively as utilization approaches 1.0.</p>
<hr/>
<h2 id="8-key-takeaways">8. Key Takeaways<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#8-key-takeaways" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
<ol>
<li>
<p><strong>Cloud is utility computing, not magic.</strong> Pooling, virtualization, and
economies of scale turned private servers into a metered utility — the
same way the electric grid replaced private generators.</p>
</li>
<li>
<p><strong>Redundancy is multiplicative.</strong> Two 99.9% components in parallel yield
99.9999%. Always distribute across availability zones.</p>
</li>
<li>
<p><strong>Statistical multiplexing is the pricing engine.</strong> The Central Limit
Theorem guarantees aggregate demand is predictable — providers need 58%
fewer resources than the sum of individual peaks.</p>
</li>
<li>
<p><strong>The compute spectrum trades control for convenience.</strong> VMs give full
control with high ops burden; serverless gives zero ops with limited
control. Match the tradeoff to your team and application.</p>
</li>
<li>
<p><strong>Cost optimization is solvable math.</strong> Reserved for baseline, spot for
burst, on-demand for overflow. The optimal mix is a linear program that
can save 50-70% over naive on-demand usage.</p>
</li>
</ol>
<hr/>
<p><em>Document version: 2026-05-09. Covers AWS, Azure, and GCP as of early 2025
service catalogs. Pricing examples are illustrative and will vary by region
and instance generation.</em></p></article><hr/><div class="page-footer"></div></div><div class="right sidebar"><div class="graph"><h3>Graph View</h3><div class="graph-outer"><div class="graph-container" data-cfg="{"drag":true,"zoom":true,"depth":1,"scale":1.1,"repelForce":0.5,"centerForce":0.3,"linkDistance":30,"fontSize":0.6,"opacityScale":1,"showTags":true,"removeTags":[],"focusOnHover":false,"enableRadial":false}"></div><button class="global-graph-icon" aria-label="Global Graph"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 55 55" fill="currentColor" xml:space="preserve"><path d="M49,0c-3.309,0-6,2.691-6,6c0,1.035,0.263,2.009,0.726,2.86l-9.829,9.829C32.542,17.634,30.846,17,29,17
s-3.542,0.634-4.898,1.688l-7.669-7.669C16.785,10.424,17,9.74,17,9c0-2.206-1.794-4-4-4S9,6.794,9,9s1.794,4,4,4
c0.74,0,1.424-0.215,2.019-0.567l7.669,7.669C21.634,21.458,21,23.154,21,25s0.634,3.542,1.688,4.897L10.024,42.562
C8.958,41.595,7.549,41,6,41c-3.309,0-6,2.691-6,6s2.691,6,6,6s6-2.691,6-6c0-1.035-0.263-2.009-0.726-2.86l12.829-12.829
c1.106,0.86,2.44,1.436,3.898,1.619v10.16c-2.833,0.478-5,2.942-5,5.91c0,3.309,2.691,6,6,6s6-2.691,6-6c0-2.967-2.167-5.431-5-5.91
v-10.16c1.458-0.183,2.792-0.759,3.898-1.619l7.669,7.669C41.215,39.576,41,40.26,41,41c0,2.206,1.794,4,4,4s4-1.794,4-4
s-1.794-4-4-4c-0.74,0-1.424,0.215-2.019,0.567l-7.669-7.669C36.366,28.542,37,26.846,37,25s-0.634-3.542-1.688-4.897l9.665-9.665
C46.042,11.405,47.451,12,49,12c3.309,0,6-2.691,6-6S52.309,0,49,0z M11,9c0-1.103,0.897-2,2-2s2,0.897,2,2s-0.897,2-2,2
S11,10.103,11,9z M6,51c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S8.206,51,6,51z M33,49c0,2.206-1.794,4-4,4s-4-1.794-4-4
s1.794-4,4-4S33,46.794,33,49z M29,31c-3.309,0-6-2.691-6-6s2.691-6,6-6s6,2.691,6,6S32.309,31,29,31z M47,41c0,1.103-0.897,2-2,2
s-2-0.897-2-2s0.897-2,2-2S47,39.897,47,41z M49,10c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S51.206,10,49,10z"></path></svg></button></div><div class="global-graph-outer"><div class="global-graph-container" data-cfg="{"drag":true,"zoom":true,"depth":-1,"scale":0.9,"repelForce":0.5,"centerForce":0.2,"linkDistance":30,"fontSize":0.6,"opacityScale":1,"showTags":true,"removeTags":[],"focusOnHover":true,"enableRadial":true}"></div></div></div><div class="toc desktop-only"><button type="button" class="toc-header" aria-controls="toc-34" aria-expanded="true"><h3>Table of Contents</h3><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="fold"><polyline points="6 9 12 15 18 9"></polyline></svg></button><ul id="list-1" class="toc-content overflow"><li class="depth-0"><a href="#cloud-computing-from-first-principles-to-production" data-for="cloud-computing-from-first-principles-to-production">Cloud Computing: From First Principles to Production</a></li><li class="depth-1"><a href="#1-mental-model-cloud-as-a-utility" data-for="1-mental-model-cloud-as-a-utility">1. Mental Model: Cloud as a Utility</a></li><li class="depth-2"><a href="#three-first-principles" data-for="three-first-principles">Three First Principles</a></li><li class="depth-1"><a href="#2-architecture-how-the-cloud-is-built" data-for="2-architecture-how-the-cloud-is-built">2. Architecture: How the Cloud is Built</a></li><li class="depth-2"><a href="#service-model-stack" data-for="service-model-stack">Service Model Stack</a></li><li class="depth-2"><a href="#vpc--az--subnet-layout" data-for="vpc--az--subnet-layout">VPC / AZ / Subnet Layout</a></li><li class="depth-2"><a href="#compute-evolution" data-for="compute-evolution">Compute Evolution</a></li><li class="depth-1"><a href="#3-math-foundation" data-for="3-math-foundation">3. Math Foundation</a></li><li class="depth-2"><a href="#statistical-multiplexing-central-limit-theorem" data-for="statistical-multiplexing-central-limit-theorem">Statistical Multiplexing (Central Limit Theorem)</a></li><li class="depth-2"><a href="#availability-math" data-for="availability-math">Availability Math</a></li><li class="depth-2"><a href="#load-balancing-algorithms" data-for="load-balancing-algorithms">Load Balancing Algorithms</a></li><li class="depth-2"><a href="#auto-scaling-formulas" data-for="auto-scaling-formulas">Auto-Scaling Formulas</a></li><li class="depth-2"><a href="#reserved-vs-spot-cost-math" data-for="reserved-vs-spot-cost-math">Reserved vs Spot Cost Math</a></li><li class="depth-1"><a href="#4-step-by-step-aws-deployment-walkthrough" data-for="4-step-by-step-aws-deployment-walkthrough">4. Step-by-Step: AWS Deployment Walkthrough</a></li><li class="depth-2"><a href="#step-1-vpc-creation" data-for="step-1-vpc-creation">Step 1: VPC Creation</a></li><li class="depth-2"><a href="#step-2-ec2-auto-scaling-group" data-for="step-2-ec2-auto-scaling-group">Step 2: EC2 Auto Scaling Group</a></li><li class="depth-2"><a href="#step-3-application-load-balancer" data-for="step-3-application-load-balancer">Step 3: Application Load Balancer</a></li><li class="depth-2"><a href="#step-4-rds-multi-az" data-for="step-4-rds-multi-az">Step 4: RDS Multi-AZ</a></li><li class="depth-2"><a href="#step-5-s3--cloudfront-cdn" data-for="step-5-s3--cloudfront-cdn">Step 5: S3 + CloudFront CDN</a></li><li class="depth-2"><a href="#step-6-cloudwatch-monitoring" data-for="step-6-cloudwatch-monitoring">Step 6: CloudWatch Monitoring</a></li><li class="depth-2"><a href="#traffic-spike-scenario" data-for="traffic-spike-scenario">Traffic Spike Scenario</a></li><li class="depth-1"><a href="#5-revolutionary-aspects" data-for="5-revolutionary-aspects">5. Revolutionary Aspects</a></li><li class="depth-2"><a href="#capex-to-opex-transformation" data-for="capex-to-opex-transformation">CapEx to OpEx Transformation</a></li><li class="depth-2"><a href="#vt-x-hardware-virtualization" data-for="vt-x-hardware-virtualization">VT-x Hardware Virtualization</a></li><li class="depth-2"><a href="#dockerk8s-revolution" data-for="dockerk8s-revolution">Docker/K8s Revolution</a></li><li class="depth-2"><a href="#lambda-serverless" data-for="lambda-serverless">Lambda Serverless</a></li><li class="depth-1"><a href="#6-comparative-analysis" data-for="6-comparative-analysis">6. Comparative Analysis</a></li><li class="depth-2"><a href="#a-deployment-models" data-for="a-deployment-models">(a) Deployment Models</a></li><li class="depth-2"><a href="#b-cloud-providers" data-for="b-cloud-providers">(b) Cloud Providers</a></li><li class="depth-2"><a href="#c-compute-units" data-for="c-compute-units">(c) Compute Units</a></li><li class="depth-1"><a href="#7-math-connections" data-for="7-math-connections">7. Math Connections</a></li><li class="depth-2"><a href="#probability-and-statistics" data-for="probability-and-statistics">Probability and Statistics</a></li><li class="depth-2"><a href="#convex-optimization" data-for="convex-optimization">Convex Optimization</a></li><li class="depth-2"><a href="#graph-theory" data-for="graph-theory">Graph Theory</a></li><li class="depth-2"><a href="#distributed-consensus-and-raft" data-for="distributed-consensus-and-raft">Distributed Consensus and Raft</a></li><li class="depth-2"><a href="#permutations-and-consistent-hashing" data-for="permutations-and-consistent-hashing">Permutations and Consistent Hashing</a></li><li class="depth-2"><a href="#number-theory-cryptography" data-for="number-theory-cryptography">Number Theory (Cryptography)</a></li><li class="depth-1"><a href="#dsa-connections" data-for="dsa-connections">DSA Connections</a></li><li class="depth-2"><a href="#consistent-hashing--distributed-cache-scaling" data-for="consistent-hashing--distributed-cache-scaling">Consistent Hashing — Distributed Cache Scaling</a></li><li class="depth-2"><a href="#dynamic-programming--optimal-reservedspoton-demand-mix" data-for="dynamic-programming--optimal-reservedspoton-demand-mix">Dynamic Programming — Optimal Reserved/Spot/On-Demand Mix</a></li><li class="depth-2"><a href="#graph-theory-shortest-path-spanning-trees--network-architecture" data-for="graph-theory-shortest-path-spanning-trees--network-architecture">Graph Theory (Shortest Path, Spanning Trees) — Network Architecture</a></li><li class="depth-2"><a href="#poisson-processes-and-queuing-theory--availability-and-scaling-thresholds" data-for="poisson-processes-and-queuing-theory--availability-and-scaling-thresholds">Poisson Processes and Queuing Theory — Availability and Scaling Thresholds</a></li><li class="depth-1"><a href="#8-key-takeaways" data-for="8-key-takeaways">8. Key Takeaways</a></li><li class="overflow-end"></li></ul></div><div class="backlinks"><h3>Backlinks</h3><ul id="list-2" class="overflow"><li><a href="../" class="internal">index</a></li><li class="overflow-end"></li></ul></div></div><footer class><p>Created with <a href="https://quartz.jzhao.xyz/">Quartz v4.5.2</a> © 2026</p><ul><li><a href="https://github.com/jackyzha0/quartz">GitHub</a></li><li><a href="https://discord.gg/cRFFHYye7t">Discord Community</a></li></ul></footer></div></div></body><script type="application/javascript">function n(){let t=this.parentElement;t.classList.toggle("is-collapsed");let e=t.getElementsByClassName("callout-content")[0];if(!e)return;let l=t.classList.contains("is-collapsed");e.style.gridTemplateRows=l?"0fr":"1fr"}function c(){let t=document.getElementsByClassName("callout is-collapsible");for(let e of t){let l=e.getElementsByClassName("callout-title")[0],s=e.getElementsByClassName("callout-content")[0];if(!l||!s)continue;l.addEventListener("click",n),window.addCleanup(()=>l.removeEventListener("click",n));let o=e.classList.contains("is-collapsed");s.style.gridTemplateRows=o?"0fr":"1fr"}}document.addEventListener("nav",c);
</script><script type="module">function f(i,e){if(!i)return;function r(o){o.target===this&&(o.preventDefault(),o.stopPropagation(),e())}function t(o){o.key.startsWith("Esc")&&(o.preventDefault(),e())}i?.addEventListener("click",r),window.addCleanup(()=>i?.removeEventListener("click",r)),document.addEventListener("keydown",t),window.addCleanup(()=>document.removeEventListener("keydown",t))}function y(i){for(;i.firstChild;)i.removeChild(i.firstChild)}var h=class{constructor(e,r){this.container=e;this.content=r;this.setupEventListeners(),this.setupNavigationControls(),this.resetTransform()}isDragging=!1;startPan={x:0,y:0};currentPan={x:0,y:0};scale=1;MIN_SCALE=.5;MAX_SCALE=3;cleanups=[];setupEventListeners(){let e=this.onMouseDown.bind(this),r=this.onMouseMove.bind(this),t=this.onMouseUp.bind(this),o=this.resetTransform.bind(this);this.container.addEventListener("mousedown",e),document.addEventListener("mousemove",r),document.addEventListener("mouseup",t),window.addEventListener("resize",o),this.cleanups.push(()=>this.container.removeEventListener("mousedown",e),()=>document.removeEventListener("mousemove",r),()=>document.removeEventListener("mouseup",t),()=>window.removeEventListener("resize",o))}cleanup(){for(let e of this.cleanups)e()}setupNavigationControls(){let e=document.createElement("div");e.className="mermaid-controls";let r=this.createButton("+",()=>this.zoom(.1)),t=this.createButton("-",()=>this.zoom(-.1)),o=this.createButton("Reset",()=>this.resetTransform());e.appendChild(t),e.appendChild(o),e.appendChild(r),this.container.appendChild(e)}createButton(e,r){let t=document.createElement("button");return t.textContent=e,t.className="mermaid-control-button",t.addEventListener("click",r),window.addCleanup(()=>t.removeEventListener("click",r)),t}onMouseDown(e){e.button===0&&(this.isDragging=!0,this.startPan={x:e.clientX-this.currentPan.x,y:e.clientY-this.currentPan.y},this.container.style.cursor="grabbing")}onMouseMove(e){this.isDragging&&(e.preventDefault(),this.currentPan={x:e.clientX-this.startPan.x,y:e.clientY-this.startPan.y},this.updateTransform())}onMouseUp(){this.isDragging=!1,this.container.style.cursor="grab"}zoom(e){let r=Math.min(Math.max(this.scale+e,this.MIN_SCALE),this.MAX_SCALE),t=this.content.getBoundingClientRect(),o=t.width/2,n=t.height/2,c=r-this.scale;this.currentPan.x-=o*c,this.currentPan.y-=n*c,this.scale=r,this.updateTransform()}updateTransform(){this.content.style.transform=`translate(${this.currentPan.x}px, ${this.currentPan.y}px) scale(${this.scale})`}resetTransform(){this.scale=1;let e=this.content.querySelector("svg");this.currentPan={x:e.getBoundingClientRect().width/2,y:e.getBoundingClientRect().height/2},this.updateTransform()}},C=["--secondary","--tertiary","--gray","--light","--lightgray","--highlight","--dark","--darkgray","--codeFont"],E;document.addEventListener("nav",async()=>{let e=document.querySelector(".center").querySelectorAll("code.mermaid");if(e.length===0)return;E||=await import("https://cdnjs.cloudflare.com/ajax/libs/mermaid/11.4.0/mermaid.esm.min.mjs");let r=E.default,t=new WeakMap;for(let n of e)t.set(n,n.innerText);async function o(){for(let s of e){s.removeAttribute("data-processed");let a=t.get(s);a&&(s.innerHTML=a)}let n=C.reduce((s,a)=>(s[a]=window.getComputedStyle(document.documentElement).getPropertyValue(a),s),{}),c=document.documentElement.getAttribute("saved-theme")==="dark";r.initialize({startOnLoad:!1,securityLevel:"loose",theme:c?"dark":"base",themeVariables:{fontFamily:n["--codeFont"],primaryColor:n["--light"],primaryTextColor:n["--darkgray"],primaryBorderColor:n["--tertiary"],lineColor:n["--darkgray"],secondaryColor:n["--secondary"],tertiaryColor:n["--tertiary"],clusterBkg:n["--light"],edgeLabelBackground:n["--highlight"]}}),await r.run({nodes:e})}await o(),document.addEventListener("themechange",o),window.addCleanup(()=>document.removeEventListener("themechange",o));for(let n=0;n<e.length;n++){let v=function(){let g=l.querySelector("#mermaid-space"),m=l.querySelector(".mermaid-content");if(!m)return;y(m);let w=c.querySelector("svg").cloneNode(!0);m.appendChild(w),l.classList.add("active"),g.style.cursor="grab",u=new h(g,m)},M=function(){l.classList.remove("active"),u?.cleanup(),u=null},c=e[n],s=c.parentElement,a=s.querySelector(".clipboard-button"),d=s.querySelector(".expand-button"),p=window.getComputedStyle(a),L=a.offsetWidth+parseFloat(p.marginLeft||"0")+parseFloat(p.marginRight||"0");d.style.right=`calc(${L}px + 0.3rem)`,s.prepend(d);let l=s.querySelector("#mermaid-container");if(!l)return;let u=null;d.addEventListener("click",v),f(l,M),window.addCleanup(()=>{u?.cleanup(),d.removeEventListener("click",v)})}});
</script><script src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/copy-tex.min.js" type="application/javascript"></script><script src="../postscript.js" type="module"></script></html>