Amazon EventBridge API Destinations configuration for MongoDB

EventBridge rule → Connection → API

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

This pattern creates an API Destination for the MongoDB API. Once deployed, the pattern allows user to send events easily through Event Bridge to MongoDB to write data into database. The pattern creates the following resources: Event Bridge Bus, Event Bridge Connection, Event Bridge API Destination, Event Bridge Rule, IAM Role, and SQS Queue.
The EventBridge rule uses the API Destination and Connection as a target, SQS Queue as a DLQ, and the IAM role as its role. To send events go to the bus and send sample events. To create a ticket enter “MyTestMessage” for the detail type, “MyTestApp” for the source, the bus created by the pattern for the Event Bus Name, and any call that follows the format for the MongoDB API as detail (https://docs.mongodb.com/realm/endpoints/).
The following information is needed to use the pattern: MongoDB Api-Key and Password: To create the AUTH for the Event Bridge Connection.
The IAM Role created by the pattern only has the permission to allow InvokeApiDestination access to the EventBridge Rule.
To work the user must have Password Access enabled in MongoDB (https://docs.mongodb.com/realm/authentication/api-key/)

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

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

Deploy

cd ./4-mongodbsam deploy --guided


Testing

See the GitHub repo for detailed testing instructions.

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:

Camilla Somtakoune

Camilla Somtakoune

AWS Solutions Architect