get_predictive_scaling_forecast

AutoScaling.Client.get_predictive_scaling_forecast(**kwargs)

Retrieves the forecast data for a predictive scaling policy.

Load forecasts are predictions of the hourly load values using historical load data from CloudWatch and an analysis of historical trends. Capacity forecasts are represented as predicted values for the minimum capacity that is needed on an hourly basis, based on the hourly load forecast.

A minimum of 24 hours of data is required to create the initial forecasts. However, having a full 14 days of historical data results in more accurate forecasts.

For more information, see Predictive scaling for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .

See also: AWS API Documentation

Request Syntax

response = client.get_predictive_scaling_forecast(
    AutoScalingGroupName='string',
    PolicyName='string',
    StartTime=datetime(2015, 1, 1),
    EndTime=datetime(2015, 1, 1)
)
Parameters
  • AutoScalingGroupName (string) --

    [REQUIRED]

    The name of the Auto Scaling group.

  • PolicyName (string) --

    [REQUIRED]

    The name of the policy.

  • StartTime (datetime) --

    [REQUIRED]

    The inclusive start time of the time range for the forecast data to get. At most, the date and time can be one year before the current date and time.

  • EndTime (datetime) --

    [REQUIRED]

    The exclusive end time of the time range for the forecast data to get. The maximum time duration between the start and end time is 30 days.

    Although this parameter can accept a date and time that is more than two days in the future, the availability of forecast data has limits. Amazon EC2 Auto Scaling only issues forecasts for periods of two days in advance.

Return type

dict

Returns

Response Syntax

