agent-claw: automated task changes
This commit is contained in:
13
cdk/node_modules/aws-cdk-lib/aws-autoscaling/.jsiirc.json
generated
vendored
Normal file
13
cdk/node_modules/aws-cdk-lib/aws-autoscaling/.jsiirc.json
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"targets": {
|
||||
"java": {
|
||||
"package": "software.amazon.awscdk.services.autoscaling"
|
||||
},
|
||||
"dotnet": {
|
||||
"namespace": "Amazon.CDK.AWS.AutoScaling"
|
||||
},
|
||||
"python": {
|
||||
"module": "aws_cdk.aws_autoscaling"
|
||||
}
|
||||
}
|
||||
}
|
||||
898
cdk/node_modules/aws-cdk-lib/aws-autoscaling/README.md
generated
vendored
Normal file
898
cdk/node_modules/aws-cdk-lib/aws-autoscaling/README.md
generated
vendored
Normal file
@@ -0,0 +1,898 @@
|
||||
# Amazon EC2 Auto Scaling Construct Library
|
||||
|
||||
|
||||
|
||||
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.
|
||||
|
||||
## Auto Scaling Group
|
||||
|
||||
An `AutoScalingGroup` represents a number of instances on which you run your code. You
|
||||
pick the size of the fleet, the instance type and the OS image:
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO),
|
||||
|
||||
// The latest Amazon Linux 2 image
|
||||
machineImage: ec2.MachineImage.latestAmazonLinux2(),
|
||||
});
|
||||
```
|
||||
|
||||
Creating an `AutoScalingGroup` from a Launch Configuration has been deprecated. All new accounts created after December 31, 2023 will no longer be able to create Launch Configurations. With the `@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig` feature flag set to true, `AutoScalingGroup` properties used to create a Launch Configuration will now be used to create a `LaunchTemplate` using a [Launch Configuration to `LaunchTemplate` mapping](https://docs.aws.amazon.com/autoscaling/ec2/userguide/migrate-launch-configurations-with-cloudformation.html#launch-configuration-mapping-reference). Specifically, the following `AutoScalingGroup` properties will be used to generate a `LaunchTemplate`:
|
||||
* machineImage
|
||||
* keyName (deprecated, prefer keyPair)
|
||||
* keyPair
|
||||
* instanceType
|
||||
* instanceMonitoring
|
||||
* securityGroup
|
||||
* role
|
||||
* userData
|
||||
* associatePublicIpAddress
|
||||
* spotPrice
|
||||
* blockDevices
|
||||
|
||||
After the Launch Configuration is replaced with a `LaunchTemplate`, any new instances launched by the `AutoScalingGroup` will use the new `LaunchTemplate`. Existing instances are not affected. To update an existing instance, you can allow the `AutoScalingGroup` to gradually replace existing instances with new instances based on the `terminationPolicies` for the `AutoScalingGroup`. Alternatively, you can terminate them yourself and force the `AutoScalingGroup` to launch new instances to maintain the `desiredCapacity`.
|
||||
|
||||
Support for creating an `AutoScalingGroup` from a `LaunchTemplate` was added in CDK version 2.21.0. Users on a CDK version earlier than version 2.21.0 that need to create an `AutoScalingGroup` with an account created after December 31, 2023 must update their CDK version to 2.21.0 or later. Users on CDK versions 2.21.0 up to, but not including 2.86.0, must use a manually created `LaunchTemplate` to create an `AutoScalingGroup` for accounts created after December 31, 2023. CDK version 2.86.0 or later will automatically generate a `LaunchTemplate` using the `AutoScalingGroup` properties mentioned above.
|
||||
|
||||
For additional migration information, please see: [Migrating to a `LaunchTemplate` from a Launch Configuration](https://docs.aws.amazon.com/autoscaling/ec2/userguide/migrate-to-launch-templates.html)
|
||||
|
||||
NOTE: AutoScalingGroup has a property called `allowAllOutbound` (allowing the instances to contact the
|
||||
internet) which is set to `true` by default. Be sure to set this to `false` if you don't want
|
||||
your instances to be able to start arbitrary connections. Alternatively, you can specify an existing security
|
||||
group to attach to the instances that are launched, rather than have the group create a new one.
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
|
||||
const mySecurityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { vpc });
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO),
|
||||
machineImage: ec2.MachineImage.latestAmazonLinux2(),
|
||||
securityGroup: mySecurityGroup,
|
||||
});
|
||||
```
|
||||
|
||||
Alternatively, to enable more advanced features, you can create an `AutoScalingGroup` from a supplied `LaunchTemplate`:
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
declare const launchTemplate: ec2.LaunchTemplate;
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
launchTemplate: launchTemplate
|
||||
});
|
||||
```
|
||||
|
||||
To launch a mixture of Spot and on-demand instances, and/or with multiple instance types, you can create an `AutoScalingGroup` from a `MixedInstancesPolicy`:
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
declare const launchTemplate1: ec2.LaunchTemplate;
|
||||
declare const launchTemplate2: ec2.LaunchTemplate;
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
mixedInstancesPolicy: {
|
||||
instancesDistribution: {
|
||||
onDemandPercentageAboveBaseCapacity: 50, // Mix Spot and On-Demand instances
|
||||
},
|
||||
launchTemplate: launchTemplate1,
|
||||
launchTemplateOverrides: [ // Mix multiple instance types
|
||||
{ instanceType: new ec2.InstanceType('t3.micro') },
|
||||
{ instanceType: new ec2.InstanceType('t3a.micro') },
|
||||
{ instanceType: new ec2.InstanceType('t4g.micro'), launchTemplate: launchTemplate2 },
|
||||
],
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
You can specify instances requirements with the `instanceRequirements ` property:
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
declare const launchTemplate1: ec2.LaunchTemplate;
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
mixedInstancesPolicy: {
|
||||
launchTemplate: launchTemplate1,
|
||||
launchTemplateOverrides: [
|
||||
{
|
||||
instanceRequirements: {
|
||||
vCpuCount: { min: 4, max: 8 },
|
||||
memoryMiB: { min: 16384 },
|
||||
cpuManufacturers: ['intel'],
|
||||
},
|
||||
}
|
||||
],
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Machine Images (AMIs)
|
||||
|
||||
AMIs control the OS that gets launched when you start your EC2 instance. The EC2
|
||||
library contains constructs to select the AMI you want to use.
|
||||
|
||||
Depending on the type of AMI, you select it a different way.
|
||||
|
||||
The latest version of Amazon Linux and Microsoft Windows images are
|
||||
selectable by instantiating one of these classes:
|
||||
|
||||
[example of creating images](test/example.images.lit.ts)
|
||||
|
||||
> NOTE: The Amazon Linux images selected will be cached in your `cdk.json`, so that your
|
||||
> AutoScalingGroups don't automatically change out from under you when you're making unrelated
|
||||
> changes. To update to the latest version of Amazon Linux, remove the cache entry from the `context`
|
||||
> section of your `cdk.json`.
|
||||
>
|
||||
> We will add command-line options to make this step easier in the future.
|
||||
|
||||
## AutoScaling Instance Counts
|
||||
|
||||
AutoScalingGroups make it possible to raise and lower the number of instances in the group,
|
||||
in response to (or in advance of) changes in workload.
|
||||
|
||||
When you create your AutoScalingGroup, you specify a `minCapacity` and a
|
||||
`maxCapacity`. AutoScaling policies that respond to metrics will never go higher
|
||||
or lower than the indicated capacity (but scheduled scaling actions might, see
|
||||
below).
|
||||
|
||||
There are three ways to scale your capacity:
|
||||
|
||||
* **In response to a metric** (also known as step scaling); for example, you
|
||||
might want to scale out if the CPU usage across your cluster starts to rise,
|
||||
and scale in when it drops again.
|
||||
* **By trying to keep a certain metric around a given value** (also known as
|
||||
target tracking scaling); you might want to automatically scale out and in to
|
||||
keep your CPU usage around 50%.
|
||||
* **On a schedule**; you might want to organize your scaling around traffic
|
||||
flows you expect, by scaling out in the morning and scaling in in the
|
||||
evening.
|
||||
|
||||
The general pattern of autoscaling will look like this:
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
declare const instanceType: ec2.InstanceType;
|
||||
declare const machineImage: ec2.IMachineImage;
|
||||
|
||||
const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType,
|
||||
machineImage,
|
||||
|
||||
minCapacity: 5,
|
||||
maxCapacity: 100
|
||||
// ...
|
||||
});
|
||||
|
||||
// Then call one of the scaling methods (explained below)
|
||||
//
|
||||
// autoScalingGroup.scaleOnMetric(...);
|
||||
//
|
||||
// autoScalingGroup.scaleOnCpuUtilization(...);
|
||||
// autoScalingGroup.scaleOnIncomingBytes(...);
|
||||
// autoScalingGroup.scaleOnOutgoingBytes(...);
|
||||
// autoScalingGroup.scaleOnRequestCount(...);
|
||||
// autoScalingGroup.scaleToTrackMetric(...);
|
||||
//
|
||||
// autoScalingGroup.scaleOnSchedule(...);
|
||||
```
|
||||
|
||||
### Step Scaling
|
||||
|
||||
This type of scaling scales in and out in deterministics steps that you
|
||||
configure, in response to metric values. For example, your scaling strategy to
|
||||
scale in response to a metric that represents your average worker pool usage
|
||||
might look like this:
|
||||
|
||||
```plaintext
|
||||
Scaling -1 (no change) +1 +3
|
||||
│ │ │ │ │
|
||||
├────────┼───────────────────────┼────────┼────────┤
|
||||
│ │ │ │ │
|
||||
Worker use 0% 10% 50% 70% 100%
|
||||
```
|
||||
|
||||
(Note that this is not necessarily a recommended scaling strategy, but it's
|
||||
a possible one. You will have to determine what thresholds are right for you).
|
||||
|
||||
Note that in order to set up this scaling strategy, you will have to emit a
|
||||
metric representing your worker utilization from your instances. After that,
|
||||
you would configure the scaling something like this:
|
||||
|
||||
```ts
|
||||
declare const autoScalingGroup: autoscaling.AutoScalingGroup;
|
||||
|
||||
const workerUtilizationMetric = new cloudwatch.Metric({
|
||||
namespace: 'MyService',
|
||||
metricName: 'WorkerUtilization'
|
||||
});
|
||||
|
||||
autoScalingGroup.scaleOnMetric('ScaleToCPU', {
|
||||
metric: workerUtilizationMetric,
|
||||
scalingSteps: [
|
||||
{ upper: 10, change: -1 },
|
||||
{ lower: 50, change: +1 },
|
||||
{ lower: 70, change: +3 },
|
||||
],
|
||||
evaluationPeriods: 10,
|
||||
datapointsToAlarm: 5,
|
||||
|
||||
// Change this to AdjustmentType.PERCENT_CHANGE_IN_CAPACITY to interpret the
|
||||
// 'change' numbers before as percentages instead of capacity counts.
|
||||
adjustmentType: autoscaling.AdjustmentType.CHANGE_IN_CAPACITY,
|
||||
});
|
||||
```
|
||||
|
||||
The AutoScaling construct library will create the required CloudWatch alarms and
|
||||
AutoScaling policies for you.
|
||||
|
||||
### Target Tracking Scaling
|
||||
|
||||
This type of scaling scales in and out in order to keep a metric around a value
|
||||
you prefer. There are four types of predefined metrics you can track, or you can
|
||||
choose to track a custom metric. If you do choose to track a custom metric,
|
||||
be aware that the metric has to represent instance utilization in some way
|
||||
(AutoScaling will scale out if the metric is higher than the target, and scale
|
||||
in if the metric is lower than the target).
|
||||
|
||||
If you configure multiple target tracking policies, AutoScaling will use the
|
||||
one that yields the highest capacity.
|
||||
|
||||
The following example scales to keep the CPU usage of your instances around
|
||||
50% utilization:
|
||||
|
||||
```ts
|
||||
declare const autoScalingGroup: autoscaling.AutoScalingGroup;
|
||||
|
||||
autoScalingGroup.scaleOnCpuUtilization('KeepSpareCPU', {
|
||||
targetUtilizationPercent: 50
|
||||
});
|
||||
```
|
||||
|
||||
To scale on average network traffic in and out of your instances:
|
||||
|
||||
```ts
|
||||
declare const autoScalingGroup: autoscaling.AutoScalingGroup;
|
||||
|
||||
autoScalingGroup.scaleOnIncomingBytes('LimitIngressPerInstance', {
|
||||
targetBytesPerSecond: 10 * 1024 * 1024 // 10 MB/s
|
||||
});
|
||||
autoScalingGroup.scaleOnOutgoingBytes('LimitEgressPerInstance', {
|
||||
targetBytesPerSecond: 10 * 1024 * 1024 // 10 MB/s
|
||||
});
|
||||
```
|
||||
|
||||
To scale on the average request count per instance (only works for
|
||||
AutoScalingGroups that have been attached to Application Load
|
||||
Balancers):
|
||||
|
||||
```ts
|
||||
declare const autoScalingGroup: autoscaling.AutoScalingGroup;
|
||||
|
||||
autoScalingGroup.scaleOnRequestCount('LimitRPS', {
|
||||
targetRequestsPerSecond: 1000
|
||||
});
|
||||
```
|
||||
|
||||
### Scheduled Scaling
|
||||
|
||||
This type of scaling is used to change capacities based on time. It works by
|
||||
changing `minCapacity`, `maxCapacity` and `desiredCapacity` of the
|
||||
AutoScalingGroup, and so can be used for two purposes:
|
||||
|
||||
* Scale in and out on a schedule by setting the `minCapacity` high or
|
||||
the `maxCapacity` low.
|
||||
* Still allow the regular scaling actions to do their job, but restrict
|
||||
the range they can scale over (by setting both `minCapacity` and
|
||||
`maxCapacity` but changing their range over time).
|
||||
|
||||
A schedule is expressed as a cron expression. The `Schedule` class has a `cron` method to help build cron expressions.
|
||||
|
||||
The following example scales the fleet out in the morning, going back to natural
|
||||
scaling (all the way down to 1 instance if necessary) at night:
|
||||
|
||||
```ts
|
||||
declare const autoScalingGroup: autoscaling.AutoScalingGroup;
|
||||
|
||||
autoScalingGroup.scaleOnSchedule('PrescaleInTheMorning', {
|
||||
schedule: autoscaling.Schedule.cron({ hour: '8', minute: '0' }),
|
||||
minCapacity: 20,
|
||||
});
|
||||
|
||||
autoScalingGroup.scaleOnSchedule('AllowDownscalingAtNight', {
|
||||
schedule: autoscaling.Schedule.cron({ hour: '20', minute: '0' }),
|
||||
minCapacity: 1
|
||||
});
|
||||
```
|
||||
|
||||
### Health checks for instances
|
||||
|
||||
You can configure the health checks for the instances in the Auto Scaling group.
|
||||
|
||||
Possible health check types are EC2, EBS, ELB, and VPC_LATTICE. EC2 is the default health check and cannot be disabled.
|
||||
|
||||
If you want to configure the EC2 health check, use the `HealthChecks.ec2` method:
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO),
|
||||
machineImage: ec2.MachineImage.latestAmazonLinux2(),
|
||||
healthChecks: autoscaling.HealthChecks.ec2({
|
||||
gracePeriod: Duration.seconds(100),
|
||||
}),
|
||||
});
|
||||
```
|
||||
|
||||
If you also want to configure the additional health checks other than EC2, use the `HealthChecks.withAdditionalChecks` method.
|
||||
EC2 is implicitly included, so you can specify types other than EC2.
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO),
|
||||
machineImage: ec2.MachineImage.latestAmazonLinux2(),
|
||||
healthChecks: autoscaling.HealthChecks.withAdditionalChecks({
|
||||
gracePeriod: Duration.seconds(100),
|
||||
additionalTypes: [
|
||||
autoscaling.AdditionalHealthCheckType.EBS,
|
||||
autoscaling.AdditionalHealthCheckType.ELB,
|
||||
autoscaling.AdditionalHealthCheckType.VPC_LATTICE,
|
||||
],
|
||||
}),
|
||||
});
|
||||
```
|
||||
|
||||
> Visit [Health checks for instances in an Auto Scaling group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-health-checks.html) for more details.
|
||||
|
||||
### Instance Maintenance Policy
|
||||
|
||||
You can configure an instance maintenance policy for your Auto Scaling group to
|
||||
meet specific capacity requirements during events that cause instances to be replaced,
|
||||
such as an instance refresh or the health check process.
|
||||
|
||||
For example, suppose you have an Auto Scaling group that has a small number of instances.
|
||||
You want to avoid the potential disruptions from terminating and then replacing an instance
|
||||
when health checks indicate an impaired instance. With an instance maintenance policy, you
|
||||
can make sure that Amazon EC2 Auto Scaling first launches a new instance and then waits for
|
||||
it to be fully ready before terminating the unhealthy instance.
|
||||
|
||||
An instance maintenance policy also helps you minimize any potential disruptions in cases where
|
||||
multiple instances are replaced at the same time. You set the `minHealthyPercentage`
|
||||
and the `maxHealthyPercentage` for the policy, and your Auto Scaling group can only
|
||||
increase and decrease capacity within that minimum-maximum range when replacing instances.
|
||||
A larger range increases the number of instances that can be replaced at the same time.
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO),
|
||||
machineImage: ec2.MachineImage.latestAmazonLinux2(),
|
||||
maxHealthyPercentage: 200,
|
||||
minHealthyPercentage: 100,
|
||||
});
|
||||
```
|
||||
|
||||
> Visit [Instance maintenance policies](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-instance-maintenance-policy.html) for more details.
|
||||
|
||||
### Block Devices
|
||||
|
||||
This type specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes.
|
||||
|
||||
#### GP3 Volumes
|
||||
|
||||
You can only specify the `throughput` on GP3 volumes.
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
declare const instanceType: ec2.InstanceType;
|
||||
declare const machineImage: ec2.IMachineImage;
|
||||
|
||||
const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType,
|
||||
machineImage,
|
||||
blockDevices: [
|
||||
{
|
||||
deviceName: 'gp3-volume',
|
||||
volume: autoscaling.BlockDeviceVolume.ebs(15, {
|
||||
volumeType: autoscaling.EbsDeviceVolumeType.GP3,
|
||||
throughput: 125,
|
||||
}),
|
||||
},
|
||||
],
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
## Configuring Instances using CloudFormation Init
|
||||
|
||||
It is possible to use the CloudFormation Init mechanism to configure the
|
||||
instances in the AutoScalingGroup. You can write files to it, run commands,
|
||||
start services, etc. See the documentation of
|
||||
[AWS::CloudFormation::Init](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html)
|
||||
and the documentation of CDK's `aws-ec2` library for more information.
|
||||
|
||||
When you specify a CloudFormation Init configuration for an AutoScalingGroup:
|
||||
|
||||
* you *must* also specify `signals` to configure how long CloudFormation
|
||||
should wait for the instances to successfully configure themselves.
|
||||
* you *should* also specify an `updatePolicy` to configure how instances
|
||||
should be updated when the AutoScalingGroup is updated (for example,
|
||||
when the AMI is updated). If you don't specify an update policy, a *rolling
|
||||
update* is chosen by default.
|
||||
|
||||
Here's an example of using CloudFormation Init to write a file to the
|
||||
instance hosts on startup:
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
declare const instanceType: ec2.InstanceType;
|
||||
declare const machineImage: ec2.IMachineImage;
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType,
|
||||
machineImage,
|
||||
|
||||
// ...
|
||||
|
||||
init: ec2.CloudFormationInit.fromElements(
|
||||
ec2.InitFile.fromString('/etc/my_instance', 'This got written during instance startup'),
|
||||
),
|
||||
signals: autoscaling.Signals.waitForAll({
|
||||
timeout: Duration.minutes(10),
|
||||
}),
|
||||
});
|
||||
```
|
||||
|
||||
## Signals
|
||||
|
||||
In normal operation, CloudFormation will send a Create or Update command to
|
||||
an AutoScalingGroup and proceed with the rest of the deployment without waiting
|
||||
for the *instances in the AutoScalingGroup*.
|
||||
|
||||
Configure `signals` to tell CloudFormation to wait for a specific number of
|
||||
instances in the AutoScalingGroup to have been started (or failed to start)
|
||||
before moving on. An instance is supposed to execute the
|
||||
[`cfn-signal`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-signal.html)
|
||||
program as part of its startup to indicate whether it was started
|
||||
successfully or not.
|
||||
|
||||
If you use CloudFormation Init support (described in the previous section),
|
||||
the appropriate call to `cfn-signal` is automatically added to the
|
||||
AutoScalingGroup's UserData. If you don't use the `signals` directly, you are
|
||||
responsible for adding such a call yourself.
|
||||
|
||||
The following type of `Signals` are available:
|
||||
|
||||
* `Signals.waitForAll([options])`: wait for all of `desiredCapacity` amount of instances
|
||||
to have started (recommended).
|
||||
* `Signals.waitForMinCapacity([options])`: wait for a `minCapacity` amount of instances
|
||||
to have started (use this if waiting for all instances takes too long and you are happy
|
||||
with a minimum count of healthy hosts).
|
||||
* `Signals.waitForCount(count, [options])`: wait for a specific amount of instances to have
|
||||
started.
|
||||
|
||||
There are two `options` you can configure:
|
||||
|
||||
* `timeout`: maximum time a host startup is allowed to take. If a host does not report
|
||||
success within this time, it is considered a failure. Default is 5 minutes.
|
||||
* `minSuccessPercentage`: percentage of hosts that needs to be healthy in order for the
|
||||
update to succeed. If you set this value lower than 100, some percentage of hosts may
|
||||
report failure, while still considering the deployment a success. Default is 100%.
|
||||
|
||||
## Update Policy
|
||||
|
||||
The *update policy* describes what should happen to running instances when the definition
|
||||
of the AutoScalingGroup is changed. For example, if you add a command to the UserData
|
||||
of an AutoScalingGroup, do the existing instances get replaced with new instances that
|
||||
have executed the new UserData? Or do the "old" instances just keep on running?
|
||||
|
||||
It is recommended to always use an update policy, otherwise the current state of your
|
||||
instances also depends the previous state of your instances, rather than just on your
|
||||
source code. This degrades the reproducibility of your deployments.
|
||||
|
||||
The following update policies are available:
|
||||
|
||||
* `UpdatePolicy.none()`: leave existing instances alone (not recommended).
|
||||
* `UpdatePolicy.rollingUpdate([options])`: progressively replace the existing
|
||||
instances with new instances, in small batches. At any point in time,
|
||||
roughly the same amount of total instances will be running. If the deployment
|
||||
needs to be rolled back, the fresh instances will be replaced with the "old"
|
||||
configuration again.
|
||||
* `UpdatePolicy.replacingUpdate([options])`: build a completely fresh copy
|
||||
of the new AutoScalingGroup next to the old one. Once the AutoScalingGroup
|
||||
has been successfully created (and the instances started, if `signals` is
|
||||
configured on the AutoScalingGroup), the old AutoScalingGroup is deleted.
|
||||
If the deployment needs to be rolled back, the new AutoScalingGroup is
|
||||
deleted and the old one is left unchanged.
|
||||
|
||||
## Allowing Connections
|
||||
|
||||
See the documentation of the `aws-cdk-lib/aws-ec2` package for more information
|
||||
about allowing connections between resources backed by instances.
|
||||
|
||||
## Max Instance Lifetime
|
||||
|
||||
To enable the max instance lifetime support, specify `maxInstanceLifetime` property
|
||||
for the `AutoscalingGroup` resource. The value must be between 1 and 365 days(inclusive).
|
||||
To clear a previously set value, leave this property undefined.
|
||||
|
||||
## Instance Monitoring
|
||||
|
||||
To disable detailed instance monitoring, specify `instanceMonitoring` property
|
||||
for the `AutoscalingGroup` resource as `Monitoring.BASIC`. Otherwise detailed monitoring
|
||||
will be enabled.
|
||||
|
||||
## Monitoring Group Metrics
|
||||
|
||||
Group metrics are used to monitor group level properties; they describe the group rather than any of its instances (e.g GroupMaxSize, the group maximum size). To enable group metrics monitoring, use the `groupMetrics` property.
|
||||
All group metrics are reported in a granularity of 1 minute at no additional charge.
|
||||
|
||||
See [EC2 docs](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-monitoring.html#as-group-metrics) for a list of all available group metrics.
|
||||
|
||||
To enable group metrics monitoring using the `groupMetrics` property:
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
declare const instanceType: ec2.InstanceType;
|
||||
declare const machineImage: ec2.IMachineImage;
|
||||
|
||||
// Enable monitoring of all group metrics
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType,
|
||||
machineImage,
|
||||
|
||||
// ...
|
||||
|
||||
groupMetrics: [autoscaling.GroupMetrics.all()],
|
||||
});
|
||||
|
||||
// Enable monitoring for a subset of group metrics
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType,
|
||||
machineImage,
|
||||
|
||||
// ...
|
||||
|
||||
groupMetrics: [new autoscaling.GroupMetrics(autoscaling.GroupMetric.MIN_SIZE, autoscaling.GroupMetric.MAX_SIZE)],
|
||||
});
|
||||
```
|
||||
|
||||
## Termination policies
|
||||
|
||||
Auto Scaling uses [termination policies](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html)
|
||||
to determine which instances it terminates first during scale-in events. You
|
||||
can specify one or more termination policies with the `terminationPolicies`
|
||||
property:
|
||||
|
||||
[Custom termination policy](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lambda-custom-termination-policy.html) with lambda
|
||||
can be used to determine which instances to terminate based on custom logic.
|
||||
The custom termination policy can be specified using `TerminationPolicy.CUSTOM_LAMBDA_FUNCTION`. If this is
|
||||
specified, you must also supply a value of lambda arn in the `terminationPolicyCustomLambdaFunctionArn` property and
|
||||
attach necessary [permission](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lambda-custom-termination-policy.html#lambda-custom-termination-policy-create-function)
|
||||
to invoke the lambda function.
|
||||
|
||||
If there are multiple termination policies specified,
|
||||
custom termination policy with lambda `TerminationPolicy.CUSTOM_LAMBDA_FUNCTION`
|
||||
must be specified first.
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
declare const instanceType: ec2.InstanceType;
|
||||
declare const machineImage: ec2.IMachineImage;
|
||||
declare const arn: string;
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType,
|
||||
machineImage,
|
||||
|
||||
// ...
|
||||
|
||||
terminationPolicies: [
|
||||
autoscaling.TerminationPolicy.CUSTOM_LAMBDA_FUNCTION,
|
||||
autoscaling.TerminationPolicy.OLDEST_INSTANCE,
|
||||
autoscaling.TerminationPolicy.DEFAULT,
|
||||
],
|
||||
|
||||
//terminationPolicyCustomLambdaFunctionArn property must be specified if the TerminationPolicy.CUSTOM_LAMBDA_FUNCTION is used
|
||||
terminationPolicyCustomLambdaFunctionArn: arn,
|
||||
});
|
||||
```
|
||||
|
||||
## Protecting new instances from being terminated on scale-in
|
||||
|
||||
By default, Auto Scaling can terminate an instance at any time after launch when
|
||||
scaling in an Auto Scaling Group, subject to the group's [termination
|
||||
policy](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html).
|
||||
|
||||
However, you may wish to protect newly-launched instances from being scaled in
|
||||
if they are going to run critical applications that should not be prematurely
|
||||
terminated. EC2 Capacity Providers for Amazon ECS requires this attribute be
|
||||
set to `true`.
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
declare const instanceType: ec2.InstanceType;
|
||||
declare const machineImage: ec2.IMachineImage;
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType,
|
||||
machineImage,
|
||||
|
||||
// ...
|
||||
|
||||
newInstancesProtectedFromScaleIn: true,
|
||||
});
|
||||
```
|
||||
|
||||
## Configuring Capacity Rebalancing
|
||||
|
||||
Indicates whether Capacity Rebalancing is enabled. Otherwise, Capacity Rebalancing is disabled. When you turn on Capacity Rebalancing, Amazon EC2 Auto Scaling attempts to launch a Spot Instance whenever Amazon EC2 notifies that a Spot Instance is at an elevated risk of interruption. After launching a new instance, it then terminates an old instance. For more information, see [Use Capacity Rebalancing to handle Amazon EC2 Spot Interruptions](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-capacity-rebalancing.html) in the in the Amazon EC2 Auto Scaling User Guide.
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
declare const instanceType: ec2.InstanceType;
|
||||
declare const machineImage: ec2.IMachineImage;
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType,
|
||||
machineImage,
|
||||
|
||||
// ...
|
||||
|
||||
capacityRebalance: true,
|
||||
});
|
||||
```
|
||||
|
||||
## Connecting to your instances using SSM Session Manager
|
||||
|
||||
SSM Session Manager makes it possible to connect to your instances from the
|
||||
AWS Console, without preparing SSH keys.
|
||||
|
||||
To do so, you need to:
|
||||
|
||||
* Use an image with [SSM agent](https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-agent.html) installed
|
||||
and configured. [Many images come with SSM Agent
|
||||
preinstalled](https://docs.aws.amazon.com/systems-manager/latest/userguide/ami-preinstalled-agent.html), otherwise you
|
||||
may need to manually put instructions to [install SSM
|
||||
Agent](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-manual-agent-install.html) into your
|
||||
instance's UserData or use EC2 Init).
|
||||
* Create the AutoScalingGroup with `ssmSessionPermissions: true`.
|
||||
|
||||
If these conditions are met, you can connect to the instance from the EC2 Console. Example:
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO),
|
||||
|
||||
// Amazon Linux 2 comes with SSM Agent by default
|
||||
machineImage: ec2.MachineImage.latestAmazonLinux2(),
|
||||
|
||||
// Turn on SSM
|
||||
ssmSessionPermissions: true,
|
||||
});
|
||||
```
|
||||
|
||||
## Configuring Instance Metadata Service (IMDS)
|
||||
|
||||
### Toggling IMDSv1
|
||||
|
||||
You can configure [EC2 Instance Metadata Service](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) options to either
|
||||
allow both IMDSv1 and IMDSv2 or enforce IMDSv2 when interacting with the IMDS.
|
||||
|
||||
To do this for a single `AutoScalingGroup`, you can use set the `requireImdsv2` property.
|
||||
The example below demonstrates IMDSv2 being required on a single `AutoScalingGroup`:
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
declare const instanceType: ec2.InstanceType;
|
||||
declare const machineImage: ec2.IMachineImage;
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType,
|
||||
machineImage,
|
||||
|
||||
// ...
|
||||
|
||||
requireImdsv2: true,
|
||||
});
|
||||
```
|
||||
|
||||
You can also use `AutoScalingGroupRequireImdsv2Aspect` to apply the operation to multiple AutoScalingGroups.
|
||||
The example below demonstrates the `AutoScalingGroupRequireImdsv2Aspect` being used to require IMDSv2 for all AutoScalingGroups in a stack:
|
||||
|
||||
```ts
|
||||
const aspect = new autoscaling.AutoScalingGroupRequireImdsv2Aspect();
|
||||
|
||||
Aspects.of(this).add(aspect);
|
||||
```
|
||||
|
||||
## Warm Pool
|
||||
|
||||
Auto Scaling offers [a warm pool](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-warm-pools.html) which gives an ability to decrease latency for applications that have exceptionally long boot times. You can create a warm pool with default parameters as below:
|
||||
|
||||
```ts
|
||||
declare const autoScalingGroup: autoscaling.AutoScalingGroup;
|
||||
|
||||
autoScalingGroup.addWarmPool();
|
||||
```
|
||||
|
||||
You can also customize a warm pool by configuring parameters:
|
||||
|
||||
```ts
|
||||
declare const autoScalingGroup: autoscaling.AutoScalingGroup;
|
||||
|
||||
autoScalingGroup.addWarmPool({
|
||||
minSize: 1,
|
||||
reuseOnScaleIn: true,
|
||||
});
|
||||
```
|
||||
|
||||
### 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 vpc: ec2.Vpc;
|
||||
declare const instanceType: ec2.InstanceType;
|
||||
declare const machineImage: ec2.IMachineImage;
|
||||
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType,
|
||||
machineImage,
|
||||
|
||||
// ...
|
||||
|
||||
defaultInstanceWarmup: Duration.seconds(5),
|
||||
});
|
||||
```
|
||||
|
||||
## Configuring KeyPair for instances
|
||||
|
||||
You can use a keyPair to build your asg when you decide not to use a ready-made LanchTemplate.
|
||||
|
||||
To configure KeyPair for an autoscaling group, pass the `keyPair` as a prop:
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
declare const instanceType: ec2.InstanceType;
|
||||
declare const machineImage: ec2.IMachineImage;
|
||||
|
||||
const myKeyPair = new ec2.KeyPair(this, 'MyKeyPair');
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType,
|
||||
machineImage,
|
||||
|
||||
// ...
|
||||
|
||||
keyPair: myKeyPair,
|
||||
});
|
||||
```
|
||||
|
||||
## Capacity Distribution Strategy
|
||||
|
||||
If launches fail in an Availability Zone, the following strategies are available.
|
||||
|
||||
* `BALANCED_BEST_EFFORT` (default) - If launches fail in an Availability Zone, Auto Scaling will attempt to launch in another healthy Availability Zone instead.
|
||||
* `BALANCED_ONLY` - If launches fail in an Availability Zone, Auto Scaling will continue to attempt to launch in the unhealthy zone to preserve a balanced distribution.
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
declare const instanceType: ec2.InstanceType;
|
||||
declare const machineImage: ec2.IMachineImage;
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType,
|
||||
machineImage,
|
||||
|
||||
// ...
|
||||
|
||||
azCapacityDistributionStrategy: autoscaling.CapacityDistributionStrategy.BALANCED_ONLY,
|
||||
});
|
||||
```
|
||||
|
||||
## Deletion Protection
|
||||
|
||||
You can enable deletion protection to prevent your Auto Scaling group from being accidentally deleted. Deletion protection blocks the DeleteAutoScalingGroup API operation, requiring you to first update the deletion protection setting before you can delete the Auto Scaling group.
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
|
||||
new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO),
|
||||
machineImage: ec2.MachineImage.latestAmazonLinux2(),
|
||||
deletionProtection: autoscaling.DeletionProtection.PREVENT_ALL_DELETION,
|
||||
});
|
||||
```
|
||||
|
||||
The following deletion protection levels are available:
|
||||
|
||||
* `DeletionProtection.NONE` (default) - No deletion protection. The Auto Scaling group can be deleted with or without the force delete option.
|
||||
* `DeletionProtection.PREVENT_FORCE_DELETION` - Prevents force deletion operations. This allows deletion of empty Auto Scaling groups but blocks force deletion that would terminate all instances.
|
||||
* `DeletionProtection.PREVENT_ALL_DELETION` - Prevents all deletion operations. This provides the strongest protection and requires explicitly disabling deletion protection before the Auto Scaling group can be deleted.
|
||||
|
||||
**Note:** When using `PREVENT_ALL_DELETION`, you must first update the deletion protection setting before deleting the CloudFormation stack containing the Auto Scaling group.
|
||||
|
||||
## Instance Lifecycle Policy
|
||||
|
||||
You can configure an instance lifecycle policy to control how instances are handled during lifecycle events, particularly when lifecycle hooks are abandoned or fail. This allows fine-grained control over when to preserve instances for manual intervention.
|
||||
|
||||
The instance lifecycle policy defines retention triggers that specify when instances should be moved to a Retained state rather than terminated. Retained instances don't count toward desired capacity and remain until you manually terminate them.
|
||||
|
||||
**Important:** To use instance lifecycle policies in your Auto Scaling group, you must also configure a termination lifecycle hook. If you configure an instance lifecycle policy but don't have any termination lifecycle hooks, the policy has no effect. Instance lifecycle policies will only apply when termination lifecycle actions are abandoned, not when they complete successfully with the CONTINUE result.
|
||||
|
||||
```ts
|
||||
declare const vpc: ec2.Vpc;
|
||||
declare const instanceType: ec2.InstanceType;
|
||||
declare const machineImage: ec2.IMachineImage;
|
||||
|
||||
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
|
||||
vpc,
|
||||
instanceType,
|
||||
machineImage,
|
||||
|
||||
// Configure instance lifecycle policy
|
||||
instanceLifecyclePolicy: {
|
||||
retentionTriggers: {
|
||||
terminateHookAbandon: autoscaling.TerminateHookAbandonAction.RETAIN,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Add termination lifecycle hook (required for the policy to take effect)
|
||||
asg.addLifecycleHook('TerminationHook', {
|
||||
lifecycleTransition: autoscaling.LifecycleTransition.INSTANCE_TERMINATING,
|
||||
});
|
||||
```
|
||||
|
||||
The `terminateHookAbandon` trigger specifies the action when a termination lifecycle hook is abandoned due to failure, timeout, or explicit abandonment. You can set it to:
|
||||
|
||||
* `RETAIN` - Move instances to a Retained state for manual investigation
|
||||
* `TERMINATE` - Use default termination behavior (instances are terminated normally)
|
||||
|
||||
This feature is particularly useful for debugging failed instances or preserving instances that contain important data during lifecycle hook failures.
|
||||
|
||||
## Future work
|
||||
|
||||
* [ ] CloudWatch Events (impossible to add currently as the AutoScalingGroup ARN is
|
||||
necessary to make this rule and this cannot be accessed from CloudFormation).
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/index.d.ts
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './lib';
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/index.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/aspects/index.d.ts
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/aspects/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './require-imdsv2-aspect';
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/aspects/index.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/aspects/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__exportStar=exports&&exports.__exportStar||function(m,exports2){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(exports2,p)&&__createBinding(exports2,m,p)};Object.defineProperty(exports,"__esModule",{value:!0});var _noFold;exports.AutoScalingGroupRequireImdsv2Aspect=void 0,Object.defineProperty(exports,_noFold="AutoScalingGroupRequireImdsv2Aspect",{enumerable:!0,configurable:!0,get:()=>{var value=require("./require-imdsv2-aspect").AutoScalingGroupRequireImdsv2Aspect;return Object.defineProperty(exports,_noFold="AutoScalingGroupRequireImdsv2Aspect",{enumerable:!0,configurable:!0,value}),value}});
|
||||
16
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/aspects/require-imdsv2-aspect.d.ts
generated
vendored
Normal file
16
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/aspects/require-imdsv2-aspect.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { IConstruct } from 'constructs';
|
||||
import * as cdk from '../../../core';
|
||||
/**
|
||||
* Aspect that makes IMDSv2 required on instances deployed by AutoScalingGroups.
|
||||
*/
|
||||
export declare class AutoScalingGroupRequireImdsv2Aspect implements cdk.IAspect {
|
||||
constructor();
|
||||
visit(node: IConstruct): void;
|
||||
/**
|
||||
* Adds a warning annotation to a node.
|
||||
*
|
||||
* @param node The scope to add the warning to.
|
||||
* @param message The warning message.
|
||||
*/
|
||||
protected warn(node: IConstruct, message: string): void;
|
||||
}
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/aspects/require-imdsv2-aspect.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/aspects/require-imdsv2-aspect.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AutoScalingGroupRequireImdsv2Aspect=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var cdk=()=>{var tmp=require("../../../core");return cdk=()=>tmp,tmp},cx_api_1=()=>{var tmp=require("../../../cx-api");return cx_api_1=()=>tmp,tmp},auto_scaling_group_1=()=>{var tmp=require("../auto-scaling-group");return auto_scaling_group_1=()=>tmp,tmp};class AutoScalingGroupRequireImdsv2Aspect{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_autoscaling.AutoScalingGroupRequireImdsv2Aspect",version:"2.252.0"};constructor(){}visit(node){if(node instanceof auto_scaling_group_1().AutoScalingGroup)if(cdk().FeatureFlags.of(node).isEnabled(cx_api_1().AUTOSCALING_GENERATE_LAUNCH_TEMPLATE)){const cfnLaunchTemplate=node.node.tryFindChild("LaunchTemplate").node.tryFindChild("Resource"),data=cfnLaunchTemplate.launchTemplateData;if(cdk().isResolvableObject(data)){this.warn(node,"CfnLaunchTemplate.LaunchTemplateData field is a CDK token.");return}const metadataOptions=data.metadataOptions;if(cdk().isResolvableObject(metadataOptions)){this.warn(node,"CfnLaunchTemplate.LaunchTemplateData.MetadataOptions field is a CDK token.");return}const newData={...data,metadataOptions:{...metadataOptions,httpTokens:"required"}};cfnLaunchTemplate.launchTemplateData=newData}else{const launchConfig=node.node.tryFindChild("LaunchConfig");if(cdk().isResolvableObject(launchConfig.metadataOptions)){this.warn(node,"CfnLaunchConfiguration.MetadataOptions field is a CDK token.");return}launchConfig.metadataOptions={...launchConfig.metadataOptions,httpTokens:"required"}}}warn(node,message){cdk().Annotations.of(node).addWarningV2(`@aws-cdk/aws-autoscaling:imdsv2${AutoScalingGroupRequireImdsv2Aspect.name}`,`${AutoScalingGroupRequireImdsv2Aspect.name} failed on node ${node.node.id}: ${message}`)}}exports.AutoScalingGroupRequireImdsv2Aspect=AutoScalingGroupRequireImdsv2Aspect;
|
||||
1531
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/auto-scaling-group.d.ts
generated
vendored
Normal file
1531
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/auto-scaling-group.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/auto-scaling-group.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/auto-scaling-group.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
48
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/autoscaling-canned-metrics.generated.d.ts
generated
vendored
Normal file
48
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/autoscaling-canned-metrics.generated.d.ts
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
export interface MetricWithDims<D> {
|
||||
readonly namespace: string;
|
||||
readonly metricName: string;
|
||||
readonly statistic: string;
|
||||
readonly dimensionsMap: D;
|
||||
}
|
||||
export declare class AutoScalingMetrics {
|
||||
static groupTotalInstancesAverage(this: void, dimensions: {
|
||||
AutoScalingGroupName: string;
|
||||
}): MetricWithDims<{
|
||||
AutoScalingGroupName: string;
|
||||
}>;
|
||||
static groupDesiredCapacityAverage(this: void, dimensions: {
|
||||
AutoScalingGroupName: string;
|
||||
}): MetricWithDims<{
|
||||
AutoScalingGroupName: string;
|
||||
}>;
|
||||
static groupMaxSizeAverage(this: void, dimensions: {
|
||||
AutoScalingGroupName: string;
|
||||
}): MetricWithDims<{
|
||||
AutoScalingGroupName: string;
|
||||
}>;
|
||||
static groupMinSizeAverage(this: void, dimensions: {
|
||||
AutoScalingGroupName: string;
|
||||
}): MetricWithDims<{
|
||||
AutoScalingGroupName: string;
|
||||
}>;
|
||||
static groupTerminatingInstancesAverage(this: void, dimensions: {
|
||||
AutoScalingGroupName: string;
|
||||
}): MetricWithDims<{
|
||||
AutoScalingGroupName: string;
|
||||
}>;
|
||||
static groupPendingInstancesAverage(this: void, dimensions: {
|
||||
AutoScalingGroupName: string;
|
||||
}): MetricWithDims<{
|
||||
AutoScalingGroupName: string;
|
||||
}>;
|
||||
static groupInServiceInstancesAverage(this: void, dimensions: {
|
||||
AutoScalingGroupName: string;
|
||||
}): MetricWithDims<{
|
||||
AutoScalingGroupName: string;
|
||||
}>;
|
||||
static groupStandbyInstancesAverage(this: void, dimensions: {
|
||||
AutoScalingGroupName: string;
|
||||
}): MetricWithDims<{
|
||||
AutoScalingGroupName: string;
|
||||
}>;
|
||||
}
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/autoscaling-canned-metrics.generated.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/autoscaling-canned-metrics.generated.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AutoScalingMetrics=void 0;class AutoScalingMetrics{static groupTotalInstancesAverage(dimensions){return{namespace:"AWS/AutoScaling",metricName:"GroupTotalInstances",dimensionsMap:dimensions,statistic:"Average"}}static groupDesiredCapacityAverage(dimensions){return{namespace:"AWS/AutoScaling",metricName:"GroupDesiredCapacity",dimensionsMap:dimensions,statistic:"Average"}}static groupMaxSizeAverage(dimensions){return{namespace:"AWS/AutoScaling",metricName:"GroupMaxSize",dimensionsMap:dimensions,statistic:"Average"}}static groupMinSizeAverage(dimensions){return{namespace:"AWS/AutoScaling",metricName:"GroupMinSize",dimensionsMap:dimensions,statistic:"Average"}}static groupTerminatingInstancesAverage(dimensions){return{namespace:"AWS/AutoScaling",metricName:"GroupTerminatingInstances",dimensionsMap:dimensions,statistic:"Average"}}static groupPendingInstancesAverage(dimensions){return{namespace:"AWS/AutoScaling",metricName:"GroupPendingInstances",dimensionsMap:dimensions,statistic:"Average"}}static groupInServiceInstancesAverage(dimensions){return{namespace:"AWS/AutoScaling",metricName:"GroupInServiceInstances",dimensionsMap:dimensions,statistic:"Average"}}static groupStandbyInstancesAverage(dimensions){return{namespace:"AWS/AutoScaling",metricName:"GroupStandbyInstances",dimensionsMap:dimensions,statistic:"Average"}}}exports.AutoScalingMetrics=AutoScalingMetrics;
|
||||
4406
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/autoscaling.generated.d.ts
generated
vendored
Normal file
4406
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/autoscaling.generated.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/autoscaling.generated.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/autoscaling.generated.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
13
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/index.d.ts
generated
vendored
Normal file
13
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
export * from './aspects';
|
||||
export * from './auto-scaling-group';
|
||||
export * from './schedule';
|
||||
export * from './lifecycle-hook';
|
||||
export * from './lifecycle-hook-target';
|
||||
export * from './scheduled-action';
|
||||
export * from './step-scaling-action';
|
||||
export * from './step-scaling-policy';
|
||||
export * from './target-tracking-scaling-policy';
|
||||
export * from './termination-policy';
|
||||
export * from './volume';
|
||||
export * from './warm-pool';
|
||||
export * from './autoscaling.generated';
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/index.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
43
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/lifecycle-hook-target.d.ts
generated
vendored
Normal file
43
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/lifecycle-hook-target.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import type * as constructs from 'constructs';
|
||||
import type { LifecycleHook } from './lifecycle-hook';
|
||||
import type * as iam from '../../aws-iam';
|
||||
/**
|
||||
* Options needed to bind a target to a lifecycle hook.
|
||||
* [disable-awslint:ref-via-interface] The lifecycle hook to attach to and an IRole to use
|
||||
*/
|
||||
export interface BindHookTargetOptions {
|
||||
/**
|
||||
* The lifecycle hook to attach to.
|
||||
* [disable-awslint:ref-via-interface]
|
||||
*/
|
||||
readonly lifecycleHook: LifecycleHook;
|
||||
/**
|
||||
* The role to use when attaching to the lifecycle hook.
|
||||
* [disable-awslint:ref-via-interface]
|
||||
* @default: a role is not created unless the target arn is specified
|
||||
*/
|
||||
readonly role?: iam.IRole;
|
||||
}
|
||||
/**
|
||||
* Result of binding a lifecycle hook to a target.
|
||||
*/
|
||||
export interface LifecycleHookTargetConfig {
|
||||
/**
|
||||
* The IRole that was used to bind the lifecycle hook to the target
|
||||
*/
|
||||
readonly createdRole: iam.IRole;
|
||||
/**
|
||||
* The targetArn that the lifecycle hook was bound to
|
||||
*/
|
||||
readonly notificationTargetArn: string;
|
||||
}
|
||||
/**
|
||||
* Interface for autoscaling lifecycle hook targets
|
||||
*/
|
||||
export interface ILifecycleHookTarget {
|
||||
/**
|
||||
* Called when this object is used as the target of a lifecycle hook
|
||||
* @param options [disable-awslint:ref-via-interface] The lifecycle hook to attach to and a role to use
|
||||
*/
|
||||
bind(scope: constructs.Construct, options: BindHookTargetOptions): LifecycleHookTargetConfig;
|
||||
}
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/lifecycle-hook-target.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/lifecycle-hook-target.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
||||
114
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/lifecycle-hook.d.ts
generated
vendored
Normal file
114
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/lifecycle-hook.d.ts
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
import type { Construct } from 'constructs';
|
||||
import type { ILifecycleHookTarget } from './lifecycle-hook-target';
|
||||
import type * as iam from '../../aws-iam';
|
||||
import type { Duration, IResource } from '../../core';
|
||||
import { Resource } from '../../core';
|
||||
import type { IAutoScalingGroupRef, ILifecycleHookRef, LifecycleHookReference } from '../../interfaces/generated/aws-autoscaling-interfaces.generated';
|
||||
/**
|
||||
* Basic properties for a lifecycle hook
|
||||
*/
|
||||
export interface BasicLifecycleHookProps {
|
||||
/**
|
||||
* Name of the lifecycle hook
|
||||
*
|
||||
* @default - Automatically generated name.
|
||||
*/
|
||||
readonly lifecycleHookName?: string;
|
||||
/**
|
||||
* The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.
|
||||
*
|
||||
* @default Continue
|
||||
*/
|
||||
readonly defaultResult?: DefaultResult;
|
||||
/**
|
||||
* Maximum time between calls to RecordLifecycleActionHeartbeat for the hook
|
||||
*
|
||||
* If the lifecycle hook times out, perform the action in DefaultResult.
|
||||
*
|
||||
* @default - No heartbeat timeout.
|
||||
*/
|
||||
readonly heartbeatTimeout?: Duration;
|
||||
/**
|
||||
* The state of the Amazon EC2 instance to which you want to attach the lifecycle hook.
|
||||
*/
|
||||
readonly lifecycleTransition: LifecycleTransition;
|
||||
/**
|
||||
* Additional data to pass to the lifecycle hook target
|
||||
*
|
||||
* @default - No metadata.
|
||||
*/
|
||||
readonly notificationMetadata?: string;
|
||||
/**
|
||||
* The target of the lifecycle hook
|
||||
*
|
||||
* @default - No target.
|
||||
*/
|
||||
readonly notificationTarget?: ILifecycleHookTarget;
|
||||
/**
|
||||
* The role that allows publishing to the notification target
|
||||
*
|
||||
* @default - A role will be created if a target is provided. Otherwise, no role is created.
|
||||
*/
|
||||
readonly role?: iam.IRole;
|
||||
}
|
||||
/**
|
||||
* Properties for a Lifecycle hook
|
||||
*/
|
||||
export interface LifecycleHookProps extends BasicLifecycleHookProps {
|
||||
/**
|
||||
* The AutoScalingGroup to add the lifecycle hook to
|
||||
*/
|
||||
readonly autoScalingGroup: IAutoScalingGroupRef;
|
||||
}
|
||||
/**
|
||||
* A basic lifecycle hook object
|
||||
*/
|
||||
export interface ILifecycleHook extends ILifecycleHookRef, IResource {
|
||||
/**
|
||||
* The role for the lifecycle hook to execute
|
||||
*
|
||||
* @default - A default role is created if 'notificationTarget' is specified.
|
||||
* Otherwise, no role is created.
|
||||
*/
|
||||
readonly role: iam.IRole;
|
||||
}
|
||||
/**
|
||||
* Define a life cycle hook
|
||||
*/
|
||||
export declare class LifecycleHook extends Resource implements ILifecycleHook {
|
||||
/** Uniquely identifies this class. */
|
||||
static readonly PROPERTY_INJECTION_ID: string;
|
||||
private _role?;
|
||||
private readonly _autoScalingGroupName;
|
||||
/**
|
||||
* The role that allows the ASG to publish to the notification target
|
||||
*
|
||||
* @default - A default role is created if 'notificationTarget' is specified.
|
||||
* Otherwise, no role is created.
|
||||
*/
|
||||
get role(): iam.IRole;
|
||||
/**
|
||||
* The name of this lifecycle hook
|
||||
* @attribute
|
||||
*/
|
||||
readonly lifecycleHookName: string;
|
||||
get lifecycleHookRef(): LifecycleHookReference;
|
||||
constructor(scope: Construct, id: string, props: LifecycleHookProps);
|
||||
}
|
||||
export declare enum DefaultResult {
|
||||
CONTINUE = "CONTINUE",
|
||||
ABANDON = "ABANDON"
|
||||
}
|
||||
/**
|
||||
* What instance transition to attach the hook to
|
||||
*/
|
||||
export declare enum LifecycleTransition {
|
||||
/**
|
||||
* Execute the hook when an instance is about to be added
|
||||
*/
|
||||
INSTANCE_LAUNCHING = "autoscaling:EC2_INSTANCE_LAUNCHING",
|
||||
/**
|
||||
* Execute the hook when an instance is about to be terminated
|
||||
*/
|
||||
INSTANCE_TERMINATING = "autoscaling:EC2_INSTANCE_TERMINATING"
|
||||
}
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/lifecycle-hook.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/lifecycle-hook.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
67
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/schedule.d.ts
generated
vendored
Normal file
67
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/schedule.d.ts
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
import type { Construct } from 'constructs';
|
||||
/**
|
||||
* Schedule for scheduled scaling actions
|
||||
*/
|
||||
export declare abstract class Schedule {
|
||||
/**
|
||||
* Construct a schedule from a literal schedule expression
|
||||
*
|
||||
* @param expression The expression to use. Must be in a format that AutoScaling will recognize
|
||||
* @see http://crontab.org/
|
||||
*/
|
||||
static expression(expression: string): Schedule;
|
||||
/**
|
||||
* Create a schedule from a set of cron fields
|
||||
*/
|
||||
static cron(options: CronOptions): Schedule;
|
||||
/**
|
||||
* Retrieve the expression for this schedule
|
||||
*/
|
||||
abstract readonly expressionString: string;
|
||||
protected constructor();
|
||||
/**
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
abstract _bind(scope: Construct): void;
|
||||
}
|
||||
/**
|
||||
* Options to configure a cron expression
|
||||
*
|
||||
* All fields are strings so you can use complex expressions. Absence of
|
||||
* a field implies '*' or '?', whichever one is appropriate.
|
||||
*
|
||||
* @see http://crontab.org/
|
||||
*/
|
||||
export interface CronOptions {
|
||||
/**
|
||||
* The minute to run this rule at
|
||||
*
|
||||
* @default - Every minute
|
||||
*/
|
||||
readonly minute?: string;
|
||||
/**
|
||||
* The hour to run this rule at
|
||||
*
|
||||
* @default - Every hour
|
||||
*/
|
||||
readonly hour?: string;
|
||||
/**
|
||||
* The day of the month to run this rule at
|
||||
*
|
||||
* @default - Every day of the month
|
||||
*/
|
||||
readonly day?: string;
|
||||
/**
|
||||
* The month to run this rule at
|
||||
*
|
||||
* @default - Every month
|
||||
*/
|
||||
readonly month?: string;
|
||||
/**
|
||||
* The day of the week to run this rule at
|
||||
*
|
||||
* @default - Any day of the week
|
||||
*/
|
||||
readonly weekDay?: string;
|
||||
}
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/schedule.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/schedule.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Schedule=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class Schedule{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_autoscaling.Schedule",version:"2.252.0"};static expression(expression){return new LiteralSchedule(expression)}static cron(options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_autoscaling_CronOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.cron),error}if(options.weekDay!==void 0&&options.day!==void 0)throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`CannotSupplyBothDayAndWeekDay`,"Cannot supply both 'day' and 'weekDay', use at most one");const minute=fallback(options.minute,"*"),hour=fallback(options.hour,"*"),month=fallback(options.month,"*"),day=fallback(options.day,"*"),weekDay=fallback(options.weekDay,"*");return new class extends Schedule{expressionString=`${minute} ${hour} ${day} ${month} ${weekDay}`;_bind(scope){return options.minute||core_1().Annotations.of(scope).addWarningV2("@aws-cdk/aws-autoscaling:scheduleDefaultRunsEveryMinute","cron: If you don't pass 'minute', by default the event runs every minute. Pass 'minute: '*'' if that's what you intend, or 'minute: 0' to run once per hour instead."),new LiteralSchedule(this.expressionString)}}}constructor(){}}exports.Schedule=Schedule;class LiteralSchedule extends Schedule{expressionString;constructor(expressionString){super(),this.expressionString=expressionString}_bind(){}}function fallback(x,def){return x===void 0?def:x}
|
||||
93
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/scheduled-action.d.ts
generated
vendored
Normal file
93
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/scheduled-action.d.ts
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
import type { Construct } from 'constructs';
|
||||
import type { Schedule } from './schedule';
|
||||
import { Resource } from '../../core';
|
||||
import type { IAutoScalingGroupRef } from '../../interfaces/generated/aws-autoscaling-interfaces.generated';
|
||||
/**
|
||||
* Properties for a scheduled scaling action
|
||||
*/
|
||||
export interface BasicScheduledActionProps {
|
||||
/**
|
||||
* Specifies the time zone for a cron expression. If a time zone is not provided, UTC is used by default.
|
||||
*
|
||||
* Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database (such as Etc/GMT+9 or Pacific/Tahiti).
|
||||
*
|
||||
* For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
|
||||
*
|
||||
* @default - UTC
|
||||
*
|
||||
*/
|
||||
readonly timeZone?: string;
|
||||
/**
|
||||
* When to perform this action.
|
||||
*
|
||||
* Supports cron expressions.
|
||||
*
|
||||
* For more information about cron expressions, see https://en.wikipedia.org/wiki/Cron.
|
||||
*/
|
||||
readonly schedule: Schedule;
|
||||
/**
|
||||
* When this scheduled action becomes active.
|
||||
*
|
||||
* @default - The rule is activate immediately.
|
||||
*/
|
||||
readonly startTime?: Date;
|
||||
/**
|
||||
* When this scheduled action expires.
|
||||
*
|
||||
* @default - The rule never expires.
|
||||
*/
|
||||
readonly endTime?: Date;
|
||||
/**
|
||||
* The new minimum capacity.
|
||||
*
|
||||
* At the scheduled time, set the minimum capacity to the given capacity.
|
||||
*
|
||||
* At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied.
|
||||
*
|
||||
* @default - No new minimum capacity.
|
||||
*/
|
||||
readonly minCapacity?: number;
|
||||
/**
|
||||
* The new maximum capacity.
|
||||
*
|
||||
* At the scheduled time, set the maximum capacity to the given capacity.
|
||||
*
|
||||
* At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied.
|
||||
*
|
||||
* @default - No new maximum capacity.
|
||||
*/
|
||||
readonly maxCapacity?: number;
|
||||
/**
|
||||
* The new desired capacity.
|
||||
*
|
||||
* At the scheduled time, set the desired capacity to the given capacity.
|
||||
*
|
||||
* At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied.
|
||||
*
|
||||
* @default - No new desired capacity.
|
||||
*/
|
||||
readonly desiredCapacity?: number;
|
||||
}
|
||||
/**
|
||||
* Properties for a scheduled action on an AutoScalingGroup
|
||||
*/
|
||||
export interface ScheduledActionProps extends BasicScheduledActionProps {
|
||||
/**
|
||||
* The AutoScalingGroup to apply the scheduled actions to
|
||||
*/
|
||||
readonly autoScalingGroup: IAutoScalingGroupRef;
|
||||
}
|
||||
/**
|
||||
* Define a scheduled scaling action
|
||||
*/
|
||||
export declare class ScheduledAction extends Resource {
|
||||
/** Uniquely identifies this class. */
|
||||
static readonly PROPERTY_INJECTION_ID: string;
|
||||
/**
|
||||
* The name of the scheduled action.
|
||||
*
|
||||
* @attribute
|
||||
*/
|
||||
readonly scheduledActionName: string;
|
||||
constructor(scope: Construct, id: string, props: ScheduledActionProps);
|
||||
}
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/scheduled-action.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/scheduled-action.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var __esDecorate=exports&&exports.__esDecorate||function(ctor,descriptorIn,decorators,contextIn,initializers,extraInitializers){function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Function expected");return f}for(var kind=contextIn.kind,key=kind==="getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor?contextIn.static?ctor:ctor.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor(target,contextIn.name):{}),_,done=!1,i=decorators.length-1;i>=0;i--){var context={};for(var p in contextIn)context[p]=p==="access"?{}:contextIn[p];for(var p in contextIn.access)context.access[p]=contextIn.access[p];context.addInitializer=function(f){if(done)throw new TypeError("Cannot add initializers after decoration has completed");extraInitializers.push(accept(f||null))};var result=(0,decorators[i])(kind==="accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key],context);if(kind==="accessor"){if(result===void 0)continue;if(result===null||typeof result!="object")throw new TypeError("Object expected");(_=accept(result.get))&&(descriptor.get=_),(_=accept(result.set))&&(descriptor.set=_),(_=accept(result.init))&&initializers.unshift(_)}else(_=accept(result))&&(kind==="field"?initializers.unshift(_):descriptor[key]=_)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers=exports&&exports.__runInitializers||function(thisArg,initializers,value){for(var useValue=arguments.length>2,i=0;i<initializers.length;i++)value=useValue?initializers[i].call(thisArg,value):initializers[i].call(thisArg);return useValue?value:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ScheduledAction=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var autoscaling_generated_1=()=>{var tmp=require("./autoscaling.generated");return autoscaling_generated_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},metadata_resource_1=()=>{var tmp=require("../../core/lib/metadata-resource");return metadata_resource_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp},prop_injectable_1=()=>{var tmp=require("../../core/lib/prop-injectable");return prop_injectable_1=()=>tmp,tmp};let ScheduledAction=(()=>{let _classDecorators=[prop_injectable_1().propertyInjectable],_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=core_1().Resource;var ScheduledAction2=class extends _classSuper{static{_classThis=this}static{const _metadata=typeof Symbol=="function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;__esDecorate(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),ScheduledAction2=_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata})}static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_autoscaling.ScheduledAction",version:"2.252.0"};static PROPERTY_INJECTION_ID="aws-cdk-lib.aws-autoscaling.ScheduledAction";scheduledActionName;constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_autoscaling_ScheduledActionProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,ScheduledAction2),error}if((0,metadata_resource_1().addConstructMetadata)(this,props),props.minCapacity===void 0&&props.maxCapacity===void 0&&props.desiredCapacity===void 0)throw new(core_1()).ValidationError((0,literal_string_1().lit)`LeastOneMinCapacityMax`,"At least one of minCapacity, maxCapacity, or desiredCapacity is required",this);props.schedule._bind(this);const resource=new(autoscaling_generated_1()).CfnScheduledAction(this,"Resource",{autoScalingGroupName:props.autoScalingGroup.autoScalingGroupRef.autoScalingGroupName,startTime:formatISO(props.startTime),endTime:formatISO(props.endTime),minSize:props.minCapacity,maxSize:props.maxCapacity,desiredCapacity:props.desiredCapacity,recurrence:props.schedule.expressionString,timeZone:props.timeZone});this.scheduledActionName=resource.attrScheduledActionName}static{__runInitializers(_classThis,_classExtraInitializers)}};return ScheduledAction2=_classThis})();exports.ScheduledAction=ScheduledAction;function formatISO(date){if(!date)return;return date.getUTCFullYear()+"-"+pad(date.getUTCMonth()+1)+"-"+pad(date.getUTCDate())+"T"+pad(date.getUTCHours())+":"+pad(date.getUTCMinutes())+":"+pad(date.getUTCSeconds())+"Z";function pad(num){return num<10?"0"+num:num}}
|
||||
139
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/step-scaling-action.d.ts
generated
vendored
Normal file
139
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/step-scaling-action.d.ts
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
import { Construct } from 'constructs';
|
||||
import type { Duration } from '../../core';
|
||||
import type { IAutoScalingGroupRef } from '../../interfaces/generated/aws-autoscaling-interfaces.generated';
|
||||
/**
|
||||
* Properties for a scaling policy
|
||||
*/
|
||||
export interface StepScalingActionProps {
|
||||
/**
|
||||
* The auto scaling group
|
||||
*/
|
||||
readonly autoScalingGroup: IAutoScalingGroupRef;
|
||||
/**
|
||||
* Period after a scaling completes before another scaling activity can start.
|
||||
*
|
||||
* @default The default cooldown configured on the AutoScalingGroup
|
||||
* @deprecated cooldown is not valid with step scaling action
|
||||
*/
|
||||
readonly cooldown?: Duration;
|
||||
/**
|
||||
* Estimated time until a newly launched instance can send metrics to CloudWatch.
|
||||
*
|
||||
* @default Same as the cooldown
|
||||
*/
|
||||
readonly estimatedInstanceWarmup?: Duration;
|
||||
/**
|
||||
* How the adjustment numbers are interpreted
|
||||
*
|
||||
* @default ChangeInCapacity
|
||||
*/
|
||||
readonly adjustmentType?: AdjustmentType;
|
||||
/**
|
||||
* Minimum absolute number to adjust capacity with as result of percentage scaling.
|
||||
*
|
||||
* Only when using AdjustmentType = PercentChangeInCapacity, this number controls
|
||||
* the minimum absolute effect size.
|
||||
*
|
||||
* @default No minimum scaling effect
|
||||
*/
|
||||
readonly minAdjustmentMagnitude?: number;
|
||||
/**
|
||||
* The aggregation type for the CloudWatch metrics.
|
||||
*
|
||||
* @default Average
|
||||
*/
|
||||
readonly metricAggregationType?: MetricAggregationType;
|
||||
}
|
||||
/**
|
||||
* Define a step scaling action
|
||||
*
|
||||
* This kind of scaling policy adjusts the target capacity in configurable
|
||||
* steps. The size of the step is configurable based on the metric's distance
|
||||
* to its alarm threshold.
|
||||
*
|
||||
* This Action must be used as the target of a CloudWatch alarm to take effect.
|
||||
*/
|
||||
export declare class StepScalingAction extends Construct {
|
||||
/**
|
||||
* ARN of the scaling policy
|
||||
*/
|
||||
readonly scalingPolicyArn: string;
|
||||
private readonly adjustments;
|
||||
constructor(scope: Construct, id: string, props: StepScalingActionProps);
|
||||
/**
|
||||
* Add an adjustment interval to the ScalingAction
|
||||
*/
|
||||
addAdjustment(adjustment: AdjustmentTier): void;
|
||||
}
|
||||
/**
|
||||
* How adjustment numbers are interpreted
|
||||
*/
|
||||
export declare enum AdjustmentType {
|
||||
/**
|
||||
* Add the adjustment number to the current capacity.
|
||||
*
|
||||
* A positive number increases capacity, a negative number decreases capacity.
|
||||
*/
|
||||
CHANGE_IN_CAPACITY = "ChangeInCapacity",
|
||||
/**
|
||||
* Add this percentage of the current capacity to itself.
|
||||
*
|
||||
* The number must be between -100 and 100; a positive number increases
|
||||
* capacity and a negative number decreases it.
|
||||
*/
|
||||
PERCENT_CHANGE_IN_CAPACITY = "PercentChangeInCapacity",
|
||||
/**
|
||||
* Make the capacity equal to the exact number given.
|
||||
*/
|
||||
EXACT_CAPACITY = "ExactCapacity"
|
||||
}
|
||||
/**
|
||||
* How the scaling metric is going to be aggregated
|
||||
*/
|
||||
export declare enum MetricAggregationType {
|
||||
/**
|
||||
* Average
|
||||
*/
|
||||
AVERAGE = "Average",
|
||||
/**
|
||||
* Minimum
|
||||
*/
|
||||
MINIMUM = "Minimum",
|
||||
/**
|
||||
* Maximum
|
||||
*/
|
||||
MAXIMUM = "Maximum"
|
||||
}
|
||||
/**
|
||||
* An adjustment
|
||||
*/
|
||||
export interface AdjustmentTier {
|
||||
/**
|
||||
* What number to adjust the capacity with
|
||||
*
|
||||
* The number is interpreted as an added capacity, a new fixed capacity or an
|
||||
* added percentage depending on the AdjustmentType value of the
|
||||
* StepScalingPolicy.
|
||||
*
|
||||
* Can be positive or negative.
|
||||
*/
|
||||
readonly adjustment: number;
|
||||
/**
|
||||
* Lower bound where this scaling tier applies.
|
||||
*
|
||||
* The scaling tier applies if the difference between the metric
|
||||
* value and its alarm threshold is higher than this value.
|
||||
*
|
||||
* @default -Infinity if this is the first tier, otherwise the upperBound of the previous tier
|
||||
*/
|
||||
readonly lowerBound?: number;
|
||||
/**
|
||||
* Upper bound where this scaling tier applies
|
||||
*
|
||||
* The scaling tier applies if the difference between the metric
|
||||
* value and its alarm threshold is lower than this value.
|
||||
*
|
||||
* @default +Infinity
|
||||
*/
|
||||
readonly upperBound?: number;
|
||||
}
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/step-scaling-action.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/step-scaling-action.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
133
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/step-scaling-policy.d.ts
generated
vendored
Normal file
133
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/step-scaling-policy.d.ts
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
import { Construct } from 'constructs';
|
||||
import { AdjustmentType, MetricAggregationType, StepScalingAction } from './step-scaling-action';
|
||||
import * as cloudwatch from '../../aws-cloudwatch';
|
||||
import type { Duration } from '../../core';
|
||||
import type { IAutoScalingGroupRef } from '../../interfaces/generated/aws-autoscaling-interfaces.generated';
|
||||
export interface BasicStepScalingPolicyProps {
|
||||
/**
|
||||
* Metric to scale on.
|
||||
*/
|
||||
readonly metric: cloudwatch.IMetric;
|
||||
/**
|
||||
* The intervals for scaling.
|
||||
*
|
||||
* Maps a range of metric values to a particular scaling behavior.
|
||||
*
|
||||
* Must be between 2 and 40 steps.
|
||||
*/
|
||||
readonly scalingSteps: ScalingInterval[];
|
||||
/**
|
||||
* How the adjustment numbers inside 'intervals' are interpreted.
|
||||
*
|
||||
* @default ChangeInCapacity
|
||||
*/
|
||||
readonly adjustmentType?: AdjustmentType;
|
||||
/**
|
||||
* Grace period after scaling activity.
|
||||
*
|
||||
* @default Default cooldown period on your AutoScalingGroup
|
||||
*/
|
||||
readonly cooldown?: Duration;
|
||||
/**
|
||||
* Estimated time until a newly launched instance can send metrics to CloudWatch.
|
||||
*
|
||||
* @default Same as the cooldown
|
||||
*/
|
||||
readonly estimatedInstanceWarmup?: Duration;
|
||||
/**
|
||||
* Minimum absolute number to adjust capacity with as result of percentage scaling.
|
||||
*
|
||||
* Only when using AdjustmentType = PercentChangeInCapacity, this number controls
|
||||
* the minimum absolute effect size.
|
||||
*
|
||||
* @default No minimum scaling effect
|
||||
*/
|
||||
readonly minAdjustmentMagnitude?: number;
|
||||
/**
|
||||
* How many evaluation periods of the metric to wait before triggering a scaling action
|
||||
*
|
||||
* Raising this value can be used to smooth out the metric, at the expense
|
||||
* of slower response times.
|
||||
*
|
||||
* If `datapointsToAlarm` is not set, then all data points in the evaluation period
|
||||
* must meet the criteria to trigger a scaling action.
|
||||
*
|
||||
* @default 1
|
||||
*/
|
||||
readonly evaluationPeriods?: number;
|
||||
/**
|
||||
* The number of data points out of the evaluation periods that must be breaching to
|
||||
* trigger a scaling action
|
||||
*
|
||||
* Creates an "M out of N" alarm, where this property is the M and the value set for
|
||||
* `evaluationPeriods` is the N value.
|
||||
*
|
||||
* Only has meaning if `evaluationPeriods != 1`. Must be less than or equal to
|
||||
* `evaluationPeriods`.
|
||||
*
|
||||
* @default - Same as `evaluationPeriods`
|
||||
*/
|
||||
readonly datapointsToAlarm?: number;
|
||||
/**
|
||||
* Aggregation to apply to all data points over the evaluation periods
|
||||
*
|
||||
* Only has meaning if `evaluationPeriods != 1`.
|
||||
*
|
||||
* @default - The statistic from the metric if applicable (MIN, MAX, AVERAGE), otherwise AVERAGE.
|
||||
*/
|
||||
readonly metricAggregationType?: MetricAggregationType;
|
||||
}
|
||||
export interface StepScalingPolicyProps extends BasicStepScalingPolicyProps {
|
||||
/**
|
||||
* The auto scaling group
|
||||
*/
|
||||
readonly autoScalingGroup: IAutoScalingGroupRef;
|
||||
}
|
||||
/**
|
||||
* Define a acaling strategy which scales depending on absolute values of some metric.
|
||||
*
|
||||
* You can specify the scaling behavior for various values of the metric.
|
||||
*
|
||||
* Implemented using one or more CloudWatch alarms and Step Scaling Policies.
|
||||
*/
|
||||
export declare class StepScalingPolicy extends Construct {
|
||||
readonly lowerAlarm?: cloudwatch.Alarm;
|
||||
readonly lowerAction?: StepScalingAction;
|
||||
readonly upperAlarm?: cloudwatch.Alarm;
|
||||
readonly upperAction?: StepScalingAction;
|
||||
constructor(scope: Construct, id: string, props: StepScalingPolicyProps);
|
||||
}
|
||||
/**
|
||||
* A range of metric values in which to apply a certain scaling operation
|
||||
*/
|
||||
export interface ScalingInterval {
|
||||
/**
|
||||
* The lower bound of the interval.
|
||||
*
|
||||
* The scaling adjustment will be applied if the metric is higher than this value.
|
||||
*
|
||||
* @default Threshold automatically derived from neighbouring intervals
|
||||
*/
|
||||
readonly lower?: number;
|
||||
/**
|
||||
* The upper bound of the interval.
|
||||
*
|
||||
* The scaling adjustment will be applied if the metric is lower than this value.
|
||||
*
|
||||
* @default Threshold automatically derived from neighbouring intervals
|
||||
*/
|
||||
readonly upper?: number;
|
||||
/**
|
||||
* The capacity adjustment to apply in this interval
|
||||
*
|
||||
* The number is interpreted differently based on AdjustmentType:
|
||||
*
|
||||
* - ChangeInCapacity: add the adjustment to the current capacity.
|
||||
* The number can be positive or negative.
|
||||
* - PercentChangeInCapacity: add or remove the given percentage of the current
|
||||
* capacity to itself. The number can be in the range [-100..100].
|
||||
* - ExactCapacity: set the capacity to this number. The number must
|
||||
* be positive.
|
||||
*/
|
||||
readonly change: number;
|
||||
}
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/step-scaling-policy.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/step-scaling-policy.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
121
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/target-tracking-scaling-policy.d.ts
generated
vendored
Normal file
121
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/target-tracking-scaling-policy.d.ts
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
import { Construct } from 'constructs';
|
||||
import type * as cloudwatch from '../../aws-cloudwatch';
|
||||
import type { Duration } from '../../core';
|
||||
import type { IAutoScalingGroupRef } from '../../interfaces/generated/aws-autoscaling-interfaces.generated';
|
||||
/**
|
||||
* Base interface for target tracking props
|
||||
*
|
||||
* Contains the attributes that are common to target tracking policies,
|
||||
* except the ones relating to the metric and to the scalable target.
|
||||
*
|
||||
* This interface is reused by more specific target tracking props objects.
|
||||
*/
|
||||
export interface BaseTargetTrackingProps {
|
||||
/**
|
||||
* Indicates whether scale in by the target tracking policy is disabled.
|
||||
*
|
||||
* If the value is true, scale in is disabled and the target tracking policy
|
||||
* won't remove capacity from the autoscaling group. Otherwise, scale in is
|
||||
* enabled and the target tracking policy can remove capacity from the
|
||||
* group.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly disableScaleIn?: boolean;
|
||||
/**
|
||||
* Period after a scaling completes before another scaling activity can start.
|
||||
*
|
||||
* @default - The default cooldown configured on the AutoScalingGroup.
|
||||
*/
|
||||
readonly cooldown?: Duration;
|
||||
/**
|
||||
* Estimated time until a newly launched instance can send metrics to CloudWatch.
|
||||
*
|
||||
* @default - Same as the cooldown.
|
||||
*/
|
||||
readonly estimatedInstanceWarmup?: Duration;
|
||||
}
|
||||
/**
|
||||
* Properties for a Target Tracking policy that include the metric but exclude the target
|
||||
*/
|
||||
export interface BasicTargetTrackingScalingPolicyProps extends BaseTargetTrackingProps {
|
||||
/**
|
||||
* The target value for the metric.
|
||||
*/
|
||||
readonly targetValue: number;
|
||||
/**
|
||||
* A predefined metric for application autoscaling
|
||||
*
|
||||
* The metric must track utilization. Scaling out will happen if the metric is higher than
|
||||
* the target value, scaling in will happen in the metric is lower than the target value.
|
||||
*
|
||||
* Exactly one of customMetric or predefinedMetric must be specified.
|
||||
*
|
||||
* @default - No predefined metric.
|
||||
*/
|
||||
readonly predefinedMetric?: PredefinedMetric;
|
||||
/**
|
||||
* A custom metric for application autoscaling
|
||||
*
|
||||
* The metric must track utilization. Scaling out will happen if the metric is higher than
|
||||
* the target value, scaling in will happen in the metric is lower than the target value.
|
||||
*
|
||||
* Exactly one of customMetric or predefinedMetric must be specified.
|
||||
*
|
||||
* @default - No custom metric.
|
||||
*/
|
||||
readonly customMetric?: cloudwatch.IMetric;
|
||||
/**
|
||||
* The resource label associated with the predefined metric
|
||||
*
|
||||
* Should be supplied if the predefined metric is ALBRequestCountPerTarget, and the
|
||||
* format should be:
|
||||
*
|
||||
* app/<load-balancer-name>/<load-balancer-id>/targetgroup/<target-group-name>/<target-group-id>
|
||||
*
|
||||
* @default - No resource label.
|
||||
*/
|
||||
readonly resourceLabel?: string;
|
||||
}
|
||||
/**
|
||||
* Properties for a concrete TargetTrackingPolicy
|
||||
*
|
||||
* Adds the scalingTarget.
|
||||
*/
|
||||
export interface TargetTrackingScalingPolicyProps extends BasicTargetTrackingScalingPolicyProps {
|
||||
readonly autoScalingGroup: IAutoScalingGroupRef;
|
||||
}
|
||||
export declare class TargetTrackingScalingPolicy extends Construct {
|
||||
/**
|
||||
* ARN of the scaling policy
|
||||
*/
|
||||
readonly scalingPolicyArn: string;
|
||||
/**
|
||||
* The resource object
|
||||
*/
|
||||
private resource;
|
||||
constructor(scope: Construct, id: string, props: TargetTrackingScalingPolicyProps);
|
||||
}
|
||||
/**
|
||||
* One of the predefined autoscaling metrics
|
||||
*/
|
||||
export declare enum PredefinedMetric {
|
||||
/**
|
||||
* Average CPU utilization of the Auto Scaling group
|
||||
*/
|
||||
ASG_AVERAGE_CPU_UTILIZATION = "ASGAverageCPUUtilization",
|
||||
/**
|
||||
* Average number of bytes received on all network interfaces by the Auto Scaling group
|
||||
*/
|
||||
ASG_AVERAGE_NETWORK_IN = "ASGAverageNetworkIn",
|
||||
/**
|
||||
* Average number of bytes sent out on all network interfaces by the Auto Scaling group
|
||||
*/
|
||||
ASG_AVERAGE_NETWORK_OUT = "ASGAverageNetworkOut",
|
||||
/**
|
||||
* Number of requests completed per target in an Application Load Balancer target group
|
||||
*
|
||||
* Specify the ALB to look at in the `resourceLabel` field.
|
||||
*/
|
||||
ALB_REQUEST_COUNT_PER_TARGET = "ALBRequestCountPerTarget"
|
||||
}
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/target-tracking-scaling-policy.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/target-tracking-scaling-policy.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PredefinedMetric=exports.TargetTrackingScalingPolicy=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var constructs_1=()=>{var tmp=require("constructs");return constructs_1=()=>tmp,tmp},autoscaling_generated_1=()=>{var tmp=require("./autoscaling.generated");return autoscaling_generated_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class TargetTrackingScalingPolicy extends constructs_1().Construct{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_autoscaling.TargetTrackingScalingPolicy",version:"2.252.0"};scalingPolicyArn;resource;constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_autoscaling_TargetTrackingScalingPolicyProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,TargetTrackingScalingPolicy),error}if(props.customMetric===void 0==(props.predefinedMetric===void 0))throw new(core_1()).ValidationError((0,literal_string_1().lit)`ExactlyOneCustomMetricPredefined`,"Exactly one of 'customMetric' or 'predefinedMetric' must be specified.",this);if(props.predefinedMetric===PredefinedMetric.ALB_REQUEST_COUNT_PER_TARGET&&!props.resourceLabel)throw new(core_1()).ValidationError((0,literal_string_1().lit)`TrackingRequestCountPerTarget`,"When tracking the ALBRequestCountPerTarget metric, the ALB identifier must be supplied in resourceLabel",this);if(props.customMetric&&!props.customMetric.toMetricConfig().metricStat)throw new(core_1()).ValidationError((0,literal_string_1().lit)`DirectMetricsSupportedTargetTracking`,"Only direct metrics are supported for Target Tracking. Use Step Scaling or supply a Metric object.",this);this.resource=new(autoscaling_generated_1()).CfnScalingPolicy(this,"Resource",{policyType:"TargetTrackingScaling",autoScalingGroupName:props.autoScalingGroup.autoScalingGroupRef.autoScalingGroupName,cooldown:props.cooldown&&props.cooldown.toSeconds().toString(),estimatedInstanceWarmup:props.estimatedInstanceWarmup&&props.estimatedInstanceWarmup.toSeconds(),targetTrackingConfiguration:{customizedMetricSpecification:renderCustomMetric(props.customMetric),disableScaleIn:props.disableScaleIn,predefinedMetricSpecification:props.predefinedMetric!==void 0?{predefinedMetricType:props.predefinedMetric,resourceLabel:props.resourceLabel}:void 0,targetValue:props.targetValue}}),this.scalingPolicyArn=this.resource.ref}}exports.TargetTrackingScalingPolicy=TargetTrackingScalingPolicy;function renderCustomMetric(metric){if(!metric)return;const c=metric.toMetricConfig().metricStat;return{dimensions:c.dimensions,metricName:c.metricName,namespace:c.namespace,statistic:c.statistic,unit:c.unitFilter}}var PredefinedMetric;(function(PredefinedMetric2){PredefinedMetric2.ASG_AVERAGE_CPU_UTILIZATION="ASGAverageCPUUtilization",PredefinedMetric2.ASG_AVERAGE_NETWORK_IN="ASGAverageNetworkIn",PredefinedMetric2.ASG_AVERAGE_NETWORK_OUT="ASGAverageNetworkOut",PredefinedMetric2.ALB_REQUEST_COUNT_PER_TARGET="ALBRequestCountPerTarget"})(PredefinedMetric||(exports.PredefinedMetric=PredefinedMetric={}));
|
||||
45
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/termination-policy.d.ts
generated
vendored
Normal file
45
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/termination-policy.d.ts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Specifies the termination criteria to apply before Amazon EC2 Auto Scaling
|
||||
* chooses an instance for termination.
|
||||
*/
|
||||
export declare enum TerminationPolicy {
|
||||
/**
|
||||
* Terminate instances in the Auto Scaling group to align the remaining
|
||||
* instances to the allocation strategy for the type of instance that is
|
||||
* terminating (either a Spot Instance or an On-Demand Instance).
|
||||
*/
|
||||
ALLOCATION_STRATEGY = "AllocationStrategy",
|
||||
/**
|
||||
* Terminate instances that are closest to the next billing hour.
|
||||
*/
|
||||
CLOSEST_TO_NEXT_INSTANCE_HOUR = "ClosestToNextInstanceHour",
|
||||
/**
|
||||
* Terminate instances according to the default termination policy.
|
||||
*/
|
||||
DEFAULT = "Default",
|
||||
/**
|
||||
* Terminate the newest instance in the group.
|
||||
*/
|
||||
NEWEST_INSTANCE = "NewestInstance",
|
||||
/**
|
||||
* Terminate the oldest instance in the group.
|
||||
*/
|
||||
OLDEST_INSTANCE = "OldestInstance",
|
||||
/**
|
||||
* Terminate instances that have the oldest launch configuration.
|
||||
*/
|
||||
OLDEST_LAUNCH_CONFIGURATION = "OldestLaunchConfiguration",
|
||||
/**
|
||||
* Terminate instances that have the oldest launch template.
|
||||
*/
|
||||
OLDEST_LAUNCH_TEMPLATE = "OldestLaunchTemplate",
|
||||
/**
|
||||
* Terminate instances using custom termination policy with lambda. If this is
|
||||
* specified, you must also supply a value of lambda arn in the terminationPolicyCustomLambdaFunctionArn property.
|
||||
*
|
||||
* If there are multiple termination policies specified, the custom termination policy with lambda
|
||||
* must be specified first in the order.
|
||||
* @see https://docs.aws.amazon.com/autoscaling/ec2/userguide/lambda-custom-termination-policy.html#lambda-custom-termination-policy-limitations
|
||||
*/
|
||||
CUSTOM_LAMBDA_FUNCTION = "CustomLambdaFunction"
|
||||
}
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/termination-policy.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/termination-policy.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TerminationPolicy=void 0;var TerminationPolicy;(function(TerminationPolicy2){TerminationPolicy2.ALLOCATION_STRATEGY="AllocationStrategy",TerminationPolicy2.CLOSEST_TO_NEXT_INSTANCE_HOUR="ClosestToNextInstanceHour",TerminationPolicy2.DEFAULT="Default",TerminationPolicy2.NEWEST_INSTANCE="NewestInstance",TerminationPolicy2.OLDEST_INSTANCE="OldestInstance",TerminationPolicy2.OLDEST_LAUNCH_CONFIGURATION="OldestLaunchConfiguration",TerminationPolicy2.OLDEST_LAUNCH_TEMPLATE="OldestLaunchTemplate",TerminationPolicy2.CUSTOM_LAMBDA_FUNCTION="CustomLambdaFunction"})(TerminationPolicy||(exports.TerminationPolicy=TerminationPolicy={}));
|
||||
165
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/volume.d.ts
generated
vendored
Normal file
165
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/volume.d.ts
generated
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
/**
|
||||
* Block device
|
||||
*/
|
||||
export interface BlockDevice {
|
||||
/**
|
||||
* The device name exposed to the EC2 instance
|
||||
*
|
||||
* Supply a value like `/dev/sdh`, `xvdh`.
|
||||
*
|
||||
* @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html
|
||||
*/
|
||||
readonly deviceName: string;
|
||||
/**
|
||||
* Defines the block device volume, to be either an Amazon EBS volume or an ephemeral instance store volume
|
||||
*
|
||||
* Supply a value like `BlockDeviceVolume.ebs(15)`, `BlockDeviceVolume.ephemeral(0)`.
|
||||
*/
|
||||
readonly volume: BlockDeviceVolume;
|
||||
}
|
||||
/**
|
||||
* Base block device options for an EBS volume
|
||||
*/
|
||||
export interface EbsDeviceOptionsBase {
|
||||
/**
|
||||
* Indicates whether to delete the volume when the instance is terminated.
|
||||
*
|
||||
* @default - true for Amazon EC2 Auto Scaling, false otherwise (e.g. EBS)
|
||||
*/
|
||||
readonly deleteOnTermination?: boolean;
|
||||
/**
|
||||
* The number of I/O operations per second (IOPS) to provision for the volume.
|
||||
*
|
||||
* Must only be set for `volumeType`: `EbsDeviceVolumeType.IO1`
|
||||
*
|
||||
* The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS,
|
||||
* you need at least 100 GiB storage on the volume.
|
||||
*
|
||||
* @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
|
||||
*
|
||||
* @default - none, required for `EbsDeviceVolumeType.IO1`
|
||||
*/
|
||||
readonly iops?: number;
|
||||
/**
|
||||
* The EBS volume type
|
||||
* @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
|
||||
*
|
||||
* @default `EbsDeviceVolumeType.GP2`
|
||||
*/
|
||||
readonly volumeType?: EbsDeviceVolumeType;
|
||||
/**
|
||||
* The throughput that the volume supports, in MiB/s
|
||||
* Takes a minimum of 125 and maximum of 2000.
|
||||
* @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
|
||||
* @default - 125 MiB/s. Only valid on gp3 volumes.
|
||||
*/
|
||||
readonly throughput?: number;
|
||||
}
|
||||
/**
|
||||
* Block device options for an EBS volume
|
||||
*/
|
||||
export interface EbsDeviceOptions extends EbsDeviceOptionsBase {
|
||||
/**
|
||||
* Specifies whether the EBS volume is encrypted.
|
||||
* Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption
|
||||
*
|
||||
* @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly encrypted?: boolean;
|
||||
}
|
||||
/**
|
||||
* Block device options for an EBS volume created from a snapshot
|
||||
*/
|
||||
export interface EbsDeviceSnapshotOptions extends EbsDeviceOptionsBase {
|
||||
/**
|
||||
* The volume size, in Gibibytes (GiB)
|
||||
*
|
||||
* If you specify volumeSize, it must be equal or greater than the size of the snapshot.
|
||||
*
|
||||
* @default - The snapshot size
|
||||
*/
|
||||
readonly volumeSize?: number;
|
||||
}
|
||||
/**
|
||||
* Properties of an EBS block device
|
||||
*/
|
||||
export interface EbsDeviceProps extends EbsDeviceSnapshotOptions {
|
||||
/**
|
||||
* The snapshot ID of the volume to use
|
||||
*
|
||||
* @default - No snapshot will be used
|
||||
*/
|
||||
readonly snapshotId?: string;
|
||||
}
|
||||
/**
|
||||
* Describes a block device mapping for an EC2 instance or Auto Scaling group.
|
||||
*/
|
||||
export declare class BlockDeviceVolume {
|
||||
readonly ebsDevice?: EbsDeviceProps | undefined;
|
||||
readonly virtualName?: string | undefined;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
static _NO_DEVICE: BlockDeviceVolume;
|
||||
/**
|
||||
* Creates a new Elastic Block Storage device
|
||||
*
|
||||
* @param volumeSize The volume size, in Gibibytes (GiB)
|
||||
* @param options additional device options
|
||||
*/
|
||||
static ebs(volumeSize: number, options?: EbsDeviceOptions): BlockDeviceVolume;
|
||||
/**
|
||||
* Creates a new Elastic Block Storage device from an existing snapshot
|
||||
*
|
||||
* @param snapshotId The snapshot ID of the volume to use
|
||||
* @param options additional device options
|
||||
*/
|
||||
static ebsFromSnapshot(snapshotId: string, options?: EbsDeviceSnapshotOptions): BlockDeviceVolume;
|
||||
/**
|
||||
* Creates a virtual, ephemeral device.
|
||||
* The name will be in the form ephemeral{volumeIndex}.
|
||||
*
|
||||
* @param volumeIndex the volume index. Must be equal or greater than 0
|
||||
*/
|
||||
static ephemeral(volumeIndex: number): BlockDeviceVolume;
|
||||
/**
|
||||
* Suppresses a volume mapping
|
||||
*/
|
||||
static noDevice(): BlockDeviceVolume;
|
||||
/**
|
||||
* @param ebsDevice EBS device info
|
||||
* @param virtualName Virtual device name
|
||||
*/
|
||||
protected constructor(ebsDevice?: EbsDeviceProps | undefined, virtualName?: string | undefined);
|
||||
}
|
||||
/**
|
||||
* Supported EBS volume types for blockDevices
|
||||
*/
|
||||
export declare enum EbsDeviceVolumeType {
|
||||
/**
|
||||
* Magnetic
|
||||
*/
|
||||
STANDARD = "standard",
|
||||
/**
|
||||
* Provisioned IOPS SSD - IO1
|
||||
*/
|
||||
IO1 = "io1",
|
||||
/**
|
||||
* General Purpose SSD - GP2
|
||||
*/
|
||||
GP2 = "gp2",
|
||||
/**
|
||||
* General Purpose SSD - GP3
|
||||
*/
|
||||
GP3 = "gp3",
|
||||
/**
|
||||
* Throughput Optimized HDD
|
||||
*/
|
||||
ST1 = "st1",
|
||||
/**
|
||||
* Cold HDD
|
||||
*/
|
||||
SC1 = "sc1"
|
||||
}
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/volume.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/volume.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EbsDeviceVolumeType=exports.BlockDeviceVolume=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class BlockDeviceVolume{ebsDevice;virtualName;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_autoscaling.BlockDeviceVolume",version:"2.252.0"};static _NO_DEVICE=new BlockDeviceVolume;static ebs(volumeSize,options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_autoscaling_EbsDeviceOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.ebs),error}return new this({...options,volumeSize})}static ebsFromSnapshot(snapshotId,options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_autoscaling_EbsDeviceSnapshotOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.ebsFromSnapshot),error}return new this({...options,snapshotId})}static ephemeral(volumeIndex){if(volumeIndex<0)throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`VolumeIndexMustBeNonNegative`,`volumeIndex must be a number starting from 0, got "${volumeIndex}"`);return new this(void 0,`ephemeral${volumeIndex}`)}static noDevice(){return this._NO_DEVICE}constructor(ebsDevice,virtualName){this.ebsDevice=ebsDevice,this.virtualName=virtualName;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_autoscaling_EbsDeviceProps(ebsDevice)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,BlockDeviceVolume),error}}}exports.BlockDeviceVolume=BlockDeviceVolume;var EbsDeviceVolumeType;(function(EbsDeviceVolumeType2){EbsDeviceVolumeType2.STANDARD="standard",EbsDeviceVolumeType2.IO1="io1",EbsDeviceVolumeType2.GP2="gp2",EbsDeviceVolumeType2.GP3="gp3",EbsDeviceVolumeType2.ST1="st1",EbsDeviceVolumeType2.SC1="sc1"})(EbsDeviceVolumeType||(exports.EbsDeviceVolumeType=EbsDeviceVolumeType={}));
|
||||
76
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/warm-pool.d.ts
generated
vendored
Normal file
76
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/warm-pool.d.ts
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
import type { Construct } from 'constructs';
|
||||
import { Resource } from '../../core';
|
||||
import type { IAutoScalingGroupRef } from '../../interfaces/generated/aws-autoscaling-interfaces.generated';
|
||||
/**
|
||||
* Options for a warm pool
|
||||
*/
|
||||
export interface WarmPoolOptions {
|
||||
/**
|
||||
* Indicates whether instances in the Auto Scaling group can be returned to the warm pool on scale in.
|
||||
*
|
||||
* If the value is not specified, instances in the Auto Scaling group will be terminated
|
||||
* when the group scales in.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly reuseOnScaleIn?: boolean;
|
||||
/**
|
||||
* The maximum number of instances that are allowed to be in the warm pool
|
||||
* or in any state except Terminated for the Auto Scaling group.
|
||||
*
|
||||
* If the value is not specified, Amazon EC2 Auto Scaling launches and maintains
|
||||
* the difference between the group's maximum capacity and its desired capacity.
|
||||
*
|
||||
* @default - max size of the Auto Scaling group
|
||||
*/
|
||||
readonly maxGroupPreparedCapacity?: number;
|
||||
/**
|
||||
* The minimum number of instances to maintain in the warm pool.
|
||||
*
|
||||
* @default 0
|
||||
*/
|
||||
readonly minSize?: number;
|
||||
/**
|
||||
* The instance state to transition to after the lifecycle actions are complete.
|
||||
*
|
||||
* @default PoolState.STOPPED
|
||||
*/
|
||||
readonly poolState?: PoolState;
|
||||
}
|
||||
/**
|
||||
* Properties for a warm pool
|
||||
*/
|
||||
export interface WarmPoolProps extends WarmPoolOptions {
|
||||
/**
|
||||
* The Auto Scaling group to add the warm pool to.
|
||||
*/
|
||||
readonly autoScalingGroup: IAutoScalingGroupRef;
|
||||
}
|
||||
/**
|
||||
* Define a warm pool
|
||||
*/
|
||||
export declare class WarmPool extends Resource {
|
||||
/** Uniquely identifies this class. */
|
||||
static readonly PROPERTY_INJECTION_ID: string;
|
||||
constructor(scope: Construct, id: string, props: WarmPoolProps);
|
||||
}
|
||||
/**
|
||||
* The instance state in the warm pool
|
||||
*/
|
||||
export declare enum PoolState {
|
||||
/**
|
||||
* Hibernated
|
||||
*
|
||||
* To use this state, prerequisites must be in place.
|
||||
* @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hibernating-prerequisites.html
|
||||
*/
|
||||
HIBERNATED = "Hibernated",
|
||||
/**
|
||||
* Running
|
||||
*/
|
||||
RUNNING = "Running",
|
||||
/**
|
||||
* Stopped
|
||||
*/
|
||||
STOPPED = "Stopped"
|
||||
}
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/warm-pool.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-autoscaling/lib/warm-pool.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var __esDecorate=exports&&exports.__esDecorate||function(ctor,descriptorIn,decorators,contextIn,initializers,extraInitializers){function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Function expected");return f}for(var kind=contextIn.kind,key=kind==="getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor?contextIn.static?ctor:ctor.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor(target,contextIn.name):{}),_,done=!1,i=decorators.length-1;i>=0;i--){var context={};for(var p in contextIn)context[p]=p==="access"?{}:contextIn[p];for(var p in contextIn.access)context.access[p]=contextIn.access[p];context.addInitializer=function(f){if(done)throw new TypeError("Cannot add initializers after decoration has completed");extraInitializers.push(accept(f||null))};var result=(0,decorators[i])(kind==="accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key],context);if(kind==="accessor"){if(result===void 0)continue;if(result===null||typeof result!="object")throw new TypeError("Object expected");(_=accept(result.get))&&(descriptor.get=_),(_=accept(result.set))&&(descriptor.set=_),(_=accept(result.init))&&initializers.unshift(_)}else(_=accept(result))&&(kind==="field"?initializers.unshift(_):descriptor[key]=_)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers=exports&&exports.__runInitializers||function(thisArg,initializers,value){for(var useValue=arguments.length>2,i=0;i<initializers.length;i++)value=useValue?initializers[i].call(thisArg,value):initializers[i].call(thisArg);return useValue?value:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PoolState=exports.WarmPool=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var autoscaling_generated_1=()=>{var tmp=require("./autoscaling.generated");return autoscaling_generated_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},metadata_resource_1=()=>{var tmp=require("../../core/lib/metadata-resource");return metadata_resource_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp},prop_injectable_1=()=>{var tmp=require("../../core/lib/prop-injectable");return prop_injectable_1=()=>tmp,tmp};let WarmPool=(()=>{let _classDecorators=[prop_injectable_1().propertyInjectable],_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=core_1().Resource;var WarmPool2=class extends _classSuper{static{_classThis=this}static{const _metadata=typeof Symbol=="function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;__esDecorate(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),WarmPool2=_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata})}static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_autoscaling.WarmPool",version:"2.252.0"};static PROPERTY_INJECTION_ID="aws-cdk-lib.aws-autoscaling.WarmPool";constructor(scope,id,props){super(scope,id,{physicalName:core_1().Lazy.string({produce:()=>core_1().Names.uniqueId(this)})});try{jsiiDeprecationWarnings().aws_cdk_lib_aws_autoscaling_WarmPoolProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,WarmPool2),error}if((0,metadata_resource_1().addConstructMetadata)(this,props),props.maxGroupPreparedCapacity&&props.maxGroupPreparedCapacity<-1)throw new(core_1()).ValidationError((0,literal_string_1().lit)`MaxGroupPreparedCapacityParameter`,"'maxGroupPreparedCapacity' parameter should be greater than or equal to -1",this);if(props.minSize&&props.minSize<0)throw new(core_1()).ValidationError((0,literal_string_1().lit)`ShouldBeMinsizeParameterShould`,"'minSize' parameter should be greater than or equal to 0",this);new(autoscaling_generated_1()).CfnWarmPool(this,"Resource",{autoScalingGroupName:props.autoScalingGroup.autoScalingGroupRef.autoScalingGroupName,instanceReusePolicy:props.reuseOnScaleIn!==void 0?{reuseOnScaleIn:props.reuseOnScaleIn}:void 0,maxGroupPreparedCapacity:props.maxGroupPreparedCapacity,minSize:props.minSize,poolState:props.poolState})}static{__runInitializers(_classThis,_classExtraInitializers)}};return WarmPool2=_classThis})();exports.WarmPool=WarmPool;var PoolState;(function(PoolState2){PoolState2.HIBERNATED="Hibernated",PoolState2.RUNNING="Running",PoolState2.STOPPED="Stopped"})(PoolState||(exports.PoolState=PoolState={}));
|
||||
Reference in New Issue
Block a user