New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(autoscaling): support default instance warmup for Auto Scaling groups #23285
Changes from 10 commits
5eca161
65e245e
9230d72
0cddc0e
a425a91
dfe63fd
03b2643
51c96c4
a1f8f06
efc28d4
d4dd48e
d63c1ce
ddc8879
9d8f8a9
379ab07
5b4ec30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -574,6 +574,28 @@ autoScalingGroup.addWarmPool({ | |
}); | ||
``` | ||
|
||
### Default Instance Warming | ||
|
||
You can use the default instance warmup feature to improve the Amazon CloudWatch metrics used for dynamic scaling. When default instance warmup is not enabled, each instance starts contributing usage data to the aggregated metrics as soon as the instance reaches the InService state. However, if you enable default instance warmup, this lets your instances finish warming up before they contribute the usage data. | ||
|
||
To optimize the performance of scaling policies that scale continuously, such as target tracking and step scaling policies, we strongly recommend that you enable the default instance warmup, even if its value is set to 0 seconds. | ||
|
||
To set up Default Instance Warming for an autoscaling group, simply pass it in as a prop | ||
|
||
```ts | ||
declare const autoScalingGroup: autoscaling.AutoScalingGroup; | ||
|
||
new autoscaling.AutoScalingGroup(this, 'ASG', { | ||
vpc, | ||
instanceType, | ||
machineImage, | ||
|
||
// ... | ||
|
||
defaultInstanceWarmup: cdk.Duration.seconds(5), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok i'm going to investigate why this succeeded in the first place because it really shouldn't :). but you should know: these examples are required to be compiling, and can show up in the API documentation as stand-alone examples without the markdown context surrounding it. the way we compile it is to copy/paste the example into |
||
}); | ||
``` | ||
|
||
## Future work | ||
|
||
* [ ] CloudWatch Events (impossible to add currently as the AutoScalingGroup ARN is | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -336,6 +336,18 @@ export interface CommonAutoScalingGroupProps { | |
* @default - `TerminationPolicy.DEFAULT` | ||
*/ | ||
readonly terminationPolicies?: TerminationPolicy[]; | ||
|
||
/** | ||
* The amount of time, in seconds, until a newly launched instance can contribute to the Amazon CloudWatch metrics. | ||
* This delay lets an instance finish initializing before Amazon EC2 Auto Scaling aggregates instance metrics, | ||
* resulting in more reliable usage data. Set this value equal to the amount of time that it takes for resource | ||
* consumption to become stable after an instance reaches the InService state. | ||
* | ||
* @see https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-default-instance-warmup.html | ||
* | ||
* @default None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this what we decided on? if so, I don't like calling the default none. That's not very descriptive for the user, because what does none imply? there's no default instance warmup? or that the value is 0? we can afford to be a bit more descriptive here (and i know we say |
||
*/ | ||
readonly defaultInstanceWarmup?: Duration; | ||
} | ||
|
||
/** | ||
|
@@ -1344,6 +1356,7 @@ export class AutoScalingGroup extends AutoScalingGroupBase implements | |
maxInstanceLifetime: this.maxInstanceLifetime ? this.maxInstanceLifetime.toSeconds() : undefined, | ||
newInstancesProtectedFromScaleIn: Lazy.any({ produce: () => this.newInstancesProtectedFromScaleIn }), | ||
terminationPolicies: props.terminationPolicies, | ||
defaultInstanceWarmup: props.defaultInstanceWarmup?.toSeconds(), | ||
...this.getLaunchSettings(launchConfig, props.launchTemplate, props.mixedInstancesPolicy), | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"version":"21.0.0"} | ||
{"version":"22.0.0"} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "21.0.0", | ||
"version": "22.0.0", | ||
"testCases": { | ||
"integ.asg-lt": { | ||
"stacks": [ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets split these up into different lines for better readability in raw mode.