:doc:`ComputeOptimizerAutomation <../../compute-optimizer-automation>` / Client / update_automation_rule

**********************
update_automation_rule
**********************



.. py:method:: ComputeOptimizerAutomation.Client.update_automation_rule(**kwargs)

  

  Updates an existing automation rule.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/compute-optimizer-automation-2025-09-22/UpdateAutomationRule>`_  


  **Request Syntax**
  ::

    response = client.update_automation_rule(
        ruleArn='string',
        ruleRevision=123,
        name='string',
        description='string',
        ruleType='OrganizationRule'|'AccountRule',
        organizationConfiguration={
            'ruleApplyOrder': 'BeforeAccountRules'|'AfterAccountRules',
            'accountIds': [
                'string',
            ]
        },
        priority='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',
                    ]
                },
            ]
        },
        schedule={
            'scheduleExpression': 'string',
            'scheduleExpressionTimezone': 'string',
            'executionWindowInMinutes': 123
        },
        status='Active'|'Inactive',
        clientToken='string'
    )
    
  :type ruleArn: string
  :param ruleArn: **[REQUIRED]** 

    The ARN of the rule to update.

    

  
  :type ruleRevision: integer
  :param ruleRevision: **[REQUIRED]** 

    The revision number of the rule to update.

    

  
  :type name: string
  :param name: 

    The updated name of the automation rule. Must be 1-128 characters long and contain only alphanumeric characters, underscores, and hyphens.

    

  
  :type description: string
  :param description: 

    The updated description of the automation rule. Can be up to 1024 characters long and contain alphanumeric characters, underscores, hyphens, spaces, and certain special characters.

    

  
  :type ruleType: string
  :param ruleType: 

    The updated type of automation rule. Can be either OrganizationRule for organization-wide rules or AccountRule for account-specific rules.

    

  
  :type organizationConfiguration: dict
  :param organizationConfiguration: 

    Updated configuration settings for organization-wide rules, including rule application order and target account IDs.

    

  
    - **ruleApplyOrder** *(string) --* 

      Specifies when organization rules should be applied relative to account rules.

      

    
    - **accountIds** *(list) --* 

      List of specific Amazon Web Services account IDs where the organization rule should be applied.

      

    
      - *(string) --* 

      
  
  
  :type priority: string
  :param priority: 

    The updated priority level of the automation rule, used to determine execution order when multiple rules apply to the same resource.

    

  
  :type recommendedActionTypes: list
  :param recommendedActionTypes: 

    Updated list of recommended action types that this rule can execute, such as SnapshotAndDeleteUnattachedEbsVolume or UpgradeEbsVolumeType.

    

  
    - *(string) --* 

      Recommended action type enumeration

      

    

  :type criteria: dict
  :param criteria: 

    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. You can specify up to 20 conditions per filter criteria and 20 values per condition.

    

  
    - **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) --* 

          
      
      
  
  
  :type schedule: dict
  :param schedule: 

    The updated schedule configuration for when the automation rule should execute, including cron expression, timezone, and execution window.

    

  
    - **scheduleExpression** *(string) --* 

      The expression that defines when the schedule runs. ``cron`` expression is supported. A ``cron`` expression consists of six fields separated by white spaces: ( ``minutes`` ``hours`` ``day_of_month`` ``month`` ``day_of_week`` ``year``)

       

      .. note::

        

        You can schedule rules to run at most once per day. Your cron expression must use specific values (not wildcards) for the minutes and hours fields. For example: ( ``30 12 * * *``) runs daily at 12:30 PM UTC.

        

      

    
    - **scheduleExpressionTimezone** *(string) --* 

      The timezone to use when interpreting the schedule expression.

      

    
    - **executionWindowInMinutes** *(integer) --* 

      The time window in minutes during which the automation rule can start implementing recommended actions.

      

    
  
  :type status: string
  :param status: 

    The updated status of the automation rule. Can be Active or Inactive.

    

  
  :type clientToken: string
  :param clientToken: 

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Must be 1-64 characters long and contain only alphanumeric characters, underscores, and hyphens.

    This field is autopopulated if not provided.

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'ruleArn': 'string',
          'ruleRevision': 123,
          'name': 'string',
          'description': 'string',
          'ruleType': 'OrganizationRule'|'AccountRule',
          'organizationConfiguration': {
              'ruleApplyOrder': 'BeforeAccountRules'|'AfterAccountRules',
              'accountIds': [
                  'string',
              ]
          },
          'priority': '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',
                      ]
                  },
              ]
          },
          'schedule': {
              'scheduleExpression': 'string',
              'scheduleExpressionTimezone': 'string',
              'executionWindowInMinutes': 123
          },
          'status': 'Active'|'Inactive',
          'createdTimestamp': datetime(2015, 1, 1),
          'lastUpdatedTimestamp': datetime(2015, 1, 1)
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **ruleArn** *(string) --* 

        The ARN of the updated rule.

        
      

      - **ruleRevision** *(integer) --* 

        The new revision number of the updated rule.

        
      

      - **name** *(string) --* 

        The updated name of the automation rule.

        
      

      - **description** *(string) --* 

        The updated description of the automation rule.

        
      

      - **ruleType** *(string) --* 

        The updated type of automation rule.

        
      

      - **organizationConfiguration** *(dict) --* 

        The updated organization configuration settings.

        
        

        - **ruleApplyOrder** *(string) --* 

          Specifies when organization rules should be applied relative to account rules.

          
        

        - **accountIds** *(list) --* 

          List of specific Amazon Web Services account IDs where the organization rule should be applied.

          
          

          - *(string) --* 
      
    
      

      - **priority** *(string) --* 

        The updated priority level of the automation rule.

        
      

      - **recommendedActionTypes** *(list) --* 

        The updated list of recommended action types.

        
        

        - *(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. You can specify up to 20 conditions per filter criteria and 20 values per condition.

        
        

        - **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) --* 
          
        
      
    
      

      - **schedule** *(dict) --* 

        The updated schedule configuration.

        
        

        - **scheduleExpression** *(string) --* 

          The expression that defines when the schedule runs. ``cron`` expression is supported. A ``cron`` expression consists of six fields separated by white spaces: ( ``minutes`` ``hours`` ``day_of_month`` ``month`` ``day_of_week`` ``year``)

           

          .. note::

            

            You can schedule rules to run at most once per day. Your cron expression must use specific values (not wildcards) for the minutes and hours fields. For example: ( ``30 12 * * *``) runs daily at 12:30 PM UTC.

            

          
        

        - **scheduleExpressionTimezone** *(string) --* 

          The timezone to use when interpreting the schedule expression.

          
        

        - **executionWindowInMinutes** *(integer) --* 

          The time window in minutes during which the automation rule can start implementing recommended actions.

          
    
      

      - **status** *(string) --* 

        The updated status of the automation rule.

        
      

      - **createdTimestamp** *(datetime) --* 

        The timestamp when the automation rule was originally created.

        
      

      - **lastUpdatedTimestamp** *(datetime) --* 

        The timestamp when the automation rule was last updated.

        
  
  **Exceptions**
  
  *   :py:class:`ComputeOptimizerAutomation.Client.exceptions.InvalidParameterValueException`

  
  *   :py:class:`ComputeOptimizerAutomation.Client.exceptions.ForbiddenException`

  
  *   :py:class:`ComputeOptimizerAutomation.Client.exceptions.OptInRequiredException`

  
  *   :py:class:`ComputeOptimizerAutomation.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`ComputeOptimizerAutomation.Client.exceptions.ThrottlingException`

  
  *   :py:class:`ComputeOptimizerAutomation.Client.exceptions.IdempotentParameterMismatchException`

  
  *   :py:class:`ComputeOptimizerAutomation.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`ComputeOptimizerAutomation.Client.exceptions.InternalServerException`

  
  *   :py:class:`ComputeOptimizerAutomation.Client.exceptions.ServiceUnavailableException`

  
  *   :py:class:`ComputeOptimizerAutomation.Client.exceptions.IdempotencyTokenInUseException`

  