/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include #include #include #include #include #include #include #include #include namespace Aws { namespace Utils { namespace Xml { class XmlNode; } // namespace Xml } // namespace Utils namespace AutoScaling { namespace Model { /** *

This structure specifies the metrics and target utilization settings for a * predictive scaling policy.

You must specify either a metric pair, or a * load metric and a scaling metric individually. Specifying a metric pair instead * of individual metrics provides a simpler way to configure metrics for a scaling * policy. You choose the metric pair, and the policy automatically knows the * correct sum and average statistics to use for the load metric and the scaling * metric.

Example

  • You create a predictive scaling policy * and specify ALBRequestCount as the value for the metric pair and * 1000.0 as the target value. For this type of metric, you must * provide the metric dimension for the corresponding target group, so you also * provide a resource label for the Application Load Balancer target group that is * attached to your Auto Scaling group.

  • The number of requests * the target group receives per minute provides the load metric, and the request * count averaged between the members of the target group provides the scaling * metric. In CloudWatch, this refers to the RequestCount and * RequestCountPerTarget metrics, respectively.

  • For * optimal use of predictive scaling, you adhere to the best practice of using a * dynamic scaling policy to automatically scale between the minimum capacity and * maximum capacity in response to real-time changes in resource utilization.

    *
  • Amazon EC2 Auto Scaling consumes data points for the load metric * over the last 14 days and creates an hourly load forecast for predictive * scaling. (A minimum of 24 hours of data is required.)

  • After * creating the load forecast, Amazon EC2 Auto Scaling determines when to reduce or * increase the capacity of your Auto Scaling group in each hour of the forecast * period so that the average number of requests received by each instance is as * close to 1000 requests per minute as possible at all times.

*

For information about using custom metrics with predictive scaling, see Advanced * predictive scaling policy configurations using custom metrics in the * Amazon EC2 Auto Scaling User Guide.

See Also:

AWS * API Reference

