- Newest
- Most votes
- Most comments
Yes, EventBridge does support Amazon API Gateway endpoints as targets. When you specify an API Gateway endpoint as a target, each event sent to the target maps to a request sent to the endpoint. EventBridge supports both Edge-optimized and Regional endpoints as targets.
Based on the error you're receiving (404 Not Found), it appears the issue is with how the endpoint URL is being constructed rather than a lack of support. When using API Gateway as an EventBridge target, the JSON event information is sent as the body of the HTTP request to the endpoint.
Here are a few things to check:
-
Endpoint Configuration: Make sure you're specifying the correct API Gateway endpoint ARN when setting up the target, not just the invoke URL.
-
HTTP Parameters: You can specify additional request attributes in the target's HttpParameters field, including PathParameterValues, QueryStringParameters, and HeaderParameters. This allows you to properly configure how EventBridge invokes your API.
-
IAM Permissions: Ensure you have the correct IAM role with appropriate permissions for EventBridge to invoke the API Gateway endpoint.
-
Stage Configuration: Verify that your API Gateway stage is properly deployed and that the route/resource you're trying to invoke actually exists at that path.
The 404 error suggests that the endpoint path EventBridge is trying to reach doesn't exist in your API Gateway configuration. Double-check your API Gateway routes and ensure the path matches what EventBridge is attempting to invoke.
Sources
Amazon API Gateway targets for rules in Amazon EventBridge - Amazon EventBridge
Target - Amazon EventBridge
EventBridge can target API Gateway, but the target integration is for API Gateway “execute-api” ARNs (REST API style) and it invokes a specific METHOD/PATH—it’s not “any URL”. The 404s you’re seeing usually come from one of these gaps:
- You used the invoke URL instead of the execute-api ARN (EventBridge expects an ARN that includes stage + HTTP method + resource path). (AWS Documentation)
- EventBridge sends the event as the HTTP request body and (in practice) you must have a matching route for that method (often POST or ANY). (AWS Documentation)
- For HTTP APIs,
$defaultstage is served from the base URL (no/$defaultprefix). If something tries to call.../$default/..., you’ll get 404. (AWS Documentation)
CLI example (Rule → API Gateway target)
aws events put-targets --rule my-rule --targets "[ { \"Id\":\"apigw\", \"Arn\":\"arn:aws:execute-api:us-east-1:123456789012:API_ID/dev/POST/myendpoint\" } ]"
If your API is HTTP API and you can’t make the execute-api ARN/method match cleanly, the most reliable pattern is: EventBridge → API Destination (HTTP endpoint) instead of the API Gateway target. (AWS Documentation)
Venkata Thej Deep Jakkaraju, thanks for your response. My question was if EventBridge supports exactly HTTP API GW (v2) endpoint as a target.
For the API endpoint as a target of the EventBridge rule I need to pass API GW execute-api ARN with the stage (otherwise there will be an error during applying the changes, in my case it was an error in terraform apply), so when the stage is $default the execute-api ARN looks like "arn:aws:execute-api:<region>:<account_id>:<api_id>/$default/<method>/<endpoint>", and when the rule is triggered, the EventBridge constructs the invoke URL by itself (depending on the parameters from the execute-api ARN), and then this error comes 'Got status code "404" while trying to invoke "POST https://<api_id>.execute-api.<region>.amazonaws.com/%24default/<endpoint>". (Service: api_gateway; Status Code: 404; Error Code: Not Found; Request ID: null; Proxy: null)' I understand that there should not be $default prefix in the invoke URL in case of the $default stage. But again:
- I need to pass stage into execute-api ARN (because it is required by EventBridge)
- EventBridge constructs the invoke URL (depending on the execute-api ARN)
And also as I mentioned in my question I added not default stage (dev stage) to my HTTP API GW for the testing purposes, but still received the same error: 'Got status code "404" while trying to invoke "POST https://<api_id>.execute-api.<region>.amazonaws.com/dev/<endpoint>". (Service: api_gateway; Status Code: 404; Error Code: Not Found; Request ID: null; Proxy: null)'
I’m aware of EventBridge API Destinations, but that option doesn’t fit my use case because my API Gateway HTTP API (v2) endpoint is protected with IAM authorization, and I don’t want to change its auth model.
I already have alternative implementation options, so this isn’t a blocker for me. I’m specifically trying to confirm whether EventBridge currently supports API Gateway HTTP API (v2) endpoints as direct rule targets, and if not, whether there are plans to add that support in the future.
