CfnScalingPlan
- class aws_cdk.aws_autoscalingplans.CfnScalingPlan(scope, id, *, application_source, scaling_instructions)
Bases:
CfnResource
The
AWS::AutoScalingPlans::ScalingPlan
resource defines an AWS Auto Scaling scaling plan.A scaling plan is used to scale application resources to size them appropriately to ensure that enough resource is available in the application at peak times and to reduce allocated resource during periods of low utilization. The following resources can be added to a scaling plan:
Amazon EC2 Auto Scaling groups
Amazon EC2 Spot Fleet requests
Amazon ECS services
Amazon DynamoDB tables and global secondary indexes
Amazon Aurora Replicas
For more information, see the Scaling Plans User Guide
- See:
- CloudformationResource:
AWS::AutoScalingPlans::ScalingPlan
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_autoscalingplans as autoscalingplans cfn_scaling_plan = autoscalingplans.CfnScalingPlan(self, "MyCfnScalingPlan", application_source=autoscalingplans.CfnScalingPlan.ApplicationSourceProperty( cloud_formation_stack_arn="cloudFormationStackArn", tag_filters=[autoscalingplans.CfnScalingPlan.TagFilterProperty( key="key", # the properties below are optional values=["values"] )] ), scaling_instructions=[autoscalingplans.CfnScalingPlan.ScalingInstructionProperty( max_capacity=123, min_capacity=123, resource_id="resourceId", scalable_dimension="scalableDimension", service_namespace="serviceNamespace", target_tracking_configurations=[autoscalingplans.CfnScalingPlan.TargetTrackingConfigurationProperty( target_value=123, # the properties below are optional customized_scaling_metric_specification=autoscalingplans.CfnScalingPlan.CustomizedScalingMetricSpecificationProperty( metric_name="metricName", namespace="namespace", statistic="statistic", # the properties below are optional dimensions=[autoscalingplans.CfnScalingPlan.MetricDimensionProperty( name="name", value="value" )], unit="unit" ), disable_scale_in=False, estimated_instance_warmup=123, predefined_scaling_metric_specification=autoscalingplans.CfnScalingPlan.PredefinedScalingMetricSpecificationProperty( predefined_scaling_metric_type="predefinedScalingMetricType", # the properties below are optional resource_label="resourceLabel" ), scale_in_cooldown=123, scale_out_cooldown=123 )], # the properties below are optional customized_load_metric_specification=autoscalingplans.CfnScalingPlan.CustomizedLoadMetricSpecificationProperty( metric_name="metricName", namespace="namespace", statistic="statistic", # the properties below are optional dimensions=[autoscalingplans.CfnScalingPlan.MetricDimensionProperty( name="name", value="value" )], unit="unit" ), disable_dynamic_scaling=False, predefined_load_metric_specification=autoscalingplans.CfnScalingPlan.PredefinedLoadMetricSpecificationProperty( predefined_load_metric_type="predefinedLoadMetricType", # the properties below are optional resource_label="resourceLabel" ), predictive_scaling_max_capacity_behavior="predictiveScalingMaxCapacityBehavior", predictive_scaling_max_capacity_buffer=123, predictive_scaling_mode="predictiveScalingMode", scaling_policy_update_behavior="scalingPolicyUpdateBehavior", scheduled_action_buffer_time=123 )] )
- Parameters:
scope (
Construct
) – Scope in which this resource is defined.id (
str
) – Construct identifier for this resource (unique in its scope).application_source (
Union
[IResolvable
,ApplicationSourceProperty
,Dict
[str
,Any
]]) – A CloudFormation stack or a set of tags. You can create one scaling plan per application source. TheApplicationSource
property must be present to ensure interoperability with the AWS Auto Scaling console.scaling_instructions (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,ScalingInstructionProperty
,Dict
[str
,Any
]]]]) – The scaling instructions.
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_dependency(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- add_depends_on(target)
(deprecated) Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
- Parameters:
target (
CfnResource
) –- Deprecated:
use addDependency
- Stability:
deprecated
- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –value (
Any
) –
- See:
- Return type:
None
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT
). A list of resources that support this policy can be found in the following link:- Parameters:
policy (
Optional
[RemovalPolicy
]) –apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resource, please consult that specific resource’s documentation.
- See:
- Return type:
None
- get_att(attribute_name, type_hint=None)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.type_hint (
Optional
[ResolutionTypeHint
]) –
- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –- See:
- Return type:
Any
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) – tree inspector to collect and process attributes.- Return type:
None
- obtain_dependencies()
Retrieves an array of resources this resource depends on.
This assembles dependencies on resources across stacks (including nested stacks) automatically.
- Return type:
List
[Union
[Stack
,CfnResource
]]
- obtain_resource_dependencies()
Get a shallow copy of dependencies between this resource and other resources in the same stack.
- Return type:
List
[CfnResource
]
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- remove_dependency(target)
Indicates that this resource no longer depends on another resource.
This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- replace_dependency(target, new_target)
Replaces one dependency with another.
- Parameters:
target (
CfnResource
) – The dependency to replace.new_target (
CfnResource
) – The new dependency to add.
- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::AutoScalingPlans::ScalingPlan'
- application_source
A CloudFormation stack or a set of tags.
- attr_id
Id
- Type:
cloudformationAttribute
- attr_scaling_plan_name
ScalingPlanName
- Type:
cloudformationAttribute
- attr_scaling_plan_version
ScalingPlanVersion
- Type:
cloudformationAttribute
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- node
The tree node.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- scaling_instructions
The scaling instructions.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
) –- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(x)
Check whether the given object is a CfnResource.
- Parameters:
x (
Any
) –- Return type:
bool
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
ApplicationSourceProperty
- class CfnScalingPlan.ApplicationSourceProperty(*, cloud_formation_stack_arn=None, tag_filters=None)
Bases:
object
ApplicationSource
is a property of ScalingPlan that specifies the application source to use with a scaling plan. You can create one scaling plan per application source.- Parameters:
cloud_formation_stack_arn (
Optional
[str
]) – The Amazon Resource Name (ARN) of a CloudFormation stack. You must specify either aCloudFormationStackARN
orTagFilters
.tag_filters (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,TagFilterProperty
,Dict
[str
,Any
]]],None
]) – A set of tag filters (keys and values). Each tag filter specified must contain a key with values as optional. Each scaling plan can include up to 50 keys, and each key can include up to 20 values. Tags are part of the syntax that you use to specify the resources you want returned when configuring a scaling plan from the AWS Auto Scaling console. You do not need to specify valid tag filter values when you create a scaling plan with CloudFormation. TheKey
andValues
properties can accept any value as long as the combination of values is unique across scaling plans. However, if you also want to use the AWS Auto Scaling console to edit the scaling plan, then you must specify valid values. You must specify either aCloudFormationStackARN
orTagFilters
.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_autoscalingplans as autoscalingplans application_source_property = autoscalingplans.CfnScalingPlan.ApplicationSourceProperty( cloud_formation_stack_arn="cloudFormationStackArn", tag_filters=[autoscalingplans.CfnScalingPlan.TagFilterProperty( key="key", # the properties below are optional values=["values"] )] )
Attributes
- cloud_formation_stack_arn
The Amazon Resource Name (ARN) of a CloudFormation stack.
You must specify either a
CloudFormationStackARN
orTagFilters
.
- tag_filters
A set of tag filters (keys and values).
Each tag filter specified must contain a key with values as optional. Each scaling plan can include up to 50 keys, and each key can include up to 20 values.
Tags are part of the syntax that you use to specify the resources you want returned when configuring a scaling plan from the AWS Auto Scaling console. You do not need to specify valid tag filter values when you create a scaling plan with CloudFormation. The
Key
andValues
properties can accept any value as long as the combination of values is unique across scaling plans. However, if you also want to use the AWS Auto Scaling console to edit the scaling plan, then you must specify valid values.You must specify either a
CloudFormationStackARN
orTagFilters
.
CustomizedLoadMetricSpecificationProperty
- class CfnScalingPlan.CustomizedLoadMetricSpecificationProperty(*, metric_name, namespace, statistic, dimensions=None, unit=None)
Bases:
object
CustomizedLoadMetricSpecification
is a subproperty of ScalingInstruction that specifies a customized load metric for predictive scaling to use with a scaling plan.For predictive scaling to work with a customized load metric specification, AWS Auto Scaling needs access to the
Sum
andAverage
statistics that CloudWatch computes from metric data.When you choose a load metric, make sure that the required
Sum
andAverage
statistics for your metric are available in CloudWatch and that they provide relevant data for predictive scaling. TheSum
statistic must represent the total load on the resource, and theAverage
statistic must represent the average load per capacity unit of the resource. For example, there is a metric that counts the number of requests processed by your Auto Scaling group. If theSum
statistic represents the total request count processed by the group, then theAverage
statistic for the specified metric must represent the average request count processed by each instance of the group.If you publish your own metrics, you can aggregate the data points at a given interval and then publish the aggregated data points to CloudWatch. Before AWS Auto Scaling generates the forecast, it sums up all the metric data points that occurred within each hour to match the granularity period that is used in the forecast (60 minutes).
For information about terminology, available metrics, or how to publish new metrics, see Amazon CloudWatch Concepts in the Amazon CloudWatch User Guide .
After creating your scaling plan, you can use the AWS Auto Scaling console to visualize forecasts for the specified metric. For more information, see View scaling information for a resource in the Scaling Plans User Guide .
- Parameters:
metric_name (
str
) – The name of the metric.namespace (
str
) – The namespace of the metric.statistic (
str
) – The statistic of the metric. Allowed Values :Sum
dimensions (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,MetricDimensionProperty
,Dict
[str
,Any
]]],None
]) – The dimensions of the metric. Conditional: If you published your metric with dimensions, you must specify the same dimensions in your customized load metric specification.unit (
Optional
[str
]) – The unit of the metric.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_autoscalingplans as autoscalingplans customized_load_metric_specification_property = autoscalingplans.CfnScalingPlan.CustomizedLoadMetricSpecificationProperty( metric_name="metricName", namespace="namespace", statistic="statistic", # the properties below are optional dimensions=[autoscalingplans.CfnScalingPlan.MetricDimensionProperty( name="name", value="value" )], unit="unit" )
Attributes
- dimensions
The dimensions of the metric.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your customized load metric specification.
- metric_name
The name of the metric.
- namespace
The namespace of the metric.
- statistic
The statistic of the metric.
Allowed Values :
Sum
CustomizedScalingMetricSpecificationProperty
- class CfnScalingPlan.CustomizedScalingMetricSpecificationProperty(*, metric_name, namespace, statistic, dimensions=None, unit=None)
Bases:
object
CustomizedScalingMetricSpecification
is a subproperty of TargetTrackingConfiguration that specifies a customized scaling metric for a target tracking configuration to use with a scaling plan.To create your customized scaling metric specification:
Add values for each required property from CloudWatch. You can use an existing metric, or a new metric that you create. To use your own metric, you must first publish the metric to CloudWatch. For more information, see Publish Custom Metrics in the Amazon CloudWatch User Guide .
Choose a metric that changes proportionally with capacity. The value of the metric should increase or decrease in inverse proportion to the number of capacity units. That is, the value of the metric should decrease when capacity increases.
For information about terminology, available metrics, or how to publish new metrics, see Amazon CloudWatch Concepts in the Amazon CloudWatch User Guide .
- Parameters:
metric_name (
str
) – The name of the metric. To get the exact metric name, namespace, and dimensions, inspect the Metrics object that is returned by a call to ListMetrics .namespace (
str
) – The namespace of the metric.statistic (
str
) – The statistic of the metric.dimensions (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,MetricDimensionProperty
,Dict
[str
,Any
]]],None
]) – The dimensions of the metric. Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.unit (
Optional
[str
]) – The unit of the metric. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference .
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_autoscalingplans as autoscalingplans customized_scaling_metric_specification_property = autoscalingplans.CfnScalingPlan.CustomizedScalingMetricSpecificationProperty( metric_name="metricName", namespace="namespace", statistic="statistic", # the properties below are optional dimensions=[autoscalingplans.CfnScalingPlan.MetricDimensionProperty( name="name", value="value" )], unit="unit" )
Attributes
- dimensions
The dimensions of the metric.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
- metric_name
The name of the metric.
To get the exact metric name, namespace, and dimensions, inspect the Metrics object that is returned by a call to ListMetrics .
- namespace
The namespace of the metric.
- statistic
The statistic of the metric.
- unit
The unit of the metric.
For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference .
MetricDimensionProperty
- class CfnScalingPlan.MetricDimensionProperty(*, name, value)
Bases:
object
MetricDimension
is a subproperty of CustomizedScalingMetricSpecification that specifies a dimension for a customized metric to use with a scaling plan. Dimensions are arbitrary name/value pairs that can be associated with a CloudWatch metric. Duplicate dimensions are not allowed.- Parameters:
name (
str
) – The name of the dimension.value (
str
) – The value of the dimension.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_autoscalingplans as autoscalingplans metric_dimension_property = autoscalingplans.CfnScalingPlan.MetricDimensionProperty( name="name", value="value" )
Attributes
- name
The name of the dimension.
PredefinedLoadMetricSpecificationProperty
- class CfnScalingPlan.PredefinedLoadMetricSpecificationProperty(*, predefined_load_metric_type, resource_label=None)
Bases:
object
PredefinedLoadMetricSpecification
is a subproperty of ScalingInstruction that specifies a predefined load metric for predictive scaling to use with a scaling plan.After creating your scaling plan, you can use the AWS Auto Scaling console to visualize forecasts for the specified metric. For more information, see View scaling information for a resource in the Scaling Plans User Guide .
- Parameters:
predefined_load_metric_type (
str
) – The metric type.resource_label (
Optional
[str
]) – Identifies the resource associated with the metric type. You can’t specify a resource label unless the metric type isALBTargetGroupRequestCount
and there is a target group for an Application Load Balancer attached to the Auto Scaling group. You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format is app///targetgroup//, where: - app// is the final portion of the load balancer ARN - targetgroup// is the final portion of the target group ARN. This is an example: app/EC2Co-EcsEl-1TKLTMITMM0EO/f37c06a68c1748aa/targetgroup/EC2Co-Defau-LDNM7Q3ZH1ZN/6d4ea56ca2d6a18d. To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_autoscalingplans as autoscalingplans predefined_load_metric_specification_property = autoscalingplans.CfnScalingPlan.PredefinedLoadMetricSpecificationProperty( predefined_load_metric_type="predefinedLoadMetricType", # the properties below are optional resource_label="resourceLabel" )
Attributes
- predefined_load_metric_type
The metric type.
- resource_label
Identifies the resource associated with the metric type.
You can’t specify a resource label unless the metric type is
ALBTargetGroupRequestCount
and there is a target group for an Application Load Balancer attached to the Auto Scaling group.You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format is app///targetgroup//, where:
app// is the final portion of the load balancer ARN
targetgroup// is the final portion of the target group ARN.
This is an example: app/EC2Co-EcsEl-1TKLTMITMM0EO/f37c06a68c1748aa/targetgroup/EC2Co-Defau-LDNM7Q3ZH1ZN/6d4ea56ca2d6a18d.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
PredefinedScalingMetricSpecificationProperty
- class CfnScalingPlan.PredefinedScalingMetricSpecificationProperty(*, predefined_scaling_metric_type, resource_label=None)
Bases:
object
PredefinedScalingMetricSpecification
is a subproperty of TargetTrackingConfiguration that specifies a customized scaling metric for a target tracking configuration to use with a scaling plan.- Parameters:
predefined_scaling_metric_type (
str
) – The metric type. TheALBRequestCountPerTarget
metric type applies only to Auto Scaling groups, Spot Fleet requests, and ECS services.resource_label (
Optional
[str
]) –Identifies the resource associated with the metric type. You can’t specify a resource label unless the metric type is
ALBRequestCountPerTarget
and there is a target group for an Application Load Balancer attached to the Auto Scaling group, Spot Fleet request, or ECS service. You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format is app///targetgroup//, where: - app// is the final portion of the load balancer ARN - targetgroup// is the final portion of the target group ARN. This is an example: app/EC2Co-EcsEl-1TKLTMITMM0EO/f37c06a68c1748aa/targetgroup/EC2Co-Defau-LDNM7Q3ZH1ZN/6d4ea56ca2d6a18d. To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_autoscalingplans as autoscalingplans predefined_scaling_metric_specification_property = autoscalingplans.CfnScalingPlan.PredefinedScalingMetricSpecificationProperty( predefined_scaling_metric_type="predefinedScalingMetricType", # the properties below are optional resource_label="resourceLabel" )
Attributes
- predefined_scaling_metric_type
The metric type.
The
ALBRequestCountPerTarget
metric type applies only to Auto Scaling groups, Spot Fleet requests, and ECS services.
- resource_label
Identifies the resource associated with the metric type.
You can’t specify a resource label unless the metric type is
ALBRequestCountPerTarget
and there is a target group for an Application Load Balancer attached to the Auto Scaling group, Spot Fleet request, or ECS service.You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format is app///targetgroup//, where:
app// is the final portion of the load balancer ARN
targetgroup// is the final portion of the target group ARN.
This is an example: app/EC2Co-EcsEl-1TKLTMITMM0EO/f37c06a68c1748aa/targetgroup/EC2Co-Defau-LDNM7Q3ZH1ZN/6d4ea56ca2d6a18d.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
ScalingInstructionProperty
- class CfnScalingPlan.ScalingInstructionProperty(*, max_capacity, min_capacity, resource_id, scalable_dimension, service_namespace, target_tracking_configurations, customized_load_metric_specification=None, disable_dynamic_scaling=None, predefined_load_metric_specification=None, predictive_scaling_max_capacity_behavior=None, predictive_scaling_max_capacity_buffer=None, predictive_scaling_mode=None, scaling_policy_update_behavior=None, scheduled_action_buffer_time=None)
Bases:
object
ScalingInstruction
is a property of ScalingPlan that specifies the scaling instruction for a scalable resource in a scaling plan. Each scaling instruction applies to one resource.AWS Auto Scaling creates target tracking scaling policies based on the scaling instructions. Target tracking scaling policies adjust the capacity of your scalable resource as required to maintain resource utilization at the target value that you specified.
AWS Auto Scaling also configures predictive scaling for your Amazon EC2 Auto Scaling groups using a subset of properties, including the load metric, the scaling metric, the target value for the scaling metric, the predictive scaling mode (forecast and scale or forecast only), and the desired behavior when the forecast capacity exceeds the maximum capacity of the resource. With predictive scaling, AWS Auto Scaling generates forecasts with traffic predictions for the two days ahead and schedules scaling actions that proactively add and remove resource capacity to match the forecast. .. epigraph:
We recommend waiting a minimum of 24 hours after creating an Auto Scaling group to configure predictive scaling. At minimum, there must be 24 hours of historical data to generate a forecast. For more information, see `Best practices for scaling plans <https://docs.aws.amazon.com/autoscaling/plans/userguide/gs-best-practices.html>`_ in the *Scaling Plans User Guide* .
- Parameters:
max_capacity (
Union
[int
,float
]) – The maximum capacity of the resource. The exception to this upper limit is if you specify a non-default setting for PredictiveScalingMaxCapacityBehavior .min_capacity (
Union
[int
,float
]) – The minimum capacity of the resource.resource_id (
str
) – The ID of the resource. This string consists of the resource type and unique identifier. - Auto Scaling group - The resource type isautoScalingGroup
and the unique identifier is the name of the Auto Scaling group. Example:autoScalingGroup/my-asg
. - ECS service - The resource type isservice
and the unique identifier is the cluster name and service name. Example:service/default/sample-webapp
. - Spot Fleet request - The resource type isspot-fleet-request
and the unique identifier is the Spot Fleet request ID. Example:spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE
. - DynamoDB table - The resource type istable
and the unique identifier is the resource ID. Example:table/my-table
. - DynamoDB global secondary index - The resource type isindex
and the unique identifier is the resource ID. Example:table/my-table/index/my-table-index
. - Aurora DB cluster - The resource type iscluster
and the unique identifier is the cluster name. Example:cluster:my-db-cluster
.scalable_dimension (
str
) – The scalable dimension associated with the resource. -autoscaling:autoScalingGroup:DesiredCapacity
- The desired capacity of an Auto Scaling group. -ecs:service:DesiredCount
- The desired task count of an ECS service. -ec2:spot-fleet-request:TargetCapacity
- The target capacity of a Spot Fleet request. -dynamodb:table:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB table. -dynamodb:table:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB table. -dynamodb:index:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB global secondary index. -dynamodb:index:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB global secondary index. -rds:cluster:ReadReplicaCount
- The count of Aurora Replicas in an Aurora DB cluster. Available for Aurora MySQL-compatible edition and Aurora PostgreSQL-compatible edition.service_namespace (
str
) – The namespace of the AWS service.target_tracking_configurations (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,TargetTrackingConfigurationProperty
,Dict
[str
,Any
]]]]) – The target tracking configurations (up to 10). Each of these structures must specify a unique scaling metric and a target value for the metric.customized_load_metric_specification (
Union
[IResolvable
,CustomizedLoadMetricSpecificationProperty
,Dict
[str
,Any
],None
]) – The customized load metric to use for predictive scaling. This property or a PredefinedLoadMetricSpecification is required when configuring predictive scaling, and cannot be used otherwise.disable_dynamic_scaling (
Union
[bool
,IResolvable
,None
]) – Controls whether dynamic scaling is disabled. When dynamic scaling is enabled, AWS Auto Scaling creates target tracking scaling policies based on the specified target tracking configurations. The default is enabled (false
).predefined_load_metric_specification (
Union
[IResolvable
,PredefinedLoadMetricSpecificationProperty
,Dict
[str
,Any
],None
]) – The predefined load metric to use for predictive scaling. This property or a CustomizedLoadMetricSpecification is required when configuring predictive scaling, and cannot be used otherwise.predictive_scaling_max_capacity_behavior (
Optional
[str
]) – Defines the behavior that should be applied if the forecast capacity approaches or exceeds the maximum capacity specified for the resource. The default value isSetForecastCapacityToMaxCapacity
. The following are possible values: -SetForecastCapacityToMaxCapacity
- AWS Auto Scaling cannot scale resource capacity higher than the maximum capacity. The maximum capacity is enforced as a hard limit. -SetMaxCapacityToForecastCapacity
- AWS Auto Scaling can scale resource capacity higher than the maximum capacity to equal but not exceed forecast capacity. -SetMaxCapacityAboveForecastCapacity
- AWS Auto Scaling can scale resource capacity higher than the maximum capacity by a specified buffer value. The intention is to give the target tracking scaling policy extra capacity if unexpected traffic occurs. Valid only when configuring predictive scaling.predictive_scaling_max_capacity_buffer (
Union
[int
,float
,None
]) – The size of the capacity buffer to use when the forecast capacity is close to or exceeds the maximum capacity. The value is specified as a percentage relative to the forecast capacity. For example, if the buffer is 10, this means a 10 percent buffer. With a 10 percent buffer, if the forecast capacity is 50, and the maximum capacity is 40, then the effective maximum capacity is 55. Valid only when configuring predictive scaling. Required if PredictiveScalingMaxCapacityBehavior is set toSetMaxCapacityAboveForecastCapacity
, and cannot be used otherwise. The range is 1-100.predictive_scaling_mode (
Optional
[str
]) – The predictive scaling mode. The default value isForecastAndScale
. Otherwise, AWS Auto Scaling forecasts capacity but does not apply any scheduled scaling actions based on the capacity forecast.scaling_policy_update_behavior (
Optional
[str
]) – Controls whether a resource’s externally created scaling policies are deleted and new target tracking scaling policies created. The default value isKeepExternalPolicies
. Valid only when configuring dynamic scaling.scheduled_action_buffer_time (
Union
[int
,float
,None
]) – The amount of time, in seconds, to buffer the run time of scheduled scaling actions when scaling out. For example, if the forecast says to add capacity at 10:00 AM, and the buffer time is 5 minutes, then the run time of the corresponding scheduled scaling action will be 9:55 AM. The intention is to give resources time to be provisioned. For example, it can take a few minutes to launch an EC2 instance. The actual amount of time required depends on several factors, such as the size of the instance and whether there are startup scripts to complete. The value must be less than the forecast interval duration of 3600 seconds (60 minutes). The default is 300 seconds. Valid only when configuring predictive scaling.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_autoscalingplans as autoscalingplans scaling_instruction_property = autoscalingplans.CfnScalingPlan.ScalingInstructionProperty( max_capacity=123, min_capacity=123, resource_id="resourceId", scalable_dimension="scalableDimension", service_namespace="serviceNamespace", target_tracking_configurations=[autoscalingplans.CfnScalingPlan.TargetTrackingConfigurationProperty( target_value=123, # the properties below are optional customized_scaling_metric_specification=autoscalingplans.CfnScalingPlan.CustomizedScalingMetricSpecificationProperty( metric_name="metricName", namespace="namespace", statistic="statistic", # the properties below are optional dimensions=[autoscalingplans.CfnScalingPlan.MetricDimensionProperty( name="name", value="value" )], unit="unit" ), disable_scale_in=False, estimated_instance_warmup=123, predefined_scaling_metric_specification=autoscalingplans.CfnScalingPlan.PredefinedScalingMetricSpecificationProperty( predefined_scaling_metric_type="predefinedScalingMetricType", # the properties below are optional resource_label="resourceLabel" ), scale_in_cooldown=123, scale_out_cooldown=123 )], # the properties below are optional customized_load_metric_specification=autoscalingplans.CfnScalingPlan.CustomizedLoadMetricSpecificationProperty( metric_name="metricName", namespace="namespace", statistic="statistic", # the properties below are optional dimensions=[autoscalingplans.CfnScalingPlan.MetricDimensionProperty( name="name", value="value" )], unit="unit" ), disable_dynamic_scaling=False, predefined_load_metric_specification=autoscalingplans.CfnScalingPlan.PredefinedLoadMetricSpecificationProperty( predefined_load_metric_type="predefinedLoadMetricType", # the properties below are optional resource_label="resourceLabel" ), predictive_scaling_max_capacity_behavior="predictiveScalingMaxCapacityBehavior", predictive_scaling_max_capacity_buffer=123, predictive_scaling_mode="predictiveScalingMode", scaling_policy_update_behavior="scalingPolicyUpdateBehavior", scheduled_action_buffer_time=123 )
Attributes
- customized_load_metric_specification
The customized load metric to use for predictive scaling.
This property or a PredefinedLoadMetricSpecification is required when configuring predictive scaling, and cannot be used otherwise.
- disable_dynamic_scaling
Controls whether dynamic scaling is disabled.
When dynamic scaling is enabled, AWS Auto Scaling creates target tracking scaling policies based on the specified target tracking configurations.
The default is enabled (
false
).
- max_capacity
The maximum capacity of the resource.
The exception to this upper limit is if you specify a non-default setting for PredictiveScalingMaxCapacityBehavior .
- min_capacity
The minimum capacity of the resource.
- predefined_load_metric_specification
The predefined load metric to use for predictive scaling.
This property or a CustomizedLoadMetricSpecification is required when configuring predictive scaling, and cannot be used otherwise.
- predictive_scaling_max_capacity_behavior
Defines the behavior that should be applied if the forecast capacity approaches or exceeds the maximum capacity specified for the resource.
The default value is
SetForecastCapacityToMaxCapacity
.The following are possible values:
SetForecastCapacityToMaxCapacity
- AWS Auto Scaling cannot scale resource capacity higher than the maximum capacity. The maximum capacity is enforced as a hard limit.SetMaxCapacityToForecastCapacity
- AWS Auto Scaling can scale resource capacity higher than the maximum capacity to equal but not exceed forecast capacity.SetMaxCapacityAboveForecastCapacity
- AWS Auto Scaling can scale resource capacity higher than the maximum capacity by a specified buffer value. The intention is to give the target tracking scaling policy extra capacity if unexpected traffic occurs.
Valid only when configuring predictive scaling.
- predictive_scaling_max_capacity_buffer
The size of the capacity buffer to use when the forecast capacity is close to or exceeds the maximum capacity.
The value is specified as a percentage relative to the forecast capacity. For example, if the buffer is 10, this means a 10 percent buffer. With a 10 percent buffer, if the forecast capacity is 50, and the maximum capacity is 40, then the effective maximum capacity is 55.
Valid only when configuring predictive scaling. Required if PredictiveScalingMaxCapacityBehavior is set to
SetMaxCapacityAboveForecastCapacity
, and cannot be used otherwise.The range is 1-100.
- predictive_scaling_mode
The predictive scaling mode.
The default value is
ForecastAndScale
. Otherwise, AWS Auto Scaling forecasts capacity but does not apply any scheduled scaling actions based on the capacity forecast.
- resource_id
The ID of the resource. This string consists of the resource type and unique identifier.
Auto Scaling group - The resource type is
autoScalingGroup
and the unique identifier is the name of the Auto Scaling group. Example:autoScalingGroup/my-asg
.ECS service - The resource type is
service
and the unique identifier is the cluster name and service name. Example:service/default/sample-webapp
.Spot Fleet request - The resource type is
spot-fleet-request
and the unique identifier is the Spot Fleet request ID. Example:spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE
.DynamoDB table - The resource type is
table
and the unique identifier is the resource ID. Example:table/my-table
.DynamoDB global secondary index - The resource type is
index
and the unique identifier is the resource ID. Example:table/my-table/index/my-table-index
.Aurora DB cluster - The resource type is
cluster
and the unique identifier is the cluster name. Example:cluster:my-db-cluster
.
- scalable_dimension
The scalable dimension associated with the resource.
autoscaling:autoScalingGroup:DesiredCapacity
- The desired capacity of an Auto Scaling group.ecs:service:DesiredCount
- The desired task count of an ECS service.ec2:spot-fleet-request:TargetCapacity
- The target capacity of a Spot Fleet request.dynamodb:table:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB table.dynamodb:table:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB table.dynamodb:index:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB global secondary index.dynamodb:index:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB global secondary index.rds:cluster:ReadReplicaCount
- The count of Aurora Replicas in an Aurora DB cluster. Available for Aurora MySQL-compatible edition and Aurora PostgreSQL-compatible edition.
- scaling_policy_update_behavior
Controls whether a resource’s externally created scaling policies are deleted and new target tracking scaling policies created.
The default value is
KeepExternalPolicies
.Valid only when configuring dynamic scaling.
- scheduled_action_buffer_time
The amount of time, in seconds, to buffer the run time of scheduled scaling actions when scaling out.
For example, if the forecast says to add capacity at 10:00 AM, and the buffer time is 5 minutes, then the run time of the corresponding scheduled scaling action will be 9:55 AM. The intention is to give resources time to be provisioned. For example, it can take a few minutes to launch an EC2 instance. The actual amount of time required depends on several factors, such as the size of the instance and whether there are startup scripts to complete.
The value must be less than the forecast interval duration of 3600 seconds (60 minutes). The default is 300 seconds.
Valid only when configuring predictive scaling.
- service_namespace
The namespace of the AWS service.
- target_tracking_configurations
The target tracking configurations (up to 10).
Each of these structures must specify a unique scaling metric and a target value for the metric.
TagFilterProperty
- class CfnScalingPlan.TagFilterProperty(*, key, values=None)
Bases:
object
TagFilter
is a subproperty of ApplicationSource that specifies a tag for an application source to use with a scaling plan.- Parameters:
key (
str
) – The tag key.values (
Optional
[Sequence
[str
]]) – The tag values (0 to 20).
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_autoscalingplans as autoscalingplans tag_filter_property = autoscalingplans.CfnScalingPlan.TagFilterProperty( key="key", # the properties below are optional values=["values"] )
Attributes
- key
The tag key.
TargetTrackingConfigurationProperty
- class CfnScalingPlan.TargetTrackingConfigurationProperty(*, target_value, customized_scaling_metric_specification=None, disable_scale_in=None, estimated_instance_warmup=None, predefined_scaling_metric_specification=None, scale_in_cooldown=None, scale_out_cooldown=None)
Bases:
object
TargetTrackingConfiguration
is a subproperty of ScalingInstruction that specifies a target tracking configuration for a scalable resource.- Parameters:
target_value (
Union
[int
,float
]) – The target value for the metric. Although this property accepts numbers of type Double, it won’t accept values that are either too small or too large. Values must be in the range of -2^360 to 2^360.customized_scaling_metric_specification (
Union
[IResolvable
,CustomizedScalingMetricSpecificationProperty
,Dict
[str
,Any
],None
]) – A customized metric. You can specify either a predefined metric or a customized metric.disable_scale_in (
Union
[bool
,IResolvable
,None
]) – Indicates whether scale in by the target tracking scaling policy is disabled. If the value istrue
, scale in is disabled and the target tracking scaling policy doesn’t remove capacity from the scalable resource. Otherwise, scale in is enabled and the target tracking scaling policy can remove capacity from the scalable resource. The default value isfalse
.estimated_instance_warmup (
Union
[int
,float
,None
]) – The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. This value is used only if the resource is an Auto Scaling group.predefined_scaling_metric_specification (
Union
[IResolvable
,PredefinedScalingMetricSpecificationProperty
,Dict
[str
,Any
],None
]) – A predefined metric. You can specify either a predefined metric or a customized metric.scale_in_cooldown (
Union
[int
,float
,None
]) – The amount of time, in seconds, after a scale-in activity completes before another scale in activity can start. This value is not used if the scalable resource is an Auto Scaling group.scale_out_cooldown (
Union
[int
,float
,None
]) – The amount of time, in seconds, after a scale-out activity completes before another scale-out activity can start. This value is not used if the scalable resource is an Auto Scaling group.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_autoscalingplans as autoscalingplans target_tracking_configuration_property = autoscalingplans.CfnScalingPlan.TargetTrackingConfigurationProperty( target_value=123, # the properties below are optional customized_scaling_metric_specification=autoscalingplans.CfnScalingPlan.CustomizedScalingMetricSpecificationProperty( metric_name="metricName", namespace="namespace", statistic="statistic", # the properties below are optional dimensions=[autoscalingplans.CfnScalingPlan.MetricDimensionProperty( name="name", value="value" )], unit="unit" ), disable_scale_in=False, estimated_instance_warmup=123, predefined_scaling_metric_specification=autoscalingplans.CfnScalingPlan.PredefinedScalingMetricSpecificationProperty( predefined_scaling_metric_type="predefinedScalingMetricType", # the properties below are optional resource_label="resourceLabel" ), scale_in_cooldown=123, scale_out_cooldown=123 )
Attributes
- customized_scaling_metric_specification
A customized metric.
You can specify either a predefined metric or a customized metric.
- disable_scale_in
Indicates whether scale in by the target tracking scaling policy is disabled.
If the value is
true
, scale in is disabled and the target tracking scaling policy doesn’t remove capacity from the scalable resource. Otherwise, scale in is enabled and the target tracking scaling policy can remove capacity from the scalable resource.The default value is
false
.
- estimated_instance_warmup
The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.
This value is used only if the resource is an Auto Scaling group.
- predefined_scaling_metric_specification
A predefined metric.
You can specify either a predefined metric or a customized metric.
- scale_in_cooldown
The amount of time, in seconds, after a scale-in activity completes before another scale in activity can start.
This value is not used if the scalable resource is an Auto Scaling group.
- scale_out_cooldown
The amount of time, in seconds, after a scale-out activity completes before another scale-out activity can start.
This value is not used if the scalable resource is an Auto Scaling group.
- target_value
The target value for the metric.
Although this property accepts numbers of type Double, it won’t accept values that are either too small or too large. Values must be in the range of -2^360 to 2^360.