Ch12
Application Integration🔗
Amazon EventBridge🔗
-
Problems with monoliths
- tightly coupled
- single point of failure
- scaling certain parts is not possible
- Monolith ------> Microservices
- Each Microservice would have their teams, resources etc.
-
Issues with Microservices
- Noisy communication between several services might introduce inefficiencies.
- Sometimes team communication becomes difficult in microservices.
Event Based Architecture
- Services are more decoupled
- Services will wait for a flag (event) to be sent from upstream and then action will be taken based on event.
Amazon EventBridge : An event co-ordinator
- Events are json made of strings and define some activity
- [IMP] : version, id, detail_type, src, account, time, region, resources, details : are common option among all events.
- The only event-based service that integrates directly with third party support. Eg. Zendesk, Auth0, Segments, etc.
Event Bus : Like a funnel that catches events generated by all AWS Services.
- Each account comes with a default event bus.
- Event Bus has upto 100 event rules.
Rule : allows to filter a large number of events.
- [IMP] Rules are not processed in an order.
- We need to specify targets. (EC2, Kinesis, ECS, Lambda)
AWS Supports Cross-Account Events.
Event Bridge is just CloudWatch with new features and support for SAAS(Software as a Service) products.
Replaying Events and EventBridge Archives🔗
- Event Bridge Archives
- Greate to store as a backup
- No Cost to Store
- Replay Events
- Schema registry : Defines the structure of Event and helps describes what can you expect from event.
- comes with pre-written schema for all AWS Service, and for few SAAS providers.
- Schema can be generated automatically.
SNS (Simple Notification Service)🔗
- Publish/subscribe messaging service
- managed, highly scalable
- SNS is mostly used as a producer for SQS Queue
- Another Pattern
SQS (Simple Queue Service)🔗
- capability of sending storing and recieving messages at scale without dropping message data.
- Dead-letter-queue : Queue where dead letters/letters which are not cosumed are put at.
- DLQ must be same type as the queue it is supposed to get letters from.
MODEL
- Producers puts data in Queue
- Consumers consumes data from Queue
- Deletes data from queue : If processed
- Puts back : If not processed
Standard Queue
- At least once delievary of message
- provides almost unlimited number of txn/sec
- Best Effort to preserve order (not necessary)
FIFO Queue
- Order is maintained (condition)
- limited #TXN/sec (default 30 TPS)
- Batching allows to perform action against 10 messages at once with a single action
- Exactly once processing
AWS Step Functions🔗
- Lambda has limited flexibility and execution time limit of 15 min.
- Step Function : State Machine Services
- Parallel
- Sequential
- In-Retry
- If-Then
- States of Step Functions :
- PASS
- TASK
- CHOICE
- WAIT
- SUCCESS
- FAIL
- PARALLEL
- MAP
Important Comparisons for AWS Exam
EventBridge
- A very complex and sophisticated service
SNS
- limited parameters
- easily scales to millions
- No direct connectivity to Saas
- Limited Routing Capability
- Difficult to trigger Step Function
- Filtering is limited to attributes only