Class ScalableTargetProps
Properties for a scalable target.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.ApplicationAutoScaling
Assembly: Amazon.CDK.AWS.ApplicationAutoScaling.dll
Syntax (csharp)
public class ScalableTargetProps : Object, IScalableTargetProps
Syntax (vb)
Public Class ScalableTargetProps
Inherits Object
Implements IScalableTargetProps
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
ScalableTargetProps() |
Properties
MaxCapacity | The maximum value that Application Auto Scaling can use to scale a target during a scaling activity. |
MinCapacity | The minimum value that Application Auto Scaling can use to scale a target during a scaling activity. |
ResourceId | The resource identifier to associate with this scalable target. |
Role | Role that allows Application Auto Scaling to modify your scalable target. |
ScalableDimension | The scalable dimension that's associated with the scalable target. |
ServiceNamespace | The namespace of the AWS service that provides the resource or custom-resource for a resource provided by your own application or service. |
Constructors
ScalableTargetProps()
public ScalableTargetProps()
Properties
MaxCapacity
The maximum value that Application Auto Scaling can use to scale a target during a scaling activity.
public double MaxCapacity { get; set; }
Property Value
System.Double
MinCapacity
The minimum value that Application Auto Scaling can use to scale a target during a scaling activity.
public double MinCapacity { get; set; }
Property Value
System.Double
ResourceId
The resource identifier to associate with this scalable target.
public string ResourceId { get; set; }
Property Value
System.String
Remarks
This string consists of the resource type and unique identifier.
Example value: service/ecsStack-MyECSCluster-AB12CDE3F4GH/ecsStack-MyECSService-AB12CDE3F4GH
Role
Role that allows Application Auto Scaling to modify your scalable target.
public IRole Role { get; set; }
Property Value
Remarks
Default: A role is automatically created
ScalableDimension
The scalable dimension that's associated with the scalable target.
public string ScalableDimension { get; set; }
Property Value
System.String
Remarks
Specify the service namespace, resource type, and scaling property.
Example value: ecs:service:DesiredCount
ServiceNamespace
The namespace of the AWS service that provides the resource or custom-resource for a resource provided by your own application or service.
public ServiceNamespace ServiceNamespace { get; set; }
Property Value
Remarks
For valid AWS service namespace values, see the RegisterScalableTarget action in the Application Auto Scaling API Reference.