ScalableTargetProps

class aws_cdk.aws_applicationautoscaling.ScalableTargetProps(*, max_capacity, min_capacity, resource_id, scalable_dimension, service_namespace, role=None)

Bases: object

Properties for a scalable target.

Parameters:
  • max_capacity (Union[int, float]) – The maximum value that Application Auto Scaling can use to scale a target during a scaling activity.

  • min_capacity (Union[int, float]) – The minimum value that Application Auto Scaling can use to scale a target during a scaling activity.

  • resource_id (str) – 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

  • scalable_dimension (str) – The scalable dimension that’s associated with the scalable target. Specify the service namespace, resource type, and scaling property. Example value: ecs:service:DesiredCount

  • service_namespace (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.

  • role (Optional[IRole]) – Role that allows Application Auto Scaling to modify your scalable target. Default: A role is automatically created

ExampleMetadata:

infused

Example:

import aws_cdk.aws_lambda as lambda_

# code: lambda.Code


handler = lambda_.Function(self, "MyFunction",
    runtime=lambda_.Runtime.PYTHON_3_7,
    handler="index.handler",
    code=code,

    reserved_concurrent_executions=2
)

fn_ver = handler.current_version

target = appscaling.ScalableTarget(self, "ScalableTarget",
    service_namespace=appscaling.ServiceNamespace.LAMBDA,
    max_capacity=100,
    min_capacity=10,
    resource_id=f"function:{handler.functionName}:{fnVer.version}",
    scalable_dimension="lambda:function:ProvisionedConcurrency"
)

target.scale_to_track_metric("PceTracking",
    target_value=0.9,
    predefined_metric=appscaling.PredefinedMetric.LAMBDA_PROVISIONED_CONCURRENCY_UTILIZATION
)

Attributes

max_capacity

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

min_capacity

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

resource_id

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:

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

role

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

Default:

A role is automatically created

scalable_dimension

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:

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

service_namespace

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:

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