Skip to content

New serverless pattern - Eventbridge to AppSync Events API #2712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Apr 23, 2025

Conversation

rprentyaws
Copy link
Contributor

Issue #, if available: N/A.

Description of changes: Introducing a pattern which demonstrates how to send events from EventBridge to AppSync Events API, allowing consumers to receive events over WebSockets.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed

@@ -0,0 +1,102 @@
# AWS EventBridge to AWS AppSync Events
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# AWS EventBridge to AWS AppSync Events
# Sending events from Amazon EventBridge to AWS AppSync Events


This pattern demonstrates how you can send events from EventBridge to an AppSync Events API. This will allow you to consume events in real-time over WebSockets. This stack will deploy the following resources:

- **EventBridge EventBus**: Use this event bus to send messages to for testing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **EventBridge EventBus**: Use this event bus to send messages to for testing.
- **EventBridge event bus**: Use this event bus to send messages to for testing.


## How it works

A new EventBus is created with a rule to catch events in your account which match a specified detail-type. These events are then sent to an API Destination which is an AppSync Events API. If there are errors delivering these events to your Events API, they will be delivered to a DLQ where you can inspect what went wrong.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A new EventBus is created with a rule to catch events in your account which match a specified detail-type. These events are then sent to an API Destination which is an AppSync Events API. If there are errors delivering these events to your Events API, they will be delivered to a DLQ where you can inspect what went wrong.
A new EventBridge event bus is created with a rule to catch events in your account which match a specified detail-type. These events are then sent to an API Destination which is an AppSync Event API. If there are errors delivering these events to your Events API, they will be delivered to a dead-letter queue (DLQ) where you can inspect what went wrong.

```

----
Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.


## Testing

### Set up your Events API to listen to events
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Set up your Events API to listen to events
### Set up your Event API to listen to events

## Testing

### Set up your Events API to listen to events
- Go to your pre-existing Events API in the console.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Go to your pre-existing Events API in the console.
- Go to your pre-existing Event API in the AppSync console.


**Check the Event Bus Name**: Ensure you are sending test messages to the correct event bus (name is in the outputs of the stack) with "detail type" of `serverless-patterns`. This example won't work on the default event bus.

**Events not arriving to Events API Console**: Go to the SQS console, find the SQS queue created by this stack (which is your DLQ) and poll for messages. Any errors should be shown in the attributes tab of the messages.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Events not arriving to Events API Console**: Go to the SQS console, find the SQS queue created by this stack (which is your DLQ) and poll for messages. Any errors should be shown in the attributes tab of the messages.
**Events not arriving to Event API Console**: Go to the SQS console, find the SQS queue created by this stack (which is your DLQ) and poll for messages. Any errors should be shown in the attributes tab of the messages.


**Events not arriving to Events API Console**: Go to the SQS console, find the SQS queue created by this stack (which is your DLQ) and poll for messages. Any errors should be shown in the attributes tab of the messages.

**No messages in DLQ**: Double check that you have subscribed to the correct namespace/channel `default/serverless-patterns` in the Events API Console. Triple check you are sending messages to the correct event bus.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**No messages in DLQ**: Double check that you have subscribed to the correct namespace/channel `default/serverless-patterns` in the Events API Console. Triple check you are sending messages to the correct event bus.
**No messages in DLQ**: Double check that you have subscribed to the correct namespace/channel `default/serverless-patterns` in the Event API Console. Triple check you are sending messages to the correct event bus.

"link": "https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-transform-target-input.html"
},
{
"text": "Amazon AppSync - Creating an Events API",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"text": "Amazon AppSync - Creating an Events API",
"text": "Amazon AppSync - Creating an Event API",

@rprentyaws rprentyaws requested a review from bfreiberg April 15, 2025 08:53
Copy link
Contributor

@bfreiberg bfreiberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for your contribution. Your pattern will be merged to Serverlessland soon.

@julianwood julianwood merged commit 73e9fd5 into aws-samples:main Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants