0

I am using terraform destroy to destroy some resource. However it failed at this step:

  • module.restore_db_from_snapshot.aws_cloudwatch_event_rule.event_rule: aws_cloudwatch_event_rule.event_rule: AccessDeniedException: User: arn:aws:sts::941225788888:assumed-role/delete/anthony_credentials is not authorized to perform: events:DescribeRule on resource: arn:aws:events:us-east-2:941225788888:rule/dev-crazy_rule status code: 400, request id: da4284e5-3b00-4a24-9798-fcb6915c94cb

Apparently my profile does not have sufficient right to call events:DescribeRule. However I think my profile still have the permission to drop it.

That's why I want to use aws cli to directly drop the event rule, maybe with the ARN as shown in the error message.

However when I check the cloudwatch subcommandd, it does not have any delete of event rules.

Is it possible for me to drop the event rule via aws cli?

Anthony Kong
  • 2,976
  • 10
  • 53
  • 91

2 Answers2

1

You need to use the events service delete-rule subcommand:

aws events delete-rule --name <rule_name>

You need to also make sure you have deleted any of the event's targets with events remove-targets.

danimal
  • 126
  • 4
0

Bit old question but, I made a bash script to automate it:

https://gist.github.com/maurostorch/0a03da8770f9c798d964cb67befae935