ComputeOptimizerAutomation / Client / list_automation_rule_preview

list_automation_rule_preview

ComputeOptimizerAutomation.Client.list_automation_rule_preview(**kwargs)

Returns a preview of the recommended actions that match your Automation rule’s configuration and criteria.

See also: AWS API Documentation

Request Syntax

response = client.list_automation_rule_preview(
    ruleType='OrganizationRule'|'AccountRule',
    organizationScope={
        'accountIds': [
            'string',
        ]
    },
    recommendedActionTypes=[
        'SnapshotAndDeleteUnattachedEbsVolume'|'UpgradeEbsVolumeType',
    ],
    criteria={
        'region': [
            {
                'comparison': 'StringEquals'|'StringNotEquals'|'StringEqualsIgnoreCase'|'StringNotEqualsIgnoreCase'|'StringLike'|'StringNotLike'|'NumericEquals'|'NumericNotEquals'|'NumericLessThan'|'NumericLessThanEquals'|'NumericGreaterThan'|'NumericGreaterThanEquals',
                'values': [
                    'string',
                ]
            },
        ],
        'resourceArn': [
            {
                'comparison': 'StringEquals'|'StringNotEquals'|'StringEqualsIgnoreCase'|'StringNotEqualsIgnoreCase'|'StringLike'|'StringNotLike'|'NumericEquals'|'NumericNotEquals'|'NumericLessThan'|'NumericLessThanEquals'|'NumericGreaterThan'|'NumericGreaterThanEquals',
                'values': [
                    'string',
                ]
            },
        ],
        'ebsVolumeType': [
            {
                'comparison': 'StringEquals'|'StringNotEquals'|'StringEqualsIgnoreCase'|'StringNotEqualsIgnoreCase'|'StringLike'|'StringNotLike'|'NumericEquals'|'NumericNotEquals'|'NumericLessThan'|'NumericLessThanEquals'|'NumericGreaterThan'|'NumericGreaterThanEquals',
                'values': [
                    'string',
                ]
            },
        ],
        'ebsVolumeSizeInGib': [
            {
                'comparison': 'StringEquals'|'StringNotEquals'|'StringEqualsIgnoreCase'|'StringNotEqualsIgnoreCase'|'StringLike'|'StringNotLike'|'NumericEquals'|'NumericNotEquals'|'NumericLessThan'|'NumericLessThanEquals'|'NumericGreaterThan'|'NumericGreaterThanEquals',
                'values': [
                    123,
                ]
            },
        ],
        'estimatedMonthlySavings': [
            {
                'comparison': 'StringEquals'|'StringNotEquals'|'StringEqualsIgnoreCase'|'StringNotEqualsIgnoreCase'|'StringLike'|'StringNotLike'|'NumericEquals'|'NumericNotEquals'|'NumericLessThan'|'NumericLessThanEquals'|'NumericGreaterThan'|'NumericGreaterThanEquals',
                'values': [
                    123.0,
                ]
            },
        ],
        'resourceTag': [
            {
                'comparison': 'StringEquals'|'StringNotEquals'|'StringEqualsIgnoreCase'|'StringNotEqualsIgnoreCase'|'StringLike'|'StringNotLike'|'NumericEquals'|'NumericNotEquals'|'NumericLessThan'|'NumericLessThanEquals'|'NumericGreaterThan'|'NumericGreaterThanEquals',
                'key': 'string',
                'values': [
                    'string',
                ]
            },
        ],
        'lookBackPeriodInDays': [
            {
                'comparison': 'StringEquals'|'StringNotEquals'|'StringEqualsIgnoreCase'|'StringNotEqualsIgnoreCase'|'StringLike'|'StringNotLike'|'NumericEquals'|'NumericNotEquals'|'NumericLessThan'|'NumericLessThanEquals'|'NumericGreaterThan'|'NumericGreaterThanEquals',
                'values': [
                    123,
                ]
            },
        ],
        'restartNeeded': [
            {
                'comparison': 'StringEquals'|'StringNotEquals'|'StringEqualsIgnoreCase'|'StringNotEqualsIgnoreCase'|'StringLike'|'StringNotLike'|'NumericEquals'|'NumericNotEquals'|'NumericLessThan'|'NumericLessThanEquals'|'NumericGreaterThan'|'NumericGreaterThanEquals',
                'values': [
                    'string',
                ]
            },
        ]
    },
    maxResults=123,
    nextToken='string'
)
Parameters:
  • ruleType (string) –

    [REQUIRED]

    The type of rule.

    Note

    Only the management account or a delegated administrator can set the ruleType to be OrganizationRule.

  • organizationScope (dict) –

    The organizational scope for the rule preview.

    • accountIds (list) –

      List of Amazon Web Services account IDs to include in the organization scope.

      • (string) –

  • recommendedActionTypes (list) –

    [REQUIRED]

    The types of recommended actions to include in the preview.

    • (string) –

      Recommended action type enumeration

  • criteria (dict) –

    A set of conditions that specify which recommended action qualify for implementation. When a rule is active and a recommended action matches these criteria, Compute Optimizer implements the action at the scheduled run time.

    • region (list) –

      Filter criteria for Amazon Web Services regions where resources must be located.

      • (dict) –

        Criteria condition for filtering based on string values, including comparison operators and target values.

        • comparison (string) –

          The comparison operator used to evaluate the string criteria, such as equals, not equals, or contains.

        • values (list) –

          List of string values to compare against when applying the criteria condition.

          • (string) –

    • resourceArn (list) –

      Filter criteria for specific resource ARNs to include or exclude.

      • (dict) –

        Criteria condition for filtering based on string values, including comparison operators and target values.

        • comparison (string) –

          The comparison operator used to evaluate the string criteria, such as equals, not equals, or contains.

        • values (list) –

          List of string values to compare against when applying the criteria condition.

          • (string) –

    • ebsVolumeType (list) –

      Filter criteria for EBS volume types, such as gp2, gp3, io1, io2, st1, or sc1.

      • (dict) –

        Criteria condition for filtering based on string values, including comparison operators and target values.

        • comparison (string) –

          The comparison operator used to evaluate the string criteria, such as equals, not equals, or contains.

        • values (list) –

          List of string values to compare against when applying the criteria condition.

          • (string) –

    • ebsVolumeSizeInGib (list) –

      Filter criteria for EBS volume sizes in gibibytes (GiB).

      • (dict) –

        Defines a condition for filtering based on integer values with comparison operators.

        • comparison (string) –

          The comparison operator to use, such as equals, greater than, less than, etc.

        • values (list) –

          The list of integer values to compare against using the specified comparison operator.

          • (integer) –

    • estimatedMonthlySavings (list) –

      Filter criteria for estimated monthly cost savings from the recommended action.

      • (dict) –

        Defines a condition for filtering based on double/floating-point numeric values with comparison operators.

        • comparison (string) –

          The comparison operator to use, such as equals, greater than, less than, etc.

        • values (list) –

          The list of double values to compare against using the specified comparison operator.

          • (float) –

    • resourceTag (list) –

      Filter criteria for resource tags, allowing filtering by tag key and value combinations.

      • (dict) –

        Criteria condition for filtering resources based on their tags, including comparison operators and values.

        • comparison (string) –

          The comparison operator used to evaluate the tag criteria, such as equals, not equals, or contains.

        • key (string) –

          The tag key to use for comparison when filtering resources.

        • values (list) –

          List of tag values to compare against when filtering resources.

          • (string) –

    • lookBackPeriodInDays (list) –

      Filter criteria for the lookback period in days used to analyze resource utilization.

      • (dict) –

        Defines a condition for filtering based on integer values with comparison operators.

        • comparison (string) –

          The comparison operator to use, such as equals, greater than, less than, etc.

        • values (list) –

          The list of integer values to compare against using the specified comparison operator.

          • (integer) –

    • restartNeeded (list) –

      Filter criteria indicating whether the recommended action requires a resource restart.

      • (dict) –

        Criteria condition for filtering based on string values, including comparison operators and target values.

        • comparison (string) –

          The comparison operator used to evaluate the string criteria, such as equals, not equals, or contains.

        • values (list) –

          List of string values to compare against when applying the criteria condition.

          • (string) –

  • maxResults (integer) – The maximum number of automation rule preview results to return in a single response. Valid range is 1-1000.

  • nextToken (string) – A token used for pagination to retrieve the next set of results when the response is truncated.

