Skip to content
v2.278.0

BaseScalableAttribute ​

Represent an attribute for which autoscaling can be configured.

This class is basically a light wrapper around ScalableTarget, but with all methods protected instead of public so they can be selectively exposed and/or more specific versions of them can be exposed by derived classes for individual services support autoscaling.

Typical use cases:

  • Hide away the PredefinedMetric enum for target tracking policies.
  • Don't expose all scaling methods (for example Dynamo tables don't support Step Scaling, so the Dynamo subclass won't expose this method).

Initializer ​

ts
new BaseScalableAttribute(scope: Construct, id: string, props: BaseScalableAttributeProps)
python
BaseScalableAttribute(scope: Construct, id: str, props: BaseScalableAttributeProps)
java
new BaseScalableAttribute(Construct scope, String id, BaseScalableAttributeProps props)
csharp
new BaseScalableAttribute(Construct scope, string id, BaseScalableAttributeProps props)
go
NewBaseScalableAttribute(Scope Construct, Id *string, Props BaseScalableAttributeProps)

Construct Props ​

dimensionstringdimensionstrdimensionStringDimensionstringDimension*string required #
Scalable dimension of the attribute.
maxCapacitynumbermax_capacityint | floatmaxCapacityNumberMaxCapacitydoubleMaxCapacity*float64 required #
Maximum capacity to scale to.
minCapacityoptionalnumbermin_capacityoptionalint | floatminCapacityoptionalNumberMinCapacityoptionaldoubleMinCapacityoptional*float64 = 1 #
Minimum capacity to scale to.
resourceIdstringresource_idstrresourceIdStringResourceIdstringResourceId*string required #
Resource ID of the attribute.
roleIRoleroleIRoleroleIRoleRoleIRoleRoleIRole required #
Role to use for scaling.
serviceNamespaceServiceNamespaceservice_namespaceServiceNamespaceserviceNamespaceServiceNamespaceServiceNamespaceServiceNamespaceServiceNamespaceServiceNamespace required #
Service namespace of the scalable attribute.

Properties ​

The environment this resource belongs to.
notes

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.

nodeNodenodeNodenodeNodeNodeNodeNodeNode #
The tree node.
scalableTargetRefScalableTargetReferencescalable_target_refScalableTargetReferencescalableTargetRefScalableTargetReferenceScalableTargetRefScalableTargetReferenceScalableTargetRefScalableTargetReference #
A reference to a ScalableTarget resource.

Methods ​

isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *bool static #
Checks if `x` is a construct.
notes · 1 parameter · returns

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

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string #
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func 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.

1 parameter · returns

Parameters

  • mixinsmixinsmixinsmixinsMixins — The mixins to apply.

Returns: This construct for chaining