Search code examples
amazon-web-servicesaws-cliamazon-cloudwatch

An error occurred (ValidationException) when calling the DeleteRule operation: Rule can't be deleted since it has targets


I got this issue when deleting event on aws cloudwatch

An error occurred (ValidationException) when calling the DeleteRule operation: Rule can't be deleted since it has targets.

My command line is :

aws events delete-rule --name event-schedule --force

Solution

  • I got the solution, we should remove target first:

    aws events remove-targets --rule event-schedule --ids dev-transaction

    then delete-rule:

    aws events delete-rule --name event-schedule