Class ScalableTarget
Define a scalable target.
Inherited Members
Namespace: Amazon.CDK.AWS.ApplicationAutoScaling
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ScalableTarget : Resource, IScalableTarget, IResource
Syntax (vb)
Public Class ScalableTarget
Inherits Resource
Implements IScalableTarget, IResource
Remarks
ExampleMetadata: infused
Examples
var shardsScalableTarget = new ScalableTarget(this, "ElastiCacheRedisShardsScalableTarget", new ScalableTargetProps {
ServiceNamespace = ServiceNamespace.ELASTICACHE,
ScalableDimension = "elasticache:replication-group:NodeGroups",
MinCapacity = 2,
MaxCapacity = 10,
ResourceId = "replication-group/main-cluster"
});
shardsScalableTarget.ScaleToTrackMetric("ElastiCacheRedisShardsCPUUtilization", new BasicTargetTrackingScalingPolicyProps {
TargetValue = 20,
PredefinedMetric = PredefinedMetric.ELASTICACHE_PRIMARY_ENGINE_CPU_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
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
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
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