# Amazon EventBridge to Amazon SQS This project contains sample AWS CDK code to create an EventBridge Rule, as well as, an SQS Queue. The EventBridge Rule publishes matched events to the SQS Queue. In this example, the rule filters for specific attributes in the event before sending the event to the Queue. Important: this application uses various AWS services and there are costs associated with these services after the Free Tier usage - please see the [AWS Pricing page](https://aws.amazon.com/pricing/) for details. You are responsible for any AWS costs incurred. No warranty is implied in this example. ## Deploy Run `cdk deploy`. This will deploy / redeploy your Stack to your AWS Account. ## Testing Use the [AWS CLI](https://aws.amazon.com/cli/) to send a test event to EventBridge and observe the event delivered to the Lambda function by reviewing the Amazon CloudWatch Logs associated with the function: 1. Send an event to the custom EventBridge Bus. Note that Custom Bus Name is in the `event.json` file) : ```sh aws events put-events --entries file://event.json ``` 2. Retrieve the Message from SQS, referencing the SQS Queue URL from the Outputs section of the deployed Stack, to see a Message matching this example: ```sh aws sqs receive-message --queue-url ``` ```json { "Messages": [ { "MessageId": "db759882-e6fe-4d50-8c19-c09f1ae8c87e", "ReceiptHandle": "AQEBwhNNAlv...Sgd0VL", "MD5OfBody": "ad70b8...123f", "Body": "{\"version\":\"0\",\"id\":\"def5aa42-ab94-bc96-0794-3f2bcd143e76\",\"detail-type\":\"message-for-queue\",\"source\":\"my-cdk-application\",\"account\":\"123456789012\",\"time\":\"2021-10-08T18:43:15Z\",\"region\":\"us-west-2\",\"resources\":[],\"detail\":{\"message\":\"Hello CDK world!\"}}" } ] } ``` ## Synthesize Cloudformation Template To see the Cloudformation template generated by the CDK, run `cdk synth`, then check the output file in the "cdk.out" directory.