Class CfnScalingPolicy
The AWS::AutoScaling::ScalingPolicy
resource specifies an Amazon EC2 Auto Scaling scaling policy so that the Auto Scaling group can scale the number of instances available for your application.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.AutoScaling
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CfnScalingPolicy : CfnResource, IInspectable
Syntax (vb)
Public Class CfnScalingPolicy
Inherits CfnResource
Implements IInspectable
Remarks
For more information about using scaling policies to scale your Auto Scaling group automatically, see Dynamic scaling and Predictive scaling in the Amazon EC2 Auto Scaling User Guide .
CloudformationResource: AWS::AutoScaling::ScalingPolicy
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AutoScaling;
var cfnScalingPolicy = new CfnScalingPolicy(this, "MyCfnScalingPolicy", new CfnScalingPolicyProps {
AutoScalingGroupName = "autoScalingGroupName",
// the properties below are optional
AdjustmentType = "adjustmentType",
Cooldown = "cooldown",
EstimatedInstanceWarmup = 123,
MetricAggregationType = "metricAggregationType",
MinAdjustmentMagnitude = 123,
PolicyType = "policyType",
PredictiveScalingConfiguration = new PredictiveScalingConfigurationProperty {
MetricSpecifications = new [] { new PredictiveScalingMetricSpecificationProperty {
TargetValue = 123,
// the properties below are optional
CustomizedCapacityMetricSpecification = new PredictiveScalingCustomizedCapacityMetricProperty {
MetricDataQueries = new [] { new MetricDataQueryProperty {
Id = "id",
// the properties below are optional
Expression = "expression",
Label = "label",
MetricStat = new MetricStatProperty {
Metric = new MetricProperty {
MetricName = "metricName",
Namespace = "namespace",
// the properties below are optional
Dimensions = new [] { new MetricDimensionProperty {
Name = "name",
Value = "value"
} }
},
Stat = "stat",
// the properties below are optional
Unit = "unit"
},
ReturnData = false
} }
},
CustomizedLoadMetricSpecification = new PredictiveScalingCustomizedLoadMetricProperty {
MetricDataQueries = new [] { new MetricDataQueryProperty {
Id = "id",
// the properties below are optional
Expression = "expression",
Label = "label",
MetricStat = new MetricStatProperty {
Metric = new MetricProperty {
MetricName = "metricName",
Namespace = "namespace",
// the properties below are optional
Dimensions = new [] { new MetricDimensionProperty {
Name = "name",
Value = "value"
} }
},
Stat = "stat",
// the properties below are optional
Unit = "unit"
},
ReturnData = false
} }
},
CustomizedScalingMetricSpecification = new PredictiveScalingCustomizedScalingMetricProperty {
MetricDataQueries = new [] { new MetricDataQueryProperty {
Id = "id",
// the properties below are optional
Expression = "expression",
Label = "label",
MetricStat = new MetricStatProperty {
Metric = new MetricProperty {
MetricName = "metricName",
Namespace = "namespace",
// the properties below are optional
Dimensions = new [] { new MetricDimensionProperty {
Name = "name",
Value = "value"
} }
},
Stat = "stat",
// the properties below are optional
Unit = "unit"
},
ReturnData = false
} }
},
PredefinedLoadMetricSpecification = new PredictiveScalingPredefinedLoadMetricProperty {
PredefinedMetricType = "predefinedMetricType",
// the properties below are optional
ResourceLabel = "resourceLabel"
},
PredefinedMetricPairSpecification = new PredictiveScalingPredefinedMetricPairProperty {
PredefinedMetricType = "predefinedMetricType",
// the properties below are optional
ResourceLabel = "resourceLabel"
},
PredefinedScalingMetricSpecification = new PredictiveScalingPredefinedScalingMetricProperty {
PredefinedMetricType = "predefinedMetricType",
// the properties below are optional
ResourceLabel = "resourceLabel"
}
} },
// the properties below are optional
MaxCapacityBreachBehavior = "maxCapacityBreachBehavior",
MaxCapacityBuffer = 123,
Mode = "mode",
SchedulingBufferTime = 123
},
ScalingAdjustment = 123,
StepAdjustments = new [] { new StepAdjustmentProperty {
ScalingAdjustment = 123,
// the properties below are optional
MetricIntervalLowerBound = 123,
MetricIntervalUpperBound = 123
} },
TargetTrackingConfiguration = new TargetTrackingConfigurationProperty {
TargetValue = 123,
// the properties below are optional
CustomizedMetricSpecification = new CustomizedMetricSpecificationProperty {
MetricName = "metricName",
Namespace = "namespace",
Statistic = "statistic",
// the properties below are optional
Dimensions = new [] { new MetricDimensionProperty {
Name = "name",
Value = "value"
} },
Unit = "unit"
},
DisableScaleIn = false,
PredefinedMetricSpecification = new PredefinedMetricSpecificationProperty {
PredefinedMetricType = "predefinedMetricType",
// the properties below are optional
ResourceLabel = "resourceLabel"
}
}
});
Synopsis
Constructors
CfnScalingPolicy(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CfnScalingPolicy(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
CfnScalingPolicy(Construct, String, ICfnScalingPolicyProps) |
Properties
AdjustmentType | Specifies how the scaling adjustment is interpreted (for example, an absolute number or a percentage). |
AttrArn | Returns the ARN of a scaling policy. |
AttrPolicyName | Returns the name of a scaling policy. |
AutoScalingGroupName | The name of the Auto Scaling group. |
CFN_RESOURCE_TYPE_NAME | The CloudFormation resource type name for this resource class. |
CfnProperties | |
Cooldown | A cooldown period, in seconds, that applies to a specific simple scaling policy. |
EstimatedInstanceWarmup | Not needed if the default instance warmup is defined for the group.. |
MetricAggregationType | The aggregation type for the CloudWatch metrics. |
MinAdjustmentMagnitude | The minimum value to scale by when the adjustment type is |
PolicyType | One of the following policy types:. |
PredictiveScalingConfiguration | A predictive scaling policy. |
ScalingAdjustment | The amount by which to scale, based on the specified adjustment type. |
StepAdjustments | A set of adjustments that enable you to scale based on the size of the alarm breach. |
TargetTrackingConfiguration | A target tracking scaling policy. |
Methods
Inspect(TreeInspector) | Examines the CloudFormation resource and discloses attributes. |
RenderProperties(IDictionary<String, Object>) |
Constructors
CfnScalingPolicy(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CfnScalingPolicy(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CfnScalingPolicy(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CfnScalingPolicy(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
CfnScalingPolicy(Construct, String, ICfnScalingPolicyProps)
public CfnScalingPolicy(Construct scope, string id, ICfnScalingPolicyProps props)
Parameters
- scope Constructs.Construct
Scope in which this resource is defined.
- id System.String
Construct identifier for this resource (unique in its scope).
- props ICfnScalingPolicyProps
Resource properties.
Properties
AdjustmentType
Specifies how the scaling adjustment is interpreted (for example, an absolute number or a percentage).
public virtual string AdjustmentType { get; set; }
Property Value
System.String
AttrArn
Returns the ARN of a scaling policy.
public virtual string AttrArn { get; }
Property Value
System.String
Remarks
CloudformationAttribute: Arn
AttrPolicyName
Returns the name of a scaling policy.
public virtual string AttrPolicyName { get; }
Property Value
System.String
Remarks
CloudformationAttribute: PolicyName
AutoScalingGroupName
The name of the Auto Scaling group.
public virtual string AutoScalingGroupName { get; set; }
Property Value
System.String
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
public static string CFN_RESOURCE_TYPE_NAME { get; }
Property Value
System.String
CfnProperties
protected override IDictionary<string, object> CfnProperties { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>
Overrides
Cooldown
A cooldown period, in seconds, that applies to a specific simple scaling policy.
public virtual string Cooldown { get; set; }
Property Value
System.String
EstimatedInstanceWarmup
Not needed if the default instance warmup is defined for the group..
public virtual Nullable<double> EstimatedInstanceWarmup { get; set; }
Property Value
System.Nullable<System.Double>
MetricAggregationType
The aggregation type for the CloudWatch metrics.
public virtual string MetricAggregationType { get; set; }
Property Value
System.String
MinAdjustmentMagnitude
The minimum value to scale by when the adjustment type is PercentChangeInCapacity
.
public virtual Nullable<double> MinAdjustmentMagnitude { get; set; }
Property Value
System.Nullable<System.Double>
PolicyType
One of the following policy types:.
public virtual string PolicyType { get; set; }
Property Value
System.String
PredictiveScalingConfiguration
A predictive scaling policy.
public virtual object PredictiveScalingConfiguration { get; set; }
Property Value
System.Object
Remarks
Provides support for predefined and custom metrics.
ScalingAdjustment
The amount by which to scale, based on the specified adjustment type.
public virtual Nullable<double> ScalingAdjustment { get; set; }
Property Value
System.Nullable<System.Double>
StepAdjustments
A set of adjustments that enable you to scale based on the size of the alarm breach.
public virtual object StepAdjustments { get; set; }
Property Value
System.Object
TargetTrackingConfiguration
A target tracking scaling policy.
public virtual object TargetTrackingConfiguration { get; set; }
Property Value
System.Object
Remarks
Provides support for predefined or custom metrics.
Methods
Inspect(TreeInspector)
Examines the CloudFormation resource and discloses attributes.
public virtual void Inspect(TreeInspector inspector)
Parameters
- inspector TreeInspector
tree inspector to collect and process attributes.
RenderProperties(IDictionary<String, Object>)
protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)
Parameters
- props System.Collections.Generic.IDictionary<System.String, System.Object>
Returns
System.Collections.Generic.IDictionary<System.String, System.Object>