:doc:`EventBridge <../../events>` / Client / delete_rule

***********
delete_rule
***********



.. py:method:: EventBridge.Client.delete_rule(**kwargs)

  

  Deletes the specified rule.

   

  Before you can delete the rule, you must remove all targets, using `RemoveTargets <https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_RemoveTargets.html>`__.

   

  When you delete a rule, incoming events might continue to match to the deleted rule. Allow a short period of time for changes to take effect.

   

  If you call delete rule multiple times for the same rule, all calls will succeed. When you call delete rule for a non-existent custom eventbus, ``ResourceNotFoundException`` is returned.

   

  Managed rules are rules created and managed by another Amazon Web Services service on your behalf. These rules are created by those other Amazon Web Services services to support functionality in those services. You can delete these rules using the ``Force`` option, but you should do so only if you are sure the other service is not still using that rule.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DeleteRule>`_  


  **Request Syntax**
  ::

    response = client.delete_rule(
        Name='string',
        EventBusName='string',
        Force=True|False
    )
    
  :type Name: string
  :param Name: **[REQUIRED]** 

    The name of the rule.

    

  
  :type EventBusName: string
  :param EventBusName: 

    The name or ARN of the event bus associated with the rule. If you omit this, the default event bus is used.

    

  
  :type Force: boolean
  :param Force: 

    If this is a managed rule, created by an Amazon Web Services service on your behalf, you must specify ``Force`` as ``True`` to delete the rule. This parameter is ignored for rules that are not managed rules. You can check whether a rule is a managed rule by using ``DescribeRule`` or ``ListRules`` and checking the ``ManagedBy`` field of the response.

    

  
  
  :returns: None
  **Exceptions**
  
  *   :py:class:`EventBridge.Client.exceptions.ConcurrentModificationException`

  
  *   :py:class:`EventBridge.Client.exceptions.ManagedRuleException`

  
  *   :py:class:`EventBridge.Client.exceptions.InternalException`

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

  