class ScalableInstanceCount (construct)
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Sagemaker.Alpha.ScalableInstanceCount |
Go | github.com/aws/aws-cdk-go/awscdksagemakeralpha/v2#ScalableInstanceCount |
Java | software.amazon.awscdk.services.sagemaker.alpha.ScalableInstanceCount |
Python | aws_cdk.aws_sagemaker_alpha.ScalableInstanceCount |
TypeScript (source) | @aws-cdk/aws-sagemaker-alpha ยป ScalableInstanceCount |
Implements
IConstruct, IDependable, IScalable, IEnvironment
A scalable sagemaker endpoint attribute.
Example
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
new ScalableInstanceCount(scope: Construct, id: string, props: ScalableInstanceCountProps)
Parameters
- scope
Construct - id
string - props
ScalableInstance Count Props
Constructs a new instance of the ScalableInstanceCount class.
Construct Props
| Name | Type | Description |
|---|---|---|
| dimension | string | Scalable dimension of the attribute. |
| max | number | Maximum capacity to scale to. |
| resource | string | Resource ID of the attribute. |
| role | IRole | Role to use for scaling. |
| service | Service | Service namespace of the scalable attribute. |
| min | number | Minimum capacity to scale to. |
dimension
Type:
string
Scalable dimension of the attribute.
maxCapacity
Type:
number
Maximum capacity to scale to.
resourceId
Type:
string
Resource ID of the attribute.
role
Type:
IRole
Role to use for scaling.
serviceNamespace
Type:
Service
Service namespace of the scalable attribute.
minCapacity?
Type:
number
(optional, default: 1)
Minimum capacity to scale to.
Properties
| Name | Type | Description |
|---|---|---|
| env | Resource | The environment this resource belongs to. |
| node | Node | The tree node. |
| scalable | Scalable | A reference to a ScalableTarget resource. |
env
Type:
Resource
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
Type:
Node
The tree node.
scalableTargetRef
Type:
Scalable
A reference to a ScalableTarget resource.
Methods
| Name | Description |
|---|---|
| scale | Scales in or out to achieve a target requests per second per instance. |
| to | Returns a string representation of this construct. |
scaleOnInvocations(id, props)
public scaleOnInvocations(id: string, props: InvocationsScalingProps): void
Parameters
- id
string - props
InvocationsScaling Props
Scales in or out to achieve a target requests per second per instance.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.

.NET
Go
Java
Python
TypeScript (