Amazon EventBridge to AWS Lambda to Amazon SNS

EventBridge → AWS Lambda → Amazon SNS

Create an EventBridge rule with SNS topic as target which has a Lambda function as subscription.

This Terraform code deploys an EventBridge rule with an SNS topic target which has a Lambda function as a subscriber and the IAM permissions required to run the application. Whenever the EventBridge rule gets triggered, the Lambda function is invoked by the SNS topic. It also deploys the resources and the IAM permissions required to run the application.
In this example, the EventBridge rule specified in `main.tf` filters the events based upon the criteria in the `aws_cloudwatch_event_rule` block. When matching events are sent to EventBridge that trigger the rule, they are delivered as a JSON event payload to the SNS topic.
The SNS topic further invokes and delivers the message payload to the subscribed Lambda function defined in the `aws_lambda_function` block.

< 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-sns-lambda-terraform

Deploy

terraform initterraform apply


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

terraform destroy
terraform show

Created by:

Simranjit Kaur Mann

Simranjit Kaur Mann

Cloud Engineer, Serverless team at AWS Sydney, Australia