Amazon EventBridge
How to list EventBridge rule names by target
Pass the target ARN to ListRuleNamesByTarget for a paginated inventory on one event bus. Use the AWS CLI when you want the rule names in your terminal.
Documentation reviewed · 2 methods with sources
Ways to do it
API
ListRuleNamesByTarget
Read the names of rules that invoke a target ARN on an event bus. Omitting EventBusName selects the default bus.
Read source: Amazon EventBridge ListRuleNamesByTarget API- Requirements
- An AWS Signature Version 4 signed request from a principal allowed events:ListRuleNamesByTarget, the target ARN, and the Region for the event bus. The IAM action uses Resource *.
- Limitations
- The API returns up to 100 rule names per page. Continue with NextToken and the same arguments. Expired tokens return InvalidToken.
Example text
POST / HTTP/1.1
Host: events.us-east-1.amazonaws.com
Content-Type: application/x-amz-json-1.1
X-Amz-Target: AWSEvents.ListRuleNamesByTarget
{"EventBusName":"example-bus","TargetArn":"arn:aws:lambda:us-east-1:111122223333:function:example","Limit":50}CLI
aws events list-rule-names-by-target
List matching rule names with the AWS CLI, which follows service pages automatically.
Read source: AWS CLI list-rule-names-by-target- Requirements
- AWS CLI v2, credentials allowed events:ListRuleNamesByTarget, the target ARN, and the event bus Region.
- Limitations
- --page-size controls the service request, while --max-items caps command output. Pass a CLI continuation token to --starting-token.
Example shell
aws events list-rule-names-by-target --region "$AWS_REGION" \
--event-bus-name "$EVENT_BUS" --target-arn "$TARGET_ARN" --output json