Show / Hide Table of Contents

Class ScalableTarget

Define a scalable target.

Inheritance
System.Object
Construct
Resource
ScalableTarget
Implements
IScalableTarget
IResource
IConstruct
Constructs.IConstruct
IDependable
Inherited Members
Resource.IsResource(IConstruct)
Resource.ApplyRemovalPolicy(RemovalPolicy)
Resource.GeneratePhysicalName()
Resource.GetResourceArnAttribute(String, IArnComponents)
Resource.GetResourceNameAttribute(String)
Resource.Env
Resource.PhysicalName
Resource.Stack
Construct.IsConstruct(Object)
Construct.OnPrepare()
Construct.OnSynthesize(ISynthesisSession)
Construct.OnValidate()
Construct.Prepare()
Construct.Synthesize(ISynthesisSession)
Construct.Validate()
Construct.Node
Namespace: Amazon.CDK.AWS.ApplicationAutoScaling
Assembly: Amazon.CDK.AWS.ApplicationAutoScaling.dll
Syntax (csharp)
public class ScalableTarget : Resource, IScalableTarget, IResource, IConstruct, IDependable
Syntax (vb)
Public Class ScalableTarget
    Inherits Resource
    Implements IScalableTarget, IResource, IConstruct, IDependable
Remarks

ExampleMetadata: infused

Examples
using Amazon.CDK.AWS.Lambda;

Code code;


var handler = new Function(this, "MyFunction", new FunctionProps {
    Runtime = Runtime.PYTHON_3_7,
    Handler = "index.handler",
    Code = code,

    ReservedConcurrentExecutions = 2
});

var fnVer = handler.CurrentVersion;

var target = new ScalableTarget(this, "ScalableTarget", new ScalableTargetProps {
    ServiceNamespace = ServiceNamespace.LAMBDA,
    MaxCapacity = 100,
    MinCapacity = 10,
    ResourceId = $"function:{handler.functionName}:{fnVer.version}",
    ScalableDimension = "lambda:function:ProvisionedConcurrency"
});

target.ScaleToTrackMetric("PceTracking", new BasicTargetTrackingScalingPolicyProps {
    TargetValue = 0.9,
    PredefinedMetric = PredefinedMetric.LAMBDA_PROVISIONED_CONCURRENCY_UTILIZATION
});

Synopsis

Constructors

ScalableTarget(ByRefValue)

Used by jsii to construct an instance of this class from a Javascript-owned object reference

ScalableTarget(DeputyBase.DeputyProps)

Used by jsii to construct an instance of this class from DeputyProps

ScalableTarget(Construct, String, IScalableTargetProps)

Properties

Role

The role used to give AutoScaling permissions to your resource.

ScalableTargetId

ID of the Scalable Target.

Methods

AddToRolePolicy(PolicyStatement)

Add a policy statement to the role's policy.

FromScalableTargetId(Construct, String, String)
ScaleOnMetric(String, IBasicStepScalingPolicyProps)

Scale out or in, in response to a metric.

ScaleOnSchedule(String, IScalingSchedule)

Scale out or in based on time.

ScaleToTrackMetric(String, IBasicTargetTrackingScalingPolicyProps)

Scale out or in in order to keep a metric around a target value.

Constructors

ScalableTarget(ByRefValue)

Used by jsii to construct an instance of this class from a Javascript-owned object reference

protected ScalableTarget(ByRefValue reference)
Parameters
reference Amazon.JSII.Runtime.Deputy.ByRefValue

The Javascript-owned object reference

ScalableTarget(DeputyBase.DeputyProps)

Used by jsii to construct an instance of this class from DeputyProps

protected ScalableTarget(DeputyBase.DeputyProps props)
Parameters
props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps

The deputy props

ScalableTarget(Construct, String, IScalableTargetProps)

public ScalableTarget(Construct scope, string id, IScalableTargetProps props)
Parameters
scope Constructs.Construct
id System.String
props IScalableTargetProps

Properties

Role

The role used to give AutoScaling permissions to your resource.

public virtual IRole Role { get; }
Property Value

IRole

ScalableTargetId

ID of the Scalable Target.

public virtual string ScalableTargetId { get; }
Property Value

System.String

Remarks

Example value: service/ecsStack-MyECSCluster-AB12CDE3F4GH/ecsStack-MyECSService-AB12CDE3F4GH|ecs:service:DesiredCount|ecs

Attribute: true

Methods

AddToRolePolicy(PolicyStatement)

Add a policy statement to the role's policy.

public virtual void AddToRolePolicy(PolicyStatement statement)
Parameters
statement PolicyStatement

FromScalableTargetId(Construct, String, String)

public static IScalableTarget FromScalableTargetId(Construct scope, string id, string scalableTargetId)
Parameters
scope Constructs.Construct
id System.String
scalableTargetId System.String
Returns

IScalableTarget

ScaleOnMetric(String, IBasicStepScalingPolicyProps)

Scale out or in, in response to a metric.

public virtual StepScalingPolicy ScaleOnMetric(string id, IBasicStepScalingPolicyProps props)
Parameters
id System.String
props IBasicStepScalingPolicyProps
Returns

StepScalingPolicy

ScaleOnSchedule(String, IScalingSchedule)

Scale out or in based on time.

public virtual void ScaleOnSchedule(string id, IScalingSchedule action)
Parameters
id System.String
action IScalingSchedule

ScaleToTrackMetric(String, IBasicTargetTrackingScalingPolicyProps)

Scale out or in in order to keep a metric around a target value.

public virtual TargetTrackingScalingPolicy ScaleToTrackMetric(string id, IBasicTargetTrackingScalingPolicyProps props)
Parameters
id System.String
props IBasicTargetTrackingScalingPolicyProps
Returns

TargetTrackingScalingPolicy

Implements

IScalableTarget
IResource
IConstruct
Constructs.IConstruct
IDependable
Back to top Generated by DocFX