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:

shards_scalable_target = appscaling.ScalableTarget(self, "ElastiCacheRedisShardsScalableTarget",
    service_namespace=appscaling.ServiceNamespace.ELASTICACHE,
    scalable_dimension="elasticache:replication-group:NodeGroups",
    min_capacity=2,
    max_capacity=10,
    resource_id="replication-group/main-cluster"
)

shards_scalable_target.scale_to_track_metric("ElastiCacheRedisShardsCPUUtilization",
    target_value=20,
    predefined_metric=appscaling.PredefinedMetric.ELASTICACHE_PRIMARY_ENGINE_CPU_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