# StepScalingAction

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.

Extends: Construct › StepScalingAction
Implements: IConstruct, IDependable

- Source: [`aws-autoscaling/lib/step-scaling-action.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-autoscaling/lib/step-scaling-action.ts#L69)

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_autoscaling as autoscaling } from 'aws-cdk-lib';
import { aws_autoscaling as interfaces_autoscaling } from 'aws-cdk-lib/interfaces';

declare const autoScalingGroupRef: interfaces_autoscaling.IAutoScalingGroupRef;
const stepScalingAction = new autoscaling.StepScalingAction(this, 'MyStepScalingAction', {
  autoScalingGroup: autoScalingGroupRef,

  // the properties below are optional
  adjustmentType: autoscaling.AdjustmentType.CHANGE_IN_CAPACITY,
  cooldown: cdk.Duration.minutes(30),
  estimatedInstanceWarmup: cdk.Duration.minutes(30),
  metricAggregationType: autoscaling.MetricAggregationType.AVERAGE,
  minAdjustmentMagnitude: 123,
});
```

## Initializer

```ts
new StepScalingAction(scope: Construct, id: string, props: StepScalingActionProps)
```

## Construct Props

- `adjustmentType`: [AdjustmentType](/cdk/api/v2/docs/aws-cdk-lib.aws_autoscaling.AdjustmentType.html) = ChangeInCapacity — How the adjustment numbers are interpreted.

- `autoScalingGroup`: [IAutoScalingGroupRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_autoscaling.IAutoScalingGroupRef.html) (required) — The auto scaling group.

- `cooldown`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) — cooldown is not valid with step scaling action

  **Default:** The default cooldown configured on the AutoScalingGroup

- `estimatedInstanceWarmup`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) — Estimated time until a newly launched instance can send metrics to CloudWatch.

  **Default:** Same as the cooldown

- `metricAggregationType`: [MetricAggregationType](/cdk/api/v2/docs/aws-cdk-lib.aws_autoscaling.MetricAggregationType.html) = Average — The aggregation type for the CloudWatch metrics.

- `minAdjustmentMagnitude`: number — Minimum absolute number to adjust capacity with as result of percentage scaling.

  **Default:** No minimum scaling effect

  Only when using AdjustmentType = PercentChangeInCapacity, this number controls
  the minimum absolute effect size.

## Properties

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `scalingPolicyArn`: string — ARN of the scaling policy.

## Methods

- `addAdjustment(adjustment: AdjustmentTier): void` — Add an adjustment interval to the ScalingAction.

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
