aws-cdk-lib.aws_applicationautoscaling.ScalableTargetProps

interface ScalableTargetProps

LanguageType name
.NETAmazon.CDK.AWS.ApplicationAutoScaling.ScalableTargetProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsapplicationautoscaling#ScalableTargetProps
Javasoftware.amazon.awscdk.services.applicationautoscaling.ScalableTargetProps
Pythonaws_cdk.aws_applicationautoscaling.ScalableTargetProps
TypeScript (source)aws-cdk-lib » aws_applicationautoscaling » ScalableTargetProps

Properties for a scalable target.

Example

import * as lambda from 'aws-cdk-lib/aws-lambda';

declare const code: lambda.Code;

const handler = new lambda.Function(this, 'MyFunction', {
  runtime: lambda.Runtime.PYTHON_3_7,
  handler: 'index.handler',
  code,

  reservedConcurrentExecutions: 2,
});

const fnVer = handler.currentVersion;

const target = new appscaling.ScalableTarget(this, 'ScalableTarget', {
  serviceNamespace: appscaling.ServiceNamespace.LAMBDA,
  maxCapacity: 100,
  minCapacity: 10,
  resourceId: `function:${handler.functionName}:${fnVer.version}`,
  scalableDimension: 'lambda:function:ProvisionedConcurrency',
})

target.scaleToTrackMetric('PceTracking', {
  targetValue: 0.9,
  predefinedMetric: appscaling.PredefinedMetric.LAMBDA_PROVISIONED_CONCURRENCY_UTILIZATION,
})

Properties

NameTypeDescription
maxCapacitynumberThe maximum value that Application Auto Scaling can use to scale a target during a scaling activity.
minCapacitynumberThe minimum value that Application Auto Scaling can use to scale a target during a scaling activity.
resourceIdstringThe resource identifier to associate with this scalable target.
scalableDimensionstringThe scalable dimension that's associated with the scalable target.
serviceNamespaceServiceNamespaceThe namespace of the AWS service that provides the resource or custom-resource for a resource provided by your own application or service.
role?IRoleRole that allows Application Auto Scaling to modify your scalable target.

maxCapacity

Type: number

The maximum value that Application Auto Scaling can use to scale a target during a scaling activity.


minCapacity

Type: number

The minimum value that Application Auto Scaling can use to scale a target during a scaling activity.


resourceId

Type: string

The resource identifier to associate with this scalable target.

This string consists of the resource type and unique identifier.

Example value: service/ecsStack-MyECSCluster-AB12CDE3F4GH/ecsStack-MyECSService-AB12CDE3F4GH

See also: https://docs.aws.amazon.com/autoscaling/application/APIReference/API_RegisterScalableTarget.html


scalableDimension

Type: string

The scalable dimension that's associated with the scalable target.

Specify the service namespace, resource type, and scaling property.

Example value: ecs:service:DesiredCount

See also: https://docs.aws.amazon.com/autoscaling/application/APIReference/API_ScalingPolicy.html


serviceNamespace

Type: ServiceNamespace

The namespace of the AWS service that provides the resource or custom-resource for a resource provided by your own application or service.

For valid AWS service namespace values, see the RegisterScalableTarget action in the Application Auto Scaling API Reference.

See also: https://docs.aws.amazon.com/autoscaling/application/APIReference/API_RegisterScalableTarget.html


role?

Type: IRole (optional, default: A role is automatically created)

Role that allows Application Auto Scaling to modify your scalable target.