Slide 1

Slide 1 text

Build Event-Driven Architectures with AWS Lalit Kale Principal Software Engineer - Verizon Connect Effortlessly

Slide 2

Slide 2 text

Lalit Kale ● Principal Software Engineer, Verizon Connect ● Dublin, Ireland ● First AWS Use: 2006 https://www.linkedin.com/in/lalitkale/ @atechiethought

Slide 3

Slide 3 text

Agenda ● What is Event Driven Architectures ● AWS Serverless Application Integration Services ○ AWS Lambda ○ Selecting Right Messaging service: SQS, SNS and Eventridge ○ Application Integration Patterns support ● Amazon EventBridge ● Use Cases

Slide 4

Slide 4 text

Current Landscape Large Systems (couple of years ago) ● Few Kb of internet speed ● Couple of giant single core servers ● Seconds of response time ● Hours of offline maintenance ● Data size in Gigabytes Large Systems (Today & Future) ● GBs scale internet speed ● Thousands of multicore servers ● Milliseconds of response time ● Users expect 100% uptime ● Data size in Petabytes and Zetabytes

Slide 5

Slide 5 text

Reactive Systems

Slide 6

Slide 6 text

The big idea is "messaging" - Alan Kay src: https://wiki.c2.com/?AlanKayOnMessaging

Slide 7

Slide 7 text

"If your application is cloud-native or, large scale or, distributed, and doesn't include a messaging component, that is probably a bug." - Tim Bray Former Sr. Principal Engineer, AWS src: https://wiki.c2.com/?AlanKayOnMessaging

Slide 8

Slide 8 text

Communication Synchronous Communication Asynchronous Communication Face To Face Video Conferencing Email

Slide 9

Slide 9 text

Types of Communication Synchronous Communication Asynchronous Communication

Slide 10

Slide 10 text

Types of Messages Commands ● "I Intent to …" ● Can be rejected by receiver ● Represented as verbs in present tense, e.g. "create_customer" ● Source system is aware of side effects that command processing will have Events ● Something has happened ● Immutable—cannot change the past ● Represented as verbs in the past tense, e.g. “customer_created” ● Source system has no expectations on how an event is processed

Slide 11

Slide 11 text

Event Driven Architecture Event driven architecture is a distributed asynchronous integration pattern to create highly scalable and loosely coupled reactive applications Events drives the data processing

Slide 12

Slide 12 text

Advantages of Event driven architecture ● Loose coupling between components/services ● Ability to scale individual components ● Processing components can be developed independent of each other ● Fault Tolerance and better resiliency ● Improved Availability ● Evolutionary architecture ● Business Agility

Slide 13

Slide 13 text

Challenges with Event Driven Architectures ● Consistency Model mindshift - Eventual Consistency ● Observability of Event Pipelines ● Immutable Consumers ● Error Handling ● Event Replay Scenarios

Slide 14

Slide 14 text

Challenges with Event Driven Architectures ●

Slide 15

Slide 15 text

Event Driven Architecture Event driven architecture is a distributed asynchronous integration pattern to create highly scalable and loosely coupled reactive applications

Slide 16

Slide 16 text

Enterprise Integration Patterns ● Point to Point channel ● Pub-Sub pattern ● Message Router ● Event Bus

Slide 17

Slide 17 text

Event Driven Architectures with AWS Serverless

Slide 18

Slide 18 text

Serverless Story is incomplete without...

Slide 19

Slide 19 text

AWS Lambda Execution Models

Slide 20

Slide 20 text

AWS Lambda Destinations

Slide 21

Slide 21 text

AWS Serverless Application Integration Services

Slide 22

Slide 22 text

Service Selection Criteria Scale & Concurrency Controls Durability Persistence Consumption Retries Pricing

Slide 23

Slide 23 text

AWS Serverless Application Integration Services Amazon SQS Durable and scalable Buffer and Batching support Comprehensive security point to point channel Amazon SNS Performance at Scale Enterprise Ready, Deliver to endpoints like email, SMS, Https, Push Notifications Fan-Out, Pub-Sub Amazon EventBridge Serverless event bus for AWS Services, your own apps and SaaS providers Event Bus

Slide 24

Slide 24 text

Failures and Retries Amazon SQS Amazon SNS Amazon EventBridge Delete Message. Redrive policy for failed messages. Retry policy for different protocols Event Retention and Replay Retry upto max. 14 days Retry upto 23 days Retry upto 24 hours Dead Letter Queue Dead Letter Queue Dead Letter Queue Exactly once with FIFO Exactly Once with FIFO Topic

Slide 25

Slide 25 text

