- Newest
- Most votes
- Most comments
There are several potential reasons why your EventBridge rule is not being invoked from your Bitbucket pipeline while it works from your local machine:
-
Region Mismatch: EventBridge is a regional service. If your Bitbucket pipeline is sending events to a different region than where your rule is created (us-west-1), the rule won't be triggered. Ensure that your pipeline is configured to send events to the same region where your rule is defined.
-
IAM Permissions: Even though you've provided a role with FULLACCESS permissions, there might be issues with the trust relationship. EventBridge needs specific permissions to invoke your target (EC2 instance). Make sure that:
- The role has a trust policy that allows the EventBridge service (events.amazonaws.com) to assume the role
- The role has permissions to execute commands on your EC2 instance
2a. EventBridge Permission: You need to provide permissions to BitBucket runner to invoke EventBridge. Eventbridge does not support BitBucket or Atlassian as a source, so you will need to configure the script to invoke EventBridge. If you are using BitBucket hosted runner, use IAM access keys or if you are using AWS hosted runner, you can configure an IAM role to the EC2.
-
Event Pattern Mismatch: The events coming from your Bitbucket pipeline might not match the event pattern defined in your rule. Check the event pattern in your rule and ensure it matches the events being sent from Bitbucket.
-
Target Configuration: Verify that the target EC2 instance is correctly configured in your rule, including any command parameters or input transformations.
-
Global Service Consideration: If you're monitoring events from AWS global services, note that these events are only available in the US East (N. Virginia) region (us-east-1). If your rule is related to a global service but created in us-west-1, it won't work.
To troubleshoot:
- Check CloudWatch metrics for your rule to see if it's being triggered
- Set up a dead-letter queue to capture any failed event deliveries
- Temporarily set up a simpler target (like an SNS topic) to verify if the rule is being triggered at all
- Ensure the EC2 instance is running and accessible when the events are sent
If the issue persists, you might want to consider creating a cross-region event routing setup if your events are being generated in a different region than us-west-1.
Sources
EventBridge rule not triggered | AWS re:Post
Troubleshooting Amazon EventBridge - Amazon EventBridge
EventBridge rule not working | AWS re:Post
Create an EventBridge rule for a CodeCommit source (CLI) - AWS CodePipeline
Create an EventBridge rule for an Amazon S3 source (CLI) - AWS CodePipeline
Relevant content
asked 2 years ago
asked 3 years ago
asked 3 years ago
- AWS OFFICIALUpdated 2 months ago
