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.
Inherited Members
Namespace: Amazon.CDK.AWS.AutoScaling
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CfnScalingPolicy : CfnResource, IInspectable, IScalingPolicyRef, IConstruct, IDependable, IEnvironmentAware
Syntax (vb)
Public Class CfnScalingPolicy Inherits CfnResource Implements IInspectable, IScalingPolicyRef, IConstruct, IDependable, IEnvironmentAware
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 {
Dimensions = new [] { new MetricDimensionProperty {
Name = "name",
Value = "value"
} },
MetricName = "metricName",
Metrics = new [] { new TargetTrackingMetricDataQueryProperty {
Id = "id",
// the properties below are optional
Expression = "expression",
Label = "label",
MetricStat = new TargetTrackingMetricStatProperty {
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
Period = 123,
Unit = "unit"
},
Period = 123,
ReturnData = false
} },
Namespace = "namespace",
Period = 123,
Statistic = "statistic",
Unit = "unit"
},
DisableScaleIn = false,
PredefinedMetricSpecification = new PredefinedMetricSpecificationProperty {
PredefinedMetricType = "predefinedMetricType",
// the properties below are optional
ResourceLabel = "resourceLabel"
}
}
});
Synopsis
Constructors
| CfnScalingPolicy(Construct, string, ICfnScalingPolicyProps) | Create a new |
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 | The |
| 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. |
| ScalingPolicyRef | A reference to a ScalingPolicy resource. |
| 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
| ArnForScalingPolicy(IScalingPolicyRef) | The |
| Inspect(TreeInspector) | Examines the CloudFormation resource and discloses attributes. |
| IsCfnScalingPolicy(object) | Checks whether the given object is a CfnScalingPolicy. |
| RenderProperties(IDictionary<string, object>) | The |
Constructors
CfnScalingPolicy(Construct, string, ICfnScalingPolicyProps)
Create a new AWS::AutoScaling::ScalingPolicy.
public CfnScalingPolicy(Construct scope, string id, ICfnScalingPolicyProps props)
Parameters
- scope Construct
Scope in which this resource is defined.
- id string
Construct identifier for this resource (unique in its scope).
- props ICfnScalingPolicyProps
Resource properties.
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
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
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
AttrArn
Returns the ARN of a scaling policy.
public virtual string AttrArn { get; }
Property Value
Remarks
CloudformationAttribute: Arn
AttrPolicyName
Returns the name of a scaling policy.
public virtual string AttrPolicyName { get; }
Property Value
Remarks
CloudformationAttribute: PolicyName
AutoScalingGroupName
The name of the Auto Scaling group.
public virtual string AutoScalingGroupName { get; set; }
Property Value
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
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
public static string CFN_RESOURCE_TYPE_NAME { get; }
Property Value
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
CfnProperties
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.
protected override IDictionary<string, object> CfnProperties { get; }
Property Value
Overrides
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
Cooldown
A cooldown period, in seconds, that applies to a specific simple scaling policy.
public virtual string? Cooldown { get; set; }
Property Value
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
EstimatedInstanceWarmup
Not needed if the default instance warmup is defined for the group..
public virtual double? EstimatedInstanceWarmup { get; set; }
Property Value
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
MetricAggregationType
The aggregation type for the CloudWatch metrics.
public virtual string? MetricAggregationType { get; set; }
Property Value
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
MinAdjustmentMagnitude
The minimum value to scale by when the adjustment type is PercentChangeInCapacity .
public virtual double? MinAdjustmentMagnitude { get; set; }
Property Value
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
PolicyType
One of the following policy types:.
public virtual string? PolicyType { get; set; }
Property Value
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
PredictiveScalingConfiguration
A predictive scaling policy.
public virtual object? PredictiveScalingConfiguration { get; set; }
Property Value
Remarks
Provides support for predefined and custom metrics.
Type union: either IResolvable or CfnScalingPolicy.IPredictiveScalingConfigurationProperty
ScalingAdjustment
The amount by which to scale, based on the specified adjustment type.
public virtual double? ScalingAdjustment { get; set; }
Property Value
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
ScalingPolicyRef
A reference to a ScalingPolicy resource.
public virtual IScalingPolicyReference ScalingPolicyRef { get; }
Property Value
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
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
Remarks
Type union: either IResolvable or (either IResolvable or CfnScalingPolicy.IStepAdjustmentProperty)[]
TargetTrackingConfiguration
A target tracking scaling policy.
public virtual object? TargetTrackingConfiguration { get; set; }
Property Value
Remarks
Provides support for predefined or custom metrics.
Type union: either IResolvable or CfnScalingPolicy.ITargetTrackingConfigurationProperty
Methods
ArnForScalingPolicy(IScalingPolicyRef)
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.
public static string ArnForScalingPolicy(IScalingPolicyRef resource)
Parameters
- resource IScalingPolicyRef
Returns
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 {
Dimensions = new [] { new MetricDimensionProperty {
Name = "name",
Value = "value"
} },
MetricName = "metricName",
Metrics = new [] { new TargetTrackingMetricDataQueryProperty {
Id = "id",
// the properties below are optional
Expression = "expression",
Label = "label",
MetricStat = new TargetTrackingMetricStatProperty {
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
Period = 123,
Unit = "unit"
},
Period = 123,
ReturnData = false
} },
Namespace = "namespace",
Period = 123,
Statistic = "statistic",
Unit = "unit"
},
DisableScaleIn = false,
PredefinedMetricSpecification = new PredefinedMetricSpecificationProperty {
PredefinedMetricType = "predefinedMetricType",
// the properties below are optional
ResourceLabel = "resourceLabel"
}
}
});
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.
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
IsCfnScalingPolicy(object)
Checks whether the given object is a CfnScalingPolicy.
public static bool IsCfnScalingPolicy(object x)
Parameters
- x object
Returns
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
RenderProperties(IDictionary<string, object>)
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.
protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)
Parameters
- props IDictionary<string, object>
Returns
Overrides
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