ApplicationAutoScaling / Client / get_predictive_scaling_forecast

get_predictive_scaling_forecast#

ApplicationAutoScaling.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.

See also: AWS API Documentation

Request Syntax

response = client.get_predictive_scaling_forecast(
    ServiceNamespace='ecs'|'elasticmapreduce'|'ec2'|'appstream'|'dynamodb'|'rds'|'sagemaker'|'custom-resource'|'comprehend'|'lambda'|'cassandra'|'kafka'|'elasticache'|'neptune'|'workspaces',
    ResourceId='string',
    ScalableDimension='ecs:service:DesiredCount'|'ec2:spot-fleet-request:TargetCapacity'|'elasticmapreduce:instancegroup:InstanceCount'|'appstream:fleet:DesiredCapacity'|'dynamodb:table:ReadCapacityUnits'|'dynamodb:table:WriteCapacityUnits'|'dynamodb:index:ReadCapacityUnits'|'dynamodb:index:WriteCapacityUnits'|'rds:cluster:ReadReplicaCount'|'sagemaker:variant:DesiredInstanceCount'|'custom-resource:ResourceType:Property'|'comprehend:document-classifier-endpoint:DesiredInferenceUnits'|'comprehend:entity-recognizer-endpoint:DesiredInferenceUnits'|'lambda:function:ProvisionedConcurrency'|'cassandra:table:ReadCapacityUnits'|'cassandra:table:WriteCapacityUnits'|'kafka:broker-storage:VolumeSize'|'elasticache:replication-group:NodeGroups'|'elasticache:replication-group:Replicas'|'neptune:cluster:ReadReplicaCount'|'sagemaker:variant:DesiredProvisionedConcurrency'|'sagemaker:inference-component:DesiredCopyCount'|'workspaces:workspacespool:DesiredUserSessions',
    PolicyName='string',
    StartTime=datetime(2015, 1, 1),
    EndTime=datetime(2015, 1, 1)
)
Parameters:
  • ServiceNamespace (string) –

    [REQUIRED]

    The namespace of the Amazon Web Services service that provides the resource. For a resource provided by your own application or service, use custom-resource instead.

  • ResourceId (string) –

    [REQUIRED]

    The identifier of the resource.

  • ScalableDimension (string) –

    [REQUIRED]

    The scalable dimension.

  • 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.

Return type:

dict

Returns:

Response Syntax

{
    'LoadForecast': [
        {
            'Timestamps': [
                datetime(2015, 1, 1),
            ],
            'Values': [
                123.0,
            ],
            'MetricSpecification': {
                'TargetValue': 123.0,
                'PredefinedMetricPairSpecification': {
                    'PredefinedMetricType': 'string',
                    'ResourceLabel': 'string'
                },
                'PredefinedScalingMetricSpecification': {
                    'PredefinedMetricType': 'string',
                    'ResourceLabel': 'string'
                },
                'PredefinedLoadMetricSpecification': {
                    'PredefinedMetricType': 'string',
                    'ResourceLabel': 'string'
                },
                'CustomizedScalingMetricSpecification': {
                    'MetricDataQueries': [
                        {
                            'Id': 'string',
                            'Expression': 'string',
                            'MetricStat': {
                                'Metric': {
                                    'Dimensions': [
                                        {
                                            'Name': 'string',
                                            'Value': 'string'
                                        },
                                    ],
                                    'MetricName': 'string',
                                    'Namespace': 'string'
                                },
                                'Stat': 'string',
                                'Unit': 'string'
                            },
                            'Label': 'string',
                            'ReturnData': True|False
                        },
                    ]
                },
                'CustomizedLoadMetricSpecification': {
                    'MetricDataQueries': [
                        {
                            'Id': 'string',
                            'Expression': 'string',
                            'MetricStat': {
                                'Metric': {
                                    'Dimensions': [
                                        {
                                            'Name': 'string',
                                            'Value': 'string'
                                        },
                                    ],
                                    'MetricName': 'string',
                                    'Namespace': 'string'
                                },
                                'Stat': 'string',
                                'Unit': 'string'
                            },
                            'Label': 'string',
                            'ReturnData': True|False
                        },
                    ]
                },
                'CustomizedCapacityMetricSpecification': {
                    'MetricDataQueries': [
                        {
                            'Id': 'string',
                            'Expression': 'string',
                            'MetricStat': {
                                'Metric': {
                                    'Dimensions': [
                                        {
                                            'Name': 'string',
                                            'Value': 'string'
                                        },
                                    ],
                                    'MetricName': 'string',
                                    'Namespace': '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.

          • PredefinedMetricPairSpecification (dict) –

            The predefined metric pair specification that 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.

            • ResourceLabel (string) –

              A label that uniquely identifies a specific target group from which to determine the total and average request count.

          • PredefinedScalingMetricSpecification (dict) –

            The predefined scaling metric specification.

            • PredefinedMetricType (string) –

              The metric type.

            • ResourceLabel (string) –

              A label that uniquely identifies a specific target group from which to determine the average request count.

          • PredefinedLoadMetricSpecification (dict) –

            The predefined load metric specification.

            • PredefinedMetricType (string) –

              The metric type.

            • ResourceLabel (string) –

              A label that uniquely identifies a target group.

          • CustomizedScalingMetricSpecification (dict) –

            The customized scaling metric specification.

            • MetricDataQueries (list) –

              One or more metric data queries to provide data points for a metric specification.

              • (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.

                • 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.

                    • Dimensions (list) –

                      Describes the dimensions of the metric.

                      • (dict) –

                        Describes the dimension of a metric.

                        • Name (string) –

                          The name of the dimension.

                        • Value (string) –

                          The value of the dimension.

                    • MetricName (string) –

                      The name of the metric.

                    • Namespace (string) –

                      The namespace of the metric.

                  • 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 data points for a metric specification.

              • (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.

                • 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.

                    • Dimensions (list) –

                      Describes the dimensions of the metric.

                      • (dict) –

                        Describes the dimension of a metric.

                        • Name (string) –

                          The name of the dimension.

                        • Value (string) –

                          The value of the dimension.

                    • MetricName (string) –

                      The name of the metric.

                    • Namespace (string) –

                      The namespace of the metric.

                  • 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 data points for a metric specification.

              • (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.

                • 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.

                    • Dimensions (list) –

                      Describes the dimensions of the metric.

                      • (dict) –

                        Describes the dimension of a metric.

                        • Name (string) –

                          The name of the dimension.

                        • Value (string) –

                          The value of the dimension.

                    • MetricName (string) –

                      The name of the metric.

                    • Namespace (string) –

                      The namespace of the metric.

                  • 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

  • ApplicationAutoScaling.Client.exceptions.ValidationException

  • ApplicationAutoScaling.Client.exceptions.InternalServiceException