Amazon EventBridge ● Serverless, Pay as you go ● 90+ AWS Services as sources ● 17+ AWS services as targets ● Native integrations with SaaS Providers ● $1 per million events put into the bus ● No additional cost of delivery ● Cross Account, Cross Region

Slide 26

Slide 26 text

Amazon EventBridge

Slide 27

Slide 27 text

Amazon EventBridge - Events and Rules { "version": "0", "id": "3e3c153a-8339-4e30-8c35-687ebef853fe", "detail-type": "EC2 Instance Launch Successful", "source": "aws.autoscaling", "account": "123456789012", "time": "2015-11-11T21:31:47Z", "region": "us-east-1", "resources": [], "detail": { "eventVersion": "", "responseElements": null } } Example Event Example Rule { "source": ["aws.autoscaling"] }

Slide 28

Slide 28 text

● Source of truth for sharing schema ● Explicitly published and auto-discovered ● Integrations for IDEs like Jetbrains and VS Code ● Language Bindings available for Java, Python and Typescript Amazon EventBridge - Schema Registry and Discovery

Slide 29

Slide 29 text

Amazon EventBridge - Event Archive and Replay

Slide 30

Slide 30 text

When Amazon EventBridge is not best fit? ● Ordering Guarantees ● Event Deduplication ● Push Delivery ● Ultra Low latency ● Non-JSON Transport

Slide 31

Slide 31 text

Event Modelling CloudEvents - A specification for describing event data in a common way ● Consistent schema across all your events ● Many Language SDK available - Java, GoLang, Python, Rust etc ● Portable Across AWS, GCP, Azure ● CNCF Serverless Group supported ● https://cloudevents.io/

Slide 32

Slide 32 text

Event Driven Architectures - Infrastructure as Code Support ● https://serverlessland.com/ ● https://cdkpatterns.com ● Use patterns to quickly build integrations using AWS SAM and CDK templates. ● 70+ Templates ● You can contribute to it!

Slide 33

Slide 33 text

EventBridge - Real Time Threat Mitigation

Slide 34

Slide 34 text

Loan Broker Use case src: https://www.enterpriseintegrationpatterns.com/patterns/messaging/ComposedMessagingExample.html

Slide 35

Slide 35 text

● Receive the consumer's loan quote request ● Obtain credit score and history from credit agency ● Determine the most appropriate banks to contact ● Send a request to each selected bank ● Collect responses from each selected bank ● Determine the best response ● Pass the result back to the consumer Loan Broker Use case - Processing Flow src: https://www.enterpriseintegrationpatterns.com/patterns/messaging/ComposedMessagingExample.html

Slide 36

Slide 36 text

Loan Broker Use case src: https://www.enterpriseintegrationpatterns.com/patterns/messaging/ComposedMessagingExample.html

Slide 37

Slide 37 text

Summary ● event driven architectures are essential complexity for large scale decoupled applications ● Awareness of enterprise integration patterns will ease out the journey through event driven architectures ● For choosing the aws service for your scenarios, compare scale, durability, persistence and consumption models, retries and pricing. ● Adopting AWS serverless services like EventBridge ease out complex implementations like content filtering and event replays and cross account, cross region scenarios. ● You can compose solution by combining multiple patterns and services ● Utilize IaC templates available in open source or build your own.

Slide 38

Slide 38 text

Further Reading ● http://www.sosp.org/2001/papers/welsh.pdf ● https://www.enterpriseintegrationpatterns.com/ ● https://aws.amazon.com/blogs/compute/introducing-cross-region-event-routing-with-amazon-eventbridge/ ● https://aws.amazon.com/blogs/compute/building-well-architected-serverless-applications-introduction/ ● https://serverlessland.com/patterns

Slide 39

Slide 39 text

Q & A

Slide 40

Slide 40 text

Thank You!

Slide 41

Slide 41 text

Extras

Slide 42

Slide 42 text

Amazon EventBridge - Pricing AWS Service Events Free Custom Events $1/ million events published Third Party Events $1/ million events published Cross Account Events $1/ million cross-account events sent Schema Discovery $0.10 / million events ingested Archive Processing $0.12 per GB Storage Month $0.0025 per GB

Slide 43

Slide 43 text

SQS, SNS, EventBridge Amazon SQS Amazon SNS Amazon EventBridge Messaging 1 to 1 1 to Many 1 to Many Event Type Single Event Type Single Event Type Multiple Event Type Route Messages Single Single Multiple Rules Filter Messages No Only to Message Body Full Message Allow transformation? No No Yes Cross Account Yes Yes Yes Message Latency Low Low Moderate Throughput High High Moderate