@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:36.412Z") @Stability(value=Stable) public class ScalableTarget extends Resource implements IScalableTarget
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());
| Modifier and Type | Class and Description |
|---|---|
static class |
ScalableTarget.Builder
A fluent builder for
ScalableTarget. |
software.amazon.jsii.JsiiObject.InitializationModeIScalableTarget.Jsii$Default, IScalableTarget.Jsii$Proxy| Modifier | Constructor and Description |
|---|---|
|
ScalableTarget(software.constructs.Construct scope,
String id,
ScalableTargetProps props) |
protected |
ScalableTarget(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
ScalableTarget(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
void |
addToRolePolicy(PolicyStatement statement)
Add a policy statement to the role's policy.
|
static IScalableTarget |
fromScalableTargetId(software.constructs.Construct scope,
String id,
String scalableTargetId) |
IRole |
getRole()
The role used to give AutoScaling permissions to your resource.
|
String |
getScalableTargetId()
ID of the Scalable Target.
|
StepScalingPolicy |
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.
|
TargetTrackingScalingPolicy |
scaleToTrackMetric(String id,
BasicTargetTrackingScalingPolicyProps props)
Scale out or in in order to keep a metric around a target value.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourcejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitapplyRemovalPolicy, getEnv, getStackprotected ScalableTarget(software.amazon.jsii.JsiiObjectRef objRef)
protected ScalableTarget(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public ScalableTarget(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
ScalableTargetProps props)
scope - This parameter is required.id - This parameter is required.props - This parameter is required.@Stability(value=Stable) @NotNull public static IScalableTarget fromScalableTargetId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String scalableTargetId)
scope - This parameter is required.id - This parameter is required.scalableTargetId - This parameter is required.@Stability(value=Stable)
public void addToRolePolicy(@NotNull
PolicyStatement statement)
statement - This parameter is required.@Stability(value=Stable) @NotNull public StepScalingPolicy scaleOnMetric(@NotNull String id, @NotNull BasicStepScalingPolicyProps props)
id - This parameter is required.props - This parameter is required.@Stability(value=Stable)
public void scaleOnSchedule(@NotNull
String id,
@NotNull
ScalingSchedule action)
id - This parameter is required.action - This parameter is required.@Stability(value=Stable) @NotNull public TargetTrackingScalingPolicy scaleToTrackMetric(@NotNull String id, @NotNull BasicTargetTrackingScalingPolicyProps props)
id - This parameter is required.props - This parameter is required.@Stability(value=Stable) @NotNull public IRole getRole()
@Stability(value=Stable) @NotNull public String getScalableTargetId()
Example value: service/ecsStack-MyECSCluster-AB12CDE3F4GH/ecsStack-MyECSService-AB12CDE3F4GH|ecs:service:DesiredCount|ecs
getScalableTargetId in interface IScalableTargetCopyright © 2022. All rights reserved.