Sandro Volpicella
Sandro Volpicella

@sandro_vol

9 Tweets 5 reads Dec 31, 2022
You heard me tweeting a lot about Amazon Eventbridge. But what is it actually?
Learn about the power of event-driven architectures with Amazon EventBridge in this thread.
๐Ÿงต 1/8
๐‚๐จ๐ฆ๐ฉ๐จ๐ง๐ž๐ง๐ญ๐ฌ ๐Ÿ—๏ธ
There are three main components in EventBridge
1. Event Bus
2. Event Rule
3. Targets
๐„๐ฏ๐ž๐ง๐ญ ๐๐ฎ๐ฌ ๐ŸšŒ
The event bus receives all events. Each AWS account has a default event bus.
Internal AWS events are sent to this bus. For example:
โ€ข EC2 was created
โ€ข ECS task state changed
Custom or partner events can use these event buses to send their events
๐‘๐ฎ๐ฅ๐ž ๐Ÿ‘ฎ๐Ÿฝโ€โ™‚๏ธ
Rules define how to route incoming events. Each rule follows an event pattern.
This rule matches the whole event body.
Examples of that can be:
โ€ข Value is null: "๐š๐šŠ๐š๐šŠ":[๐š—๐šž๐š•๐š•]
โ€ข Value equals something "๐š—๐šŠ๐š–๐šŽ": ["๐š‚๐šŠ๐š—๐š๐š›๐š˜"]
๐“๐š๐ซ๐ ๐ž๐ญ ๐ŸŽฏ
The target is the subscriber of an event. This is the native integration with an AWS Service like
โ€ข Lambda
โ€ข SNS
โ€ข SQS
Once the rule matches the event will be sent to the target.
These are all main components, let's take a look at more features โญ๏ธ
๐‚๐ซ๐จ๐ง ๐‰๐จ๐›๐ฌ โŒš
Cron jobs are regularly executed scripts. EventBridge allows you to call jobs a regular intervals.
The interval is either a schedule like ๐š›๐šž๐š— ๐šŽ๐šŸ๐šŽ๐š›๐šข ๐š–๐š’๐š—๐šž๐š๐šŽ or it follows a CRON syntax like ๐Ÿถ ๐Ÿท๐Ÿถ * * ? *
๐€๐ซ๐œ๐ก๐ข๐ฏ๐ž & ๐‘๐ž๐ฉ๐ฅ๐š๐ฒ ๐Ÿ”
Archives allow you to save all incoming events to an archive
With replays, you can replay all events from an archive back to the bus
This is really helpful for:
โ€ข Having prod data on dev
โ€ข Repeating data after fixing a bug
๐’๐œ๐ก๐ž๐ฆ๐š ๐๐ข๐ง๐๐ข๐ง๐ ๐ฌ ๐ŸŽ—๏ธ
EventBridge has automated schema discovery & bindings.
It detects the schema of incoming events and creates an API spec for you.
This API spec can be used to create TypeScript types.
That's it ๐ŸŽ‰
That was a brief overview of EventBridge.
This is also available as a post on our engineering blog @hashnode: engineering.hashnode.com
The next parts will cover
โ€ข Subscription pattern
โ€ข Failure & Retries
โ€ข Validation of events with Middy & ZOD

Loading suggestions...