{
    'LoadForecast': [
        {
            'Timestamps': [
                datetime(2015, 1, 1),
            ],
            'Values': [
                123.0,
            ],
            'MetricSpecification': {
                'TargetValue': 123.0,
                'PredefinedMetricPairSpecification': {
                    'PredefinedMetricType': 'ASGCPUUtilization'|'ASGNetworkIn'|'ASGNetworkOut'|'ALBRequestCount',
                    'ResourceLabel': 'string'
                },
                'PredefinedScalingMetricSpecification': {
                    'PredefinedMetricType': 'ASGAverageCPUUtilization'|'ASGAverageNetworkIn'|'ASGAverageNetworkOut'|'ALBRequestCountPerTarget',
                    'ResourceLabel': 'string'
                },
                'PredefinedLoadMetricSpecification': {
                    'PredefinedMetricType': 'ASGTotalCPUUtilization'|'ASGTotalNetworkIn'|'ASGTotalNetworkOut'|'ALBTargetGroupRequestCount',
                    'ResourceLabel': 'string'
                },
                'CustomizedScalingMetricSpecification': {
                    'MetricDataQueries': [
                        {
                            'Id': 'string',
                            'Expression': 'string',
                            'MetricStat': {
                                'Metric': {
                                    'Namespace': 'string',
                                    'MetricName': 'string',
                                    'Dimensions': [
                                        {
                                            'Name': 'string',
                                            'Value': 'string'
                                        },
                                    ]
                                },
                                'Stat': 'string',
                                'Unit': 'string'
                            },
                            'Label': 'string',
                            'ReturnData': True|False
                        },
                    ]
                },
                'CustomizedLoadMetricSpecification': {
                    'MetricDataQueries': [
                        {
                            'Id': 'string',
                            'Expression': 'string',
                            'MetricStat': {
                                'Metric': {
                                    'Namespace': 'string',
                                    'MetricName': 'string',
                                    'Dimensions': [
                                        {
                                            'Name': 'string',
                                            'Value': 'string'
                                        },
                                    ]
                                },
                                'Stat': 'string',
                                'Unit': 'string'
                            },
                            'Label': 'string',
                            'ReturnData': True|False
                        },
                    ]
                },
                'CustomizedCapacityMetricSpecification': {
                    'MetricDataQueries': [
                        {
                            'Id': 'string',
                            'Expression': 'string',
                            'MetricStat': {
                                'Metric': {
                                    'Namespace': 'string',
                                    'MetricName': 'string',
                                    'Dimensions': [
                                        {
                                            'Name': 'string',
                                            'Value': 'string'
                                        },
                                    ]
                                },
                                'Stat': 'string',
                                'Unit': 'string'
                            },
                            'Label': 'string',
                            'ReturnData': True|False
                        },
                    ]
                }
            }
        },
    ],
    'CapacityForecast': {
        'Timestamps': [
            datetime(2015, 1, 1),
        ],
        'Values': [
            123.0,
        ]
    },
    'UpdateTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • LoadForecast (list) --

      The load forecast.

      • (dict) --

        A GetPredictiveScalingForecast call returns the load forecast for a predictive scaling policy. This structure includes the data points for that load forecast, along with the timestamps of those data points and the metric specification.

        • Timestamps (list) --

          The timestamps for the data points, in UTC format.

          • (datetime) --
        • Values (list) --

          The values of the data points.

          • (float) --
        • MetricSpecification (dict) --

          The metric specification for the load forecast.

          • TargetValue (float) --

            Specifies the target utilization.

            Note

            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.

          • PredefinedMetricPairSpecification (dict) --

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

            • PredefinedMetricType (string) --

              Indicates which metrics to use. There are two different types of metrics for each metric type: one is a load metric and one is a scaling metric. For example, if the metric type is ASGCPUUtilization , the Auto Scaling group's total CPU metric is used as the load metric, and the average CPU metric is used for the scaling metric.

            • ResourceLabel (string) --

              A label that uniquely identifies a specific Application Load Balancer target group from which to determine the total and average request count served by your Auto Scaling group. You can't specify a resource label unless the target group is 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 of the resource label is:

              app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff .

              Where:

              • app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
              • targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.

              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.

          • PredefinedScalingMetricSpecification (dict) --

            The predefined scaling metric specification.

            • PredefinedMetricType (string) --

              The metric type.

            • ResourceLabel (string) --

              A label that uniquely identifies a specific Application Load Balancer target group from which to determine the average request count served by your Auto Scaling group. You can't specify a resource label unless the target group is 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 of the resource label is:

              app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff .

              Where:

              • app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
              • targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.

              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.

          • PredefinedLoadMetricSpecification (dict) --

            The predefined load metric specification.

            • PredefinedMetricType (string) --

              The metric type.

            • ResourceLabel (string) --

              A label that uniquely identifies a specific Application Load Balancer target group from which to determine the request count served by your Auto Scaling group. You can't specify a resource label unless the target group is 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 of the resource label is:

              app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff .

              Where:

              • app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
              • targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.

              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.

          • CustomizedScalingMetricSpecification (dict) --

            The customized scaling metric specification.

            • MetricDataQueries (list) --

              One or more metric data queries to provide the data points for a scaling metric. Use multiple metric data queries only if you are performing a math expression on returned data.

              • (dict) --

                The metric data to return. Also defines whether this call is returning data for one metric only, or whether it is performing a math expression on the values of returned metric statistics to create a new time series. A time series is a series of data points, each of which is associated with a timestamp.

                For more information and examples, see Advanced predictive scaling policy configurations using custom metrics in the Amazon EC2 Auto Scaling User Guide .

                • Id (string) --

                  A short name that identifies the object's results in the response. This name must be unique among all MetricDataQuery objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.

                • Expression (string) --

                  The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the Id of the other metrics to refer to those metrics, and can also use the Id of other expressions to use the result of those expressions.

                  Conditional: Within each MetricDataQuery object, you must specify either Expression or MetricStat , but not both.

                • MetricStat (dict) --

                  Information about the metric data to return.

                  Conditional: Within each MetricDataQuery object, you must specify either Expression or MetricStat , but not both.

                  • Metric (dict) --

                    The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics.

                    • Namespace (string) --

                      The namespace of the metric. For more information, see the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide .

                    • MetricName (string) --

                      The name of the metric.

                    • Dimensions (list) --

                      The dimensions for the metric. For the list of available dimensions, see the Amazon Web Services documentation available from the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide .

                      Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.

                      • (dict) --

                        Describes the dimension of a metric.

                        • Name (string) --

                          The name of the dimension.

                        • Value (string) --

                          The value of the dimension.

                  • Stat (string) --

                    The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide .

                    The most commonly used metrics for predictive scaling are Average and Sum .

                  • Unit (string) --

                    The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference .

                • Label (string) --

                  A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.

                • ReturnData (boolean) --

                  Indicates whether to return the timestamps and raw data values of this metric.

                  If you use any math expressions, specify true for this value for only the final math expression that the metric specification is based on. You must specify false for ReturnData for all the other metrics and expressions used in the metric specification.

                  If you are only retrieving metrics and not performing any math expressions, do not specify anything for ReturnData . This sets it to its default ( true ).

          • CustomizedLoadMetricSpecification (dict) --

            The customized load metric specification.

            • MetricDataQueries (list) --

              One or more metric data queries to provide the data points for a load metric. Use multiple metric data queries only if you are performing a math expression on returned data.

              • (dict) --

                The metric data to return. Also defines whether this call is returning data for one metric only, or whether it is performing a math expression on the values of returned metric statistics to create a new time series. A time series is a series of data points, each of which is associated with a timestamp.

                For more information and examples, see Advanced predictive scaling policy configurations using custom metrics in the Amazon EC2 Auto Scaling User Guide .

                • Id (string) --

                  A short name that identifies the object's results in the response. This name must be unique among all MetricDataQuery objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.

                • Expression (string) --

                  The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the Id of the other metrics to refer to those metrics, and can also use the Id of other expressions to use the result of those expressions.

                  Conditional: Within each MetricDataQuery object, you must specify either Expression or MetricStat , but not both.

                • MetricStat (dict) --

                  Information about the metric data to return.

                  Conditional: Within each MetricDataQuery object, you must specify either Expression or MetricStat , but not both.

                  • Metric (dict) --

                    The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics.

                    • Namespace (string) --

                      The namespace of the metric. For more information, see the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide .

                    • MetricName (string) --

                      The name of the metric.

                    • Dimensions (list) --

                      The dimensions for the metric. For the list of available dimensions, see the Amazon Web Services documentation available from the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide .

                      Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.

                      • (dict) --

                        Describes the dimension of a metric.

                        • Name (string) --

                          The name of the dimension.

                        • Value (string) --

                          The value of the dimension.

                  • Stat (string) --

                    The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide .

                    The most commonly used metrics for predictive scaling are Average and Sum .

                  • Unit (string) --

                    The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference .

                • Label (string) --

                  A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.

                • ReturnData (boolean) --

                  Indicates whether to return the timestamps and raw data values of this metric.

                  If you use any math expressions, specify true for this value for only the final math expression that the metric specification is based on. You must specify false for ReturnData for all the other metrics and expressions used in the metric specification.

                  If you are only retrieving metrics and not performing any math expressions, do not specify anything for ReturnData . This sets it to its default ( true ).

          • CustomizedCapacityMetricSpecification (dict) --

            The customized capacity metric specification.

            • MetricDataQueries (list) --

              One or more metric data queries to provide the data points for a capacity metric. Use multiple metric data queries only if you are performing a math expression on returned data.

              • (dict) --

                The metric data to return. Also defines whether this call is returning data for one metric only, or whether it is performing a math expression on the values of returned metric statistics to create a new time series. A time series is a series of data points, each of which is associated with a timestamp.

                For more information and examples, see Advanced predictive scaling policy configurations using custom metrics in the Amazon EC2 Auto Scaling User Guide .

                • Id (string) --

                  A short name that identifies the object's results in the response. This name must be unique among all MetricDataQuery objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.

                • Expression (string) --

                  The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the Id of the other metrics to refer to those metrics, and can also use the Id of other expressions to use the result of those expressions.

                  Conditional: Within each MetricDataQuery object, you must specify either Expression or MetricStat , but not both.

                • MetricStat (dict) --

                  Information about the metric data to return.

                  Conditional: Within each MetricDataQuery object, you must specify either Expression or MetricStat , but not both.

                  • Metric (dict) --

                    The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics.

                    • Namespace (string) --

                      The namespace of the metric. For more information, see the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide .

                    • MetricName (string) --

                      The name of the metric.

                    • Dimensions (list) --

                      The dimensions for the metric. For the list of available dimensions, see the Amazon Web Services documentation available from the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide .

                      Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.

                      • (dict) --

                        Describes the dimension of a metric.

                        • Name (string) --

                          The name of the dimension.

                        • Value (string) --

                          The value of the dimension.

                  • Stat (string) --

                    The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide .

                    The most commonly used metrics for predictive scaling are Average and Sum .

                  • Unit (string) --

                    The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference .

                • Label (string) --

                  A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.

                • ReturnData (boolean) --

                  Indicates whether to return the timestamps and raw data values of this metric.

                  If you use any math expressions, specify true for this value for only the final math expression that the metric specification is based on. You must specify false for ReturnData for all the other metrics and expressions used in the metric specification.

                  If you are only retrieving metrics and not performing any math expressions, do not specify anything for ReturnData . This sets it to its default ( true ).

    • CapacityForecast (dict) --

      The capacity forecast.

      • Timestamps (list) --

        The timestamps for the data points, in UTC format.

        • (datetime) --
      • Values (list) --

        The values of the data points.

        • (float) --
    • UpdateTime (datetime) --

      The time the forecast was made.

Exceptions

  • AutoScaling.Client.exceptions.ResourceContentionFault