# 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-applicationautoscaling/lib/step-scaling-action.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-applicationautoscaling/lib/step-scaling-action.ts#L75)

## 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_applicationautoscaling as appscaling } from 'aws-cdk-lib';
import { aws_applicationautoscaling as interfaces_applicationautoscaling } from 'aws-cdk-lib/interfaces';

declare const scalableTargetRef: interfaces_applicationautoscaling.IScalableTargetRef;
const stepScalingAction = new appscaling.StepScalingAction(this, 'MyStepScalingAction', {
  scalingTarget: scalableTargetRef,

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

## Initializer

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

## Construct Props

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

- `cooldown`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) — Grace period after scaling activity.

  **Default:** No cooldown period

  For scale out policies, multiple scale outs during the cooldown period are
  squashed so that only the biggest scale out happens.

  For scale in policies, subsequent scale ins during the cooldown period are
  ignored.

- `metricAggregationType`: [MetricAggregationType](/cdk/api/v2/docs/aws-cdk-lib.aws_applicationautoscaling.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.

- `policyName`: string — A name for the scaling policy.

  **Default:** Automatically generated name

- `scalingTarget`: [IScalableTargetRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_applicationautoscaling.IScalableTargetRef.html) (required) — The scalable target.

## 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
