0% found this document useful (0 votes)
3 views

API201_Serverlesspresso-Building-event-driven-applications-from-the-start

The document outlines a workshop on building serverless, event-driven applications using AWS services, focusing on deploying backend resources, creating workflows, and configuring frontends. Participants will utilize tools like AWS EventBridge, Step Functions, and IoT Core to manage drink orders in a simulated environment. The session includes hands-on coding and real-time messaging features for frontend applications.

Uploaded by

Ramkumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

API201_Serverlesspresso-Building-event-driven-applications-from-the-start

The document outlines a workshop on building serverless, event-driven applications using AWS services, focusing on deploying backend resources, creating workflows, and configuring frontends. Participants will utilize tools like AWS EventBridge, Step Functions, and IoT Core to manage drink orders in a simulated environment. The session includes hands-on coding and real-time messaging features for frontend applications.

Uploaded by

Ramkumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.

API201

Serverlesspresso:
Building event-driven
applications from the start
Benjamin Smith
Principal Developer Advocate, Serverless
AWS

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda

The workshop environment

The modules and services used

Coding

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
General housekeeping

• Running time is 2 hours


• Use the provided AWS account
• Questions? We are here to help!

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The AWS services you will be using today

Developer tooling
AWS Management AWS CloudShell
Console

Focus of this workshop


Amazon AWS AWS
EventBridge Step Functions IoT Core

Deployed with the


core template AWS Amazon API Amazon SNS Amazon
Lambda Gateway DynamoDB

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS re:Invent Multiple AWS Summits and developer
1,920 orders events around the world
71 drinks per hour
3 minutes and 34 seconds of further reading

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS re:Invent 2022

• 1,920 drinks in re:Invent


• 71 drinks per hour
• Appeared at AWS Summits,
EDA Day, GOTO, and others
• Averages 1,000 order/day

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Setup – The core resources
AWS account

Frontends EventBridge Step Functions


Order manager service
Event bus Order processing workflow
REST API
Events

API Step DynamoDB Events


Gateway Functions table
Ordering
app
QR validator service

REST API
Events
Display API Lambda DynamoDB
app Gateway function table

Events
Publisher service
WebSocket
API
Barista Events
app AWS Lambda
IoT Core function

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Today’s adventure

• Setup
Deploy the backend core resources
• Module 1: Building the workflow
Build the order processing workflow that manages the drink orders
through production
• Module 2: Routing events
Create event rules to route events across microservices
• Module 3: Configuring the frontends
Configure the frontend applications to connect to the backend that
you’ve built so far, and send some test orders

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Serverless systems scale easily – Humans don’t

Barista

Order

Order
app

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Order processor service
Orchestrates each order from start to completion

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Step Functions
FULLY MANAGED STATE MACHINES ON AWS

• Pay per use


• Scales automatically
• Fully managed
• Drag and drop or ASL
• Built-in error handling
• Integrates with over
200 AWS services

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Today’s adventure

• Setup
Deploy the backend core resources
• Module 1: Building the workflow
Build the order processing workflow that manages the drink orders
through production
• Module 2: Routing events
Create event rules to route events across microservices
• Module 3: Configuring the frontends
Configure the frontend applications to connect to the backend that
you’ve built so far, and send some test orders

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Communicating between microservices
USING AMAZON EVENTBRIDGE FOR CHOREOGRAPHING MICROSERVICES

AWS Cloud

• Event flow drives the application


Order Events EventBridge

• Events choreograph the services, manager Event bus


service

while Step Functions


QR Events
orchestrates the transactions validator
service

• Add new microservices as event Events Events


Order
Publisher
consumers without changing service
processing
workflow

existing code Order Events


EventBridge
• Microservices emit events
journey
rules
service

independently of consumers Config Events


service

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
• Serverless – pay only for the
Amazon events you process
EventBridge • Simplified scaling avoids
increasing costs of sustaining and
A serverless event bus service managing resources
for AWS services, your own
applications, and SaaS • No upfront investments, ongoing
providers licensing, or maintenance costs

• No specialist knowledge needed

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Today’s adventure

• Setup
Deploy the backend core resources
• Module 1: Building the workflow
Build the order processing workflow that manages the drink orders
through production
• Module 2: Routing events
Create event rules to route events across microservices
• Module 3: Configuring the frontends
Configure the frontend applications to connect to the backend that
you’ve built so far, and send some test orders

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The frontend applications
VUE.JS APPS HOSTED WITH AWS AMPLIFY CONSOLE

1. Ordering app 2. TV display app 3. Barista app


• Loads menu • Shows current • Shows incoming orders
• Scans barcode to get barcode • Enables order
order token • Receives order status completion or
• Sends order updates cancellation

• Displays updates • Listens for store • Enables store


open/close events open/close events

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Handling async responses
with real-time updates

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Using AWS IoT Core for real-time messaging

Frontend application uses pub-sub to “listen” for event updates

Frontend application AWS Cloud

Subscribe to topic Subscriptions AWS IoT Core


1
Messages
Publishing
AWS SDK Messages IoT topic
function

Frontend uses AWS SDK to subscribe to a topic based on user’s unique user ID

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Using AWS IoT Core for real-time messaging

Frontend application uses pub-sub to “listen” for event updates

Frontend application AWS Cloud

Subscribe to topic Subscriptions AWS IoT Core

Messages
2 Publishing
AWS SDK Messages IoT topic
function

Receives messages published by the backend to this topic

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Using AWS IoT Core for real-time messaging

Frontend application uses pub-sub to “listen” for event updates

Frontend application AWS Cloud

Subscribe to topic Subscriptions AWS IoT Core

3 Messages
Publishing
AWS SDK Messages IoT topic
function

Messages are categorized using topics; topic names are UTF-8 encoded strings

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s get started: https://s12d.com/api201
1. Email one-time password 3. Review terms and join event

2. Enter email and wait for passcode

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
#serverlesspresso

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank you! Please complete the session
survey in the mobile app

Benjamin Smith
@Benjamin_l_s

© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.

You might also like