> **Experimental**
>
> `@aws-cdk/aws-sagemaker-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# ScalableInstanceCount

A scalable sagemaker endpoint attribute.

Extends: Construct › BaseScalableAttribute › ScalableInstanceCount
Implements: IEnvironmentAware, IScalableTargetRef, IConstruct, IDependable

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/scalable-instance-count.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0-alpha.0/packages/@aws-cdk/aws-sagemaker-alpha/lib/scalable-instance-count.ts#L13)

## Example

```ts
import * as sagemaker from '@aws-cdk/aws-sagemaker-alpha';

declare const model: sagemaker.Model;

const variantName = 'my-variant';
const endpointConfig = new sagemaker.EndpointConfig(this, 'EndpointConfig', {
  instanceProductionVariants: [
    {
      model: model,
      variantName: variantName,
    },
  ]
});

const endpoint = new sagemaker.Endpoint(this, 'Endpoint', { endpointConfig });
const productionVariant = endpoint.findInstanceProductionVariant(variantName);
const instanceCount = productionVariant.autoScaleInstanceCount({
  maxCapacity: 3
});
instanceCount.scaleOnInvocations('LimitRPS', {
  maxRequestsPerSecond: 30,
});
```

## Initializer

```ts
new ScalableInstanceCount(scope: Construct, id: string, props: ScalableInstanceCountProps)
```

## Construct Props

- `dimension`: string (required) — Scalable dimension of the attribute.

- `maxCapacity`: number (required) — Maximum capacity to scale to.

- `minCapacity`: number = 1 — Minimum capacity to scale to.

- `resourceId`: string (required) — Resource ID of the attribute.

- `role`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) (required) — Role to use for scaling.

- `serviceNamespace`: [ServiceNamespace](/cdk/api/v2/docs/aws-cdk-lib.aws_applicationautoscaling.ServiceNamespace.html) (required) — Service namespace of the scalable attribute.

## Properties

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) (required) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

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

- `scalableTargetRef`: [ScalableTargetReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_applicationautoscaling.ScalableTargetReference.html) (required) — A reference to a ScalableTarget resource.

## Methods

- `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`.

- `scaleOnInvocations(id: string, props: InvocationsScalingProps): void` — Scales in or out to achieve a target requests per second per instance.

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