*/ class PredictiveScalingMetricSpecification { public: AWS_AUTOSCALING_API PredictiveScalingMetricSpecification(); AWS_AUTOSCALING_API PredictiveScalingMetricSpecification(const Aws::Utils::Xml::XmlNode& xmlNode); AWS_AUTOSCALING_API PredictiveScalingMetricSpecification& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); AWS_AUTOSCALING_API void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const; AWS_AUTOSCALING_API void OutputToStream(Aws::OStream& oStream, const char* location) const; /** *

Specifies the target utilization.

Some metrics are based on a * count instead of a percentage, such as the request count for an Application Load * Balancer or the number of messages in an SQS queue. If the scaling policy * specifies one of these metrics, specify the target utilization as the optimal * average request or message count per instance during any one-minute interval. *

*/ inline double GetTargetValue() const{ return m_targetValue; } /** *

Specifies the target utilization.

Some metrics are based on a * count instead of a percentage, such as the request count for an Application Load * Balancer or the number of messages in an SQS queue. If the scaling policy * specifies one of these metrics, specify the target utilization as the optimal * average request or message count per instance during any one-minute interval. *

*/ inline bool TargetValueHasBeenSet() const { return m_targetValueHasBeenSet; } /** *

Specifies the target utilization.

Some metrics are based on a * count instead of a percentage, such as the request count for an Application Load * Balancer or the number of messages in an SQS queue. If the scaling policy * specifies one of these metrics, specify the target utilization as the optimal * average request or message count per instance during any one-minute interval. *

*/ inline void SetTargetValue(double value) { m_targetValueHasBeenSet = true; m_targetValue = value; } /** *

Specifies the target utilization.

Some metrics are based on a * count instead of a percentage, such as the request count for an Application Load * Balancer or the number of messages in an SQS queue. If the scaling policy * specifies one of these metrics, specify the target utilization as the optimal * average request or message count per instance during any one-minute interval. *

*/ inline PredictiveScalingMetricSpecification& WithTargetValue(double value) { SetTargetValue(value); return *this;} /** *

The predefined metric pair specification from which Amazon EC2 Auto Scaling * determines the appropriate scaling metric and load metric to use.

*/ inline const PredictiveScalingPredefinedMetricPair& GetPredefinedMetricPairSpecification() const{ return m_predefinedMetricPairSpecification; } /** *

The predefined metric pair specification from which Amazon EC2 Auto Scaling * determines the appropriate scaling metric and load metric to use.

*/ inline bool PredefinedMetricPairSpecificationHasBeenSet() const { return m_predefinedMetricPairSpecificationHasBeenSet; } /** *

The predefined metric pair specification from which Amazon EC2 Auto Scaling * determines the appropriate scaling metric and load metric to use.

*/ inline void SetPredefinedMetricPairSpecification(const PredictiveScalingPredefinedMetricPair& value) { m_predefinedMetricPairSpecificationHasBeenSet = true; m_predefinedMetricPairSpecification = value; } /** *

The predefined metric pair specification from which Amazon EC2 Auto Scaling * determines the appropriate scaling metric and load metric to use.

*/ inline void SetPredefinedMetricPairSpecification(PredictiveScalingPredefinedMetricPair&& value) { m_predefinedMetricPairSpecificationHasBeenSet = true; m_predefinedMetricPairSpecification = std::move(value); } /** *

The predefined metric pair specification from which Amazon EC2 Auto Scaling * determines the appropriate scaling metric and load metric to use.

*/ inline PredictiveScalingMetricSpecification& WithPredefinedMetricPairSpecification(const PredictiveScalingPredefinedMetricPair& value) { SetPredefinedMetricPairSpecification(value); return *this;} /** *

The predefined metric pair specification from which Amazon EC2 Auto Scaling * determines the appropriate scaling metric and load metric to use.

*/ inline PredictiveScalingMetricSpecification& WithPredefinedMetricPairSpecification(PredictiveScalingPredefinedMetricPair&& value) { SetPredefinedMetricPairSpecification(std::move(value)); return *this;} /** *

The predefined scaling metric specification.

*/ inline const PredictiveScalingPredefinedScalingMetric& GetPredefinedScalingMetricSpecification() const{ return m_predefinedScalingMetricSpecification; } /** *

The predefined scaling metric specification.

*/ inline bool PredefinedScalingMetricSpecificationHasBeenSet() const { return m_predefinedScalingMetricSpecificationHasBeenSet; } /** *

The predefined scaling metric specification.

*/ inline void SetPredefinedScalingMetricSpecification(const PredictiveScalingPredefinedScalingMetric& value) { m_predefinedScalingMetricSpecificationHasBeenSet = true; m_predefinedScalingMetricSpecification = value; } /** *

The predefined scaling metric specification.

*/ inline void SetPredefinedScalingMetricSpecification(PredictiveScalingPredefinedScalingMetric&& value) { m_predefinedScalingMetricSpecificationHasBeenSet = true; m_predefinedScalingMetricSpecification = std::move(value); } /** *

The predefined scaling metric specification.

*/ inline PredictiveScalingMetricSpecification& WithPredefinedScalingMetricSpecification(const PredictiveScalingPredefinedScalingMetric& value) { SetPredefinedScalingMetricSpecification(value); return *this;} /** *

The predefined scaling metric specification.

*/ inline PredictiveScalingMetricSpecification& WithPredefinedScalingMetricSpecification(PredictiveScalingPredefinedScalingMetric&& value) { SetPredefinedScalingMetricSpecification(std::move(value)); return *this;} /** *

The predefined load metric specification.

*/ inline const PredictiveScalingPredefinedLoadMetric& GetPredefinedLoadMetricSpecification() const{ return m_predefinedLoadMetricSpecification; } /** *

The predefined load metric specification.

*/ inline bool PredefinedLoadMetricSpecificationHasBeenSet() const { return m_predefinedLoadMetricSpecificationHasBeenSet; } /** *

The predefined load metric specification.

*/ inline void SetPredefinedLoadMetricSpecification(const PredictiveScalingPredefinedLoadMetric& value) { m_predefinedLoadMetricSpecificationHasBeenSet = true; m_predefinedLoadMetricSpecification = value; } /** *

The predefined load metric specification.

*/ inline void SetPredefinedLoadMetricSpecification(PredictiveScalingPredefinedLoadMetric&& value) { m_predefinedLoadMetricSpecificationHasBeenSet = true; m_predefinedLoadMetricSpecification = std::move(value); } /** *

The predefined load metric specification.

*/ inline PredictiveScalingMetricSpecification& WithPredefinedLoadMetricSpecification(const PredictiveScalingPredefinedLoadMetric& value) { SetPredefinedLoadMetricSpecification(value); return *this;} /** *

The predefined load metric specification.

*/ inline PredictiveScalingMetricSpecification& WithPredefinedLoadMetricSpecification(PredictiveScalingPredefinedLoadMetric&& value) { SetPredefinedLoadMetricSpecification(std::move(value)); return *this;} /** *

The customized scaling metric specification.

*/ inline const PredictiveScalingCustomizedScalingMetric& GetCustomizedScalingMetricSpecification() const{ return m_customizedScalingMetricSpecification; } /** *

The customized scaling metric specification.

*/ inline bool CustomizedScalingMetricSpecificationHasBeenSet() const { return m_customizedScalingMetricSpecificationHasBeenSet; } /** *

The customized scaling metric specification.

*/ inline void SetCustomizedScalingMetricSpecification(const PredictiveScalingCustomizedScalingMetric& value) { m_customizedScalingMetricSpecificationHasBeenSet = true; m_customizedScalingMetricSpecification = value; } /** *

The customized scaling metric specification.

*/ inline void SetCustomizedScalingMetricSpecification(PredictiveScalingCustomizedScalingMetric&& value) { m_customizedScalingMetricSpecificationHasBeenSet = true; m_customizedScalingMetricSpecification = std::move(value); } /** *

The customized scaling metric specification.

*/ inline PredictiveScalingMetricSpecification& WithCustomizedScalingMetricSpecification(const PredictiveScalingCustomizedScalingMetric& value) { SetCustomizedScalingMetricSpecification(value); return *this;} /** *

The customized scaling metric specification.

*/ inline PredictiveScalingMetricSpecification& WithCustomizedScalingMetricSpecification(PredictiveScalingCustomizedScalingMetric&& value) { SetCustomizedScalingMetricSpecification(std::move(value)); return *this;} /** *

The customized load metric specification.

*/ inline const PredictiveScalingCustomizedLoadMetric& GetCustomizedLoadMetricSpecification() const{ return m_customizedLoadMetricSpecification; } /** *

The customized load metric specification.

*/ inline bool CustomizedLoadMetricSpecificationHasBeenSet() const { return m_customizedLoadMetricSpecificationHasBeenSet; } /** *

The customized load metric specification.

*/ inline void SetCustomizedLoadMetricSpecification(const PredictiveScalingCustomizedLoadMetric& value) { m_customizedLoadMetricSpecificationHasBeenSet = true; m_customizedLoadMetricSpecification = value; } /** *

The customized load metric specification.

*/ inline void SetCustomizedLoadMetricSpecification(PredictiveScalingCustomizedLoadMetric&& value) { m_customizedLoadMetricSpecificationHasBeenSet = true; m_customizedLoadMetricSpecification = std::move(value); } /** *

The customized load metric specification.

*/ inline PredictiveScalingMetricSpecification& WithCustomizedLoadMetricSpecification(const PredictiveScalingCustomizedLoadMetric& value) { SetCustomizedLoadMetricSpecification(value); return *this;} /** *

The customized load metric specification.

*/ inline PredictiveScalingMetricSpecification& WithCustomizedLoadMetricSpecification(PredictiveScalingCustomizedLoadMetric&& value) { SetCustomizedLoadMetricSpecification(std::move(value)); return *this;} /** *

The customized capacity metric specification.

*/ inline const PredictiveScalingCustomizedCapacityMetric& GetCustomizedCapacityMetricSpecification() const{ return m_customizedCapacityMetricSpecification; } /** *

The customized capacity metric specification.

*/ inline bool CustomizedCapacityMetricSpecificationHasBeenSet() const { return m_customizedCapacityMetricSpecificationHasBeenSet; } /** *

The customized capacity metric specification.

*/ inline void SetCustomizedCapacityMetricSpecification(const PredictiveScalingCustomizedCapacityMetric& value) { m_customizedCapacityMetricSpecificationHasBeenSet = true; m_customizedCapacityMetricSpecification = value; } /** *

The customized capacity metric specification.

*/ inline void SetCustomizedCapacityMetricSpecification(PredictiveScalingCustomizedCapacityMetric&& value) { m_customizedCapacityMetricSpecificationHasBeenSet = true; m_customizedCapacityMetricSpecification = std::move(value); } /** *

The customized capacity metric specification.

*/ inline PredictiveScalingMetricSpecification& WithCustomizedCapacityMetricSpecification(const PredictiveScalingCustomizedCapacityMetric& value) { SetCustomizedCapacityMetricSpecification(value); return *this;} /** *

The customized capacity metric specification.

*/ inline PredictiveScalingMetricSpecification& WithCustomizedCapacityMetricSpecification(PredictiveScalingCustomizedCapacityMetric&& value) { SetCustomizedCapacityMetricSpecification(std::move(value)); return *this;} private: double m_targetValue; bool m_targetValueHasBeenSet = false; PredictiveScalingPredefinedMetricPair m_predefinedMetricPairSpecification; bool m_predefinedMetricPairSpecificationHasBeenSet = false; PredictiveScalingPredefinedScalingMetric m_predefinedScalingMetricSpecification; bool m_predefinedScalingMetricSpecificationHasBeenSet = false; PredictiveScalingPredefinedLoadMetric m_predefinedLoadMetricSpecification; bool m_predefinedLoadMetricSpecificationHasBeenSet = false; PredictiveScalingCustomizedScalingMetric m_customizedScalingMetricSpecification; bool m_customizedScalingMetricSpecificationHasBeenSet = false; PredictiveScalingCustomizedLoadMetric m_customizedLoadMetricSpecification; bool m_customizedLoadMetricSpecificationHasBeenSet = false; PredictiveScalingCustomizedCapacityMetric m_customizedCapacityMetricSpecification; bool m_customizedCapacityMetricSpecificationHasBeenSet = false; }; } // namespace Model } // namespace AutoScaling } // namespace Aws