Commit 0adf6c7
fix(autoscaling): every deployment resets capacity (#5507)
* fix(autoscaling): every deployment resets capacity
If `DesiredCapacity` is specified in the CloudFormation template, on every
deployment the capacity of the AutoScalingGroup is reset to that number,
even if the group had been scaled out at that point. The solution is to
leave DesiredCapacity empty, in which case it will remain untouched
during a deployment.
Previously, CDK would use some logic to always calculate a
DesiredCapacity for you, even if you left the `desiredCapacity` property
unset, leading to the undesirable behavior--which frankly represents
an availability risk.
Now, if you don't specify `desiredCapacity`, we won't set
`DesiredCapacity` either, avoiding the availability risk that we
introduced beforehand. In fact, if you *do* set `desiredCapacity`, we
will warn you that you probably shouldn't using a construct warning.
Fixes #5215, closes #5208.
BREAKING CHANGE: AutoScalingGroups without `desiredCapacity` are now
initially scaled to their minimum capacity (instead of their maximum
capaciety).
* Add links
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>1 parent c388ad6 commit 0adf6c7
File tree
24 files changed
+138
-50
lines changed- packages/@aws-cdk
- aws-autoscaling
- lib
- test
- aws-codedeploy/test/server
- aws-ecs-patterns/test/ec2
- aws-ecs/test
- ec2
- aws-eks/test
- aws-events-targets/test/ecs
- aws-stepfunctions-tasks/test
24 files changed
+138
-50
lines changedLines changed: 21 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
48 | 52 | | |
49 | 53 | | |
50 | 54 | | |
| |||
475 | 479 | | |
476 | 480 | | |
477 | 481 | | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
| 482 | + | |
| 483 | + | |
482 | 484 | | |
483 | | - | |
| 485 | + | |
| 486 | + | |
484 | 487 | | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
485 | 493 | | |
| 494 | + | |
486 | 495 | | |
487 | 496 | | |
488 | 497 | | |
489 | 498 | | |
490 | 499 | | |
| 500 | + | |
491 | 501 | | |
492 | 502 | | |
493 | 503 | | |
494 | 504 | | |
495 | 505 | | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
496 | 510 | | |
497 | 511 | | |
498 | 512 | | |
499 | 513 | | |
500 | 514 | | |
501 | | - | |
| 515 | + | |
502 | 516 | | |
503 | 517 | | |
504 | 518 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
454 | | - | |
455 | 454 | | |
456 | 455 | | |
457 | 456 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
631 | 631 | | |
632 | 632 | | |
633 | 633 | | |
634 | | - | |
635 | 634 | | |
636 | 635 | | |
637 | 636 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
475 | | - | |
476 | 475 | | |
477 | 476 | | |
478 | 477 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
454 | | - | |
455 | 454 | | |
456 | 455 | | |
457 | 456 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
604 | 604 | | |
605 | 605 | | |
606 | 606 | | |
607 | | - | |
608 | 607 | | |
609 | 608 | | |
610 | 609 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
455 | | - | |
456 | 455 | | |
457 | 456 | | |
458 | 457 | | |
| |||
Lines changed: 1 addition & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
117 | 116 | | |
118 | 117 | | |
119 | 118 | | |
| |||
252 | 251 | | |
253 | 252 | | |
254 | 253 | | |
255 | | - | |
256 | 254 | | |
257 | 255 | | |
258 | 256 | | |
| |||
275 | 273 | | |
276 | 274 | | |
277 | 275 | | |
278 | | - | |
279 | | - | |
| 276 | + | |
280 | 277 | | |
281 | 278 | | |
282 | 279 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
683 | 683 | | |
684 | 684 | | |
685 | 685 | | |
686 | | - | |
687 | 686 | | |
688 | 687 | | |
689 | 688 | | |
| |||
885 | 884 | | |
886 | 885 | | |
887 | 886 | | |
888 | | - | |
| 887 | + | |
0 commit comments