Amazon EventBridge API Destinations configuration

EventBridge rule → Connection → API

Create an EventBridge rule and API destination to route events to an external API

This pattern configures an EventRule rule that routes to an API Destinations target. It configures a Connection, which contains the authorization for the API endpoint, and the API, which contains the URL, http method, and other configuration information.
There are two examples in this repo - the first integrates with Webhook.site, an API debugging tool. The second integrates with Slack. See the GitHub repo for more information on deploying the Slack integration.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Launch Stack

Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/eventbridge-api-destinations

Deploy

cd ./1-webhook-sitesam deploy --guided


Testing

1. From a command line in this directory, send a test event to EventBridge simulating a "Payment failed" event: aws events put-events --entries file://testEvent.json
2. In the Webhook.site example, the API call appears in the dashboard.

Cleanup

1. Delete the stack: sam delete --stack-name STACK_NAME.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus"

Created by:

James Beswick

James Beswick

I am a self-confessed serverless geek and enjoy helping developers build faster with serverless! I have been software developer and product manager before becoming a Developer Advocate. Ask me anything!

Follow on LinkedIn