Return type:

dict

Returns:

Response Syntax

{
    'previewResults': [
        {
            'recommendedActionId': 'string',
            'resourceArn': 'string',
            'resourceId': 'string',
            'accountId': 'string',
            'region': 'string',
            'resourceType': 'EbsVolume',
            'lookBackPeriodInDays': 123,
            'recommendedActionType': 'SnapshotAndDeleteUnattachedEbsVolume'|'UpgradeEbsVolumeType',
            'currentResourceSummary': 'string',
            'currentResourceDetails': {
                'ebsVolume': {
                    'configuration': {
                        'type': 'string',
                        'sizeInGib': 123,
                        'iops': 123,
                        'throughput': 123
                    }
                }
            },
            'recommendedResourceSummary': 'string',
            'recommendedResourceDetails': {
                'ebsVolume': {
                    'configuration': {
                        'type': 'string',
                        'sizeInGib': 123,
                        'iops': 123,
                        'throughput': 123
                    }
                }
            },
            'restartNeeded': True|False,
            'estimatedMonthlySavings': {
                'currency': 'string',
                'beforeDiscountSavings': 123.0,
                'afterDiscountSavings': 123.0,
                'savingsEstimationMode': 'BeforeDiscount'|'AfterDiscount'
            },
            'resourceTags': [
                {
                    'key': 'string',
                    'value': 'string'
                },
            ]
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) –

    • previewResults (list) –

      The list of actions that would be taken based on the specified criteria.

      • (dict) –

        Contains the results of previewing an automation rule against available recommendations.

        • recommendedActionId (string) –

          The ID of the recommended action being previewed.

        • resourceArn (string) –

          The Amazon Resource Name (ARN) of the resource affected by the recommended action.

        • resourceId (string) –

          The ID of the resource affected by the recommended action.

        • accountId (string) –

          The Amazon Web Services account ID associated with the resource.

        • region (string) –

          The Amazon Web Services Region where the resource is located.

        • resourceType (string) –

          The type of resource being evaluated.

        • lookBackPeriodInDays (integer) –

          The number of days of historical data used to analyze the resource.

        • recommendedActionType (string) –

          The type of recommended action being previewed.

        • currentResourceSummary (string) –

          A summary of the resource’s current configuration.

        • currentResourceDetails (dict) –

          Detailed configuration information for a specific Amazon Web Services resource, with type-specific details.

          Note

          This is a Tagged Union structure. Only one of the following top level keys will be set: ebsVolume. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

          'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
          
          • ebsVolume (dict) –

            Detailed configuration information specific to EBS volumes, including volume type, size, IOPS, and throughput settings.

            • configuration (dict) –

              The configuration details of the EBS volume, including type, size, IOPS, and throughput.

              • type (string) –

                The EBS volume type, such as gp2, gp3, io1, io2, st1, or sc1.

              • sizeInGib (integer) –

                The size of the EBS volume in gibibytes (GiB).

              • iops (integer) –

                The number of I/O operations per second (IOPS) provisioned for the volume.

              • throughput (integer) –

                The throughput in MiB/s provisioned for the volume (applicable to gp3, io1, and io2bx volumes).

        • recommendedResourceSummary (string) –

          A summary of the resource’s recommended configuration.

        • recommendedResourceDetails (dict) –

          Detailed configuration information for a specific Amazon Web Services resource, with type-specific details.

          Note

          This is a Tagged Union structure. Only one of the following top level keys will be set: ebsVolume. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

          'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
          
          • ebsVolume (dict) –

            Detailed configuration information specific to EBS volumes, including volume type, size, IOPS, and throughput settings.

            • configuration (dict) –

              The configuration details of the EBS volume, including type, size, IOPS, and throughput.

              • type (string) –

                The EBS volume type, such as gp2, gp3, io1, io2, st1, or sc1.

              • sizeInGib (integer) –

                The size of the EBS volume in gibibytes (GiB).

              • iops (integer) –

                The number of I/O operations per second (IOPS) provisioned for the volume.

              • throughput (integer) –

                The throughput in MiB/s provisioned for the volume (applicable to gp3, io1, and io2bx volumes).

        • restartNeeded (boolean) –

          Indicates whether implementing the recommended action requires a resource restart.

        • estimatedMonthlySavings (dict) –

          Contains information about estimated monthly cost savings.

          • currency (string) –

            The currency of the estimated savings.

          • beforeDiscountSavings (float) –

            The estimated monthly savings before applying any discounts.

          • afterDiscountSavings (float) –

            The estimated monthly savings after applying any discounts.

          • savingsEstimationMode (string) –

            The mode used to calculate savings, either BeforeDiscount or AfterDiscount.

        • resourceTags (list) –

          The tags associated with the resource.

          • (dict) –

            A key-value pair used to categorize and organize Amazon Web Services resources and automation rules.

            • key (string) –

              The tag key, which can be up to 128 characters long.

            • value (string) –

              The tag value, which can be up to 256 characters long.

    • nextToken (string) –

      A token used for pagination. If present, indicates there are more results available and can be used in subsequent requests.

Exceptions

  • ComputeOptimizerAutomation.Client.exceptions.InvalidParameterValueException

  • ComputeOptimizerAutomation.Client.exceptions.ForbiddenException

  • ComputeOptimizerAutomation.Client.exceptions.OptInRequiredException

  • ComputeOptimizerAutomation.Client.exceptions.ThrottlingException

  • ComputeOptimizerAutomation.Client.exceptions.AccessDeniedException

  • ComputeOptimizerAutomation.Client.exceptions.InternalServerException

  • ComputeOptimizerAutomation.Client.exceptions.ServiceUnavailableException