Class ScalableTarget
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.core.Construct
software.amazon.awscdk.core.Resource
software.amazon.awscdk.services.applicationautoscaling.ScalableTarget
- All Implemented Interfaces:
IConstruct
,IDependable
,IResource
,IScalableTarget
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:37.369Z")
@Stability(Stable)
public class ScalableTarget
extends Resource
implements IScalableTarget
Define a scalable target.
Example:
import software.amazon.awscdk.services.lambda.*; Code code; Function handler = Function.Builder.create(this, "MyFunction") .runtime(Runtime.PYTHON_3_7) .handler("index.handler") .code(code) .reservedConcurrentExecutions(2) .build(); Version fnVer = handler.getCurrentVersion(); ScalableTarget target = ScalableTarget.Builder.create(this, "ScalableTarget") .serviceNamespace(ServiceNamespace.LAMBDA) .maxCapacity(100) .minCapacity(10) .resourceId(String.format("function:%s:%s", handler.getFunctionName(), fnVer.getVersion())) .scalableDimension("lambda:function:ProvisionedConcurrency") .build(); target.scaleToTrackMetric("PceTracking", BasicTargetTrackingScalingPolicyProps.builder() .targetValue(0.9) .predefinedMetric(PredefinedMetric.LAMBDA_PROVISIONED_CONCURRENCY_UTILIZATION) .build());
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IResource
IResource.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.applicationautoscaling.IScalableTarget
IScalableTarget.Jsii$Default, IScalableTarget.Jsii$Proxy
-
Constructor Summary
ModifierConstructorDescriptionprotected
ScalableTarget
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
ScalableTarget
(software.amazon.jsii.JsiiObjectRef objRef) ScalableTarget
(software.constructs.Construct scope, String id, ScalableTargetProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToRolePolicy
(PolicyStatement statement) Add a policy statement to the role's policy.static IScalableTarget
fromScalableTargetId
(software.constructs.Construct scope, String id, String scalableTargetId) getRole()
The role used to give AutoScaling permissions to your resource.ID of the Scalable Target.scaleOnMetric
(String id, BasicStepScalingPolicyProps props) Scale out or in, in response to a metric.void
scaleOnSchedule
(String id, ScalingSchedule action) Scale out or in based on time.Scale out or in in order to keep a metric around a target value.Methods inherited from class software.amazon.awscdk.core.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
Methods inherited from class software.constructs.Construct
toString
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.awscdk.core.IConstruct
getNode
Methods inherited from interface software.amazon.awscdk.core.IResource
applyRemovalPolicy, getEnv, getStack
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
ScalableTarget
protected ScalableTarget(software.amazon.jsii.JsiiObjectRef objRef) -
ScalableTarget
protected ScalableTarget(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
ScalableTarget
@Stability(Stable) public ScalableTarget(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ScalableTargetProps props) - Parameters:
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.
-
-
Method Details
-
fromScalableTargetId
@Stability(Stable) @NotNull public static IScalableTarget fromScalableTargetId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String scalableTargetId) - Parameters:
scope
- This parameter is required.id
- This parameter is required.scalableTargetId
- This parameter is required.
-
addToRolePolicy
Add a policy statement to the role's policy.- Parameters:
statement
- This parameter is required.
-
scaleOnMetric
@Stability(Stable) @NotNull public StepScalingPolicy scaleOnMetric(@NotNull String id, @NotNull BasicStepScalingPolicyProps props) Scale out or in, in response to a metric.- Parameters:
id
- This parameter is required.props
- This parameter is required.
-
scaleOnSchedule
Scale out or in based on time.- Parameters:
id
- This parameter is required.action
- This parameter is required.
-
scaleToTrackMetric
@Stability(Stable) @NotNull public TargetTrackingScalingPolicy scaleToTrackMetric(@NotNull String id, @NotNull BasicTargetTrackingScalingPolicyProps props) Scale out or in in order to keep a metric around a target value.- Parameters:
id
- This parameter is required.props
- This parameter is required.
-
getRole
The role used to give AutoScaling permissions to your resource. -
getScalableTargetId
ID of the Scalable Target.Example value:
service/ecsStack-MyECSCluster-AB12CDE3F4GH/ecsStack-MyECSService-AB12CDE3F4GH|ecs:service:DesiredCount|ecs
- Specified by:
getScalableTargetId
in interfaceIScalableTarget
-