SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Daniela Miao, Software Engineer, AWS, DynamoDB
October 2015
WRK302
Event-Driven Programming
With Amazon DynamoDB Streams and AWS Lambda
What to Expect from the Session
Why Amazon DynamoDB?
Amazon DynamoDB Basics
Amazon DynamoDB Streams
AWS Lambda
Building an event-driven application
Summary
Why Amazon DynamoDB?
Customers wanted a database with…
Reliably low latency at any scale
Elastic throughput and storage
Flexible queries and data models
Strong consistency
Availability and fault-tolerance
What Amazon DynamoDB Provides…
Fully-managed NoSQL database service
Consistent, single-digit millisecond latency
Independent throughput and storage scaling
Supports both document and key-value data models
Automatic data replication across three facilities
Amazon DynamoDB Basics
Data model
Tables: collection of items
Items: collection of attributes
Attributes: name-value pairs
• Scalar: number, string, binary, boolean, null
• Multi-valued: string set, number set, binary set
• Document: list, map
Data model
RecordID PlayerName Score NickName
1 Alice 999 AliceTheMalice
2 Bob 888
Sample table: GameRecords
• Note attributes can be optional
Primary key – hash
RecordID PlayerName Score NickName
1 Alice 999 AliceTheMalice
2 Bob 888
Hash type primary key: primary key is made of one attribute,
required for all items
55 A9 54
Distributing hash keys
Hash key uniquely identifies an item
Hash key is used for building an unordered hash index
00 FF
RecordId = 1
Name = Alice
Hash (1) = 7B
RecordId = 2
Name = Bob
Hash (2) = 48
RecordId = 3
Name = John
Hash (3) = CD
Key Space
55 A954 AA FF
Distributing hash keys
Table can be partitioned for scale
00 FF
RecordId = 1
Name = Alice
Hash (1) = 7B
RecordId = 2
Name = Bob
Hash (2) = 48
RecordId = 3
Name = John
Hash (3) = CD
Key Space
Primary key – hash and range
Customer# Order# Item
1 10 Shoes
1 11 Toys
2 11 Pen
Hash and range type primary key: the primary key is made of
two attributes, required for all items
Hash range table
Within an unordered hash index, data is sorted by the range key
00 FF
Hash (2) = 48
Customer# = 2
Order# = 10
Item = Pen
Customer# = 2
Order# = 11
Item = Shoes
Customer# = 1
Order# = 10
Item = Toy
Customer# = 1
Order# = 11
Item = Boots
Hash (1) = 7B
Customer# = 3
Order# = 10
Item = Book
Customer# = 3
Order# = 11
Item = Paper
Hash (3) = CD
55 A954 AA
Partition 1 Partition 2 Partition 3
Query and scan
A query operation finds items in a table using only primary key
attribute values.
• Hash key attribute-value pair is required
• Range key attribute-value pair is optional
• In the previous example, query for all orders of a specific customer by
setting “customer# = 1".
A scan operation examines every item in the table.
• Returns all of the data attributes for every item
Amazon DynamoDB Streams
Amazon DynamoDB StreamsAmazon DynamoDB Streams
Stream of updates to a table in a continous pipeline
Records all modifications made to items of the table
Scales with table size and throughput
StreamsTable
DynamoDB
Client Application Updates
Customer application
Amazon DynamoDB replicator using DynamoDB Streams
Copies incoming data to a different table in real-time
Blog post published describing the application
“DynamoDB delivers even more stability, redundancy, and speed for
our document-based data and requires less hands-on administration,
so we can focus on building the software that powers Mapbox.”
View Type Record Content
Old image—before update RecordID = 1, Name = Alice
New image—after update RecordID = 1, Name = Alison
Old and new images RecordID = 1, Name = Alice
RecordID = 1, Name = Alison
Keys only RecordID = 1
View types
UpdateItem: (RecordID = 1, Name = Alice)  (RecordID = 1, Name = Alison)
Entire image of the item is returned, not just the changes
Stream
Table
Partition 1
Partition 2
Partition 3
Partition 4
Partition 5
Table
Shard 1
Shard 2
Shard 3
Shard 4
KCL
Worker
KCL
Worker
KCL
Worker
KCL
Worker
Amazon Kinesis Client
Library Application
DynamoDB
Client Application
Updates
Amazon DynamoDB Streams and
Amazon Kinesis Client Library
Analytics with
Amazon DynamoDB Streams
Collect and de-dupe data in DynamoDB
Aggregate data in-memory and flush periodically
Performing real-time aggregation
and analytics
DynamoDB Streams
Open source cross-region
replication library
Asia Pacific (Sydney) EU (Ireland) Replica
US East (N. Virginia)
Cross-region replication
Cross-region replication library
Horizontal scaling
Bootstrapping existing items
Fault tolerance
Optimized for cost and performance
AWS Lambda
AWS Lambda
Event-driven compute in the cloud
Lambda functions: stateless, request-driven code
execution
• Triggered by events in other services: e.g., write to an
Amazon DynamoDB table
Ability to transform data as it reaches the cloud
AWS Lambda
Customers can focus on business logic, no need to
manage infrastructure
Lambda scales to match the event rate
Pay for only what you use
• Fine-grained pricing: purchase compute time in 100ms
increments
• No hourly, daily, or monthly minimums
Popular usage scenarios
Data triggers with Amazon S3 or Amazon DynamoDB
Audit and notify
• Monitor AWS CloudTrail logs and use Lambda functions to send
Amazon SNS notifications
Custom deployment rules using AWS CloudFormation
Validate cross-device sync data with Amazon Cognito
Custom events by publishing to Amazon Kinesis
Amazon DynamoDB Streams and Lambda
Sample Scenario
Amazon DynamoDB table
and Streams AWS Lambda
Send notification via
Amazon SNS
Update another table
Building
an event-driven application
Popular usage scenarios
Mobile gaming application
GameScoreRecords table
• Records of game scores
• Want to implement a list of aggregate scores for each user
GameScoresByUser table updated by AWS Lambda
Self-paced Hands-on Lab
Zip file included with the workshop package
Use lab guide to complete each exercise in your group
Solutions provided in a separate directory – do NOT use
unless truly stuck
Remember to complete
your evaluations!
Use QR code or link above to download the
group activity package and follow the lab guide.
http://reinventworkshop.s3.amazonaws.com/workshop.zip
Thank you!
After the break, there will be a group-based activity
to build an event-driven application

Weitere ähnliche Inhalte

Was ist angesagt?

Autoscale DynamoDB with Dynamic DynamoDB
Autoscale DynamoDB with Dynamic DynamoDBAutoscale DynamoDB with Dynamic DynamoDB
Autoscale DynamoDB with Dynamic DynamoDB
Sebastian Dahlgren
 

Was ist angesagt? (20)

AWS Cloud Kata 2014 | Jakarta - 2-3 Big Data
 AWS Cloud Kata 2014 | Jakarta - 2-3 Big Data AWS Cloud Kata 2014 | Jakarta - 2-3 Big Data
AWS Cloud Kata 2014 | Jakarta - 2-3 Big Data
 
Autoscale DynamoDB with Dynamic DynamoDB
Autoscale DynamoDB with Dynamic DynamoDBAutoscale DynamoDB with Dynamic DynamoDB
Autoscale DynamoDB with Dynamic DynamoDB
 
AWS Real-Time Event Processing
AWS Real-Time Event ProcessingAWS Real-Time Event Processing
AWS Real-Time Event Processing
 
AWS re:Invent 2016: How Amazon S3 Storage Management Helps Optimize Storage a...
AWS re:Invent 2016: How Amazon S3 Storage Management Helps Optimize Storage a...AWS re:Invent 2016: How Amazon S3 Storage Management Helps Optimize Storage a...
AWS re:Invent 2016: How Amazon S3 Storage Management Helps Optimize Storage a...
 
BDA305 NEW LAUNCH! Intro to Amazon Redshift Spectrum: Now query exabytes of d...
BDA305 NEW LAUNCH! Intro to Amazon Redshift Spectrum: Now query exabytes of d...BDA305 NEW LAUNCH! Intro to Amazon Redshift Spectrum: Now query exabytes of d...
BDA305 NEW LAUNCH! Intro to Amazon Redshift Spectrum: Now query exabytes of d...
 
AWS re:Invent 2016: Streaming ETL for RDS and DynamoDB (DAT315)
AWS re:Invent 2016: Streaming ETL for RDS and DynamoDB (DAT315)AWS re:Invent 2016: Streaming ETL for RDS and DynamoDB (DAT315)
AWS re:Invent 2016: Streaming ETL for RDS and DynamoDB (DAT315)
 
February 2016 Webinar Series - Introduction to DynamoDB
February 2016 Webinar Series - Introduction to DynamoDBFebruary 2016 Webinar Series - Introduction to DynamoDB
February 2016 Webinar Series - Introduction to DynamoDB
 
Real-time Data Processing with Amazon DynamoDB Streams and AWS Lambda
Real-time Data Processing with Amazon DynamoDB Streams and AWS LambdaReal-time Data Processing with Amazon DynamoDB Streams and AWS Lambda
Real-time Data Processing with Amazon DynamoDB Streams and AWS Lambda
 
February 2016 Webinar Series - Architectural Patterns for Big Data on AWS
February 2016 Webinar Series - Architectural Patterns for Big Data on AWSFebruary 2016 Webinar Series - Architectural Patterns for Big Data on AWS
February 2016 Webinar Series - Architectural Patterns for Big Data on AWS
 
Introduction to Amazon Kinesis Analytics
Introduction to Amazon Kinesis AnalyticsIntroduction to Amazon Kinesis Analytics
Introduction to Amazon Kinesis Analytics
 
AWS May Webinar Series - Streaming Data Processing with Amazon Kinesis and AW...
AWS May Webinar Series - Streaming Data Processing with Amazon Kinesis and AW...AWS May Webinar Series - Streaming Data Processing with Amazon Kinesis and AW...
AWS May Webinar Series - Streaming Data Processing with Amazon Kinesis and AW...
 
AWS Data Collection & Storage
AWS Data Collection & StorageAWS Data Collection & Storage
AWS Data Collection & Storage
 
Real-time Streaming and Querying with Amazon Kinesis and Amazon Elastic MapRe...
Real-time Streaming and Querying with Amazon Kinesis and Amazon Elastic MapRe...Real-time Streaming and Querying with Amazon Kinesis and Amazon Elastic MapRe...
Real-time Streaming and Querying with Amazon Kinesis and Amazon Elastic MapRe...
 
(ARC202) Real-World Real-Time Analytics | AWS re:Invent 2014
(ARC202) Real-World Real-Time Analytics | AWS re:Invent 2014(ARC202) Real-World Real-Time Analytics | AWS re:Invent 2014
(ARC202) Real-World Real-Time Analytics | AWS re:Invent 2014
 
Building Big Data Applications with Serverless Architectures - June 2017 AWS...
Building Big Data Applications with Serverless Architectures -  June 2017 AWS...Building Big Data Applications with Serverless Architectures -  June 2017 AWS...
Building Big Data Applications with Serverless Architectures - June 2017 AWS...
 
Deploying your Data Warehouse on AWS
Deploying your Data Warehouse on AWSDeploying your Data Warehouse on AWS
Deploying your Data Warehouse on AWS
 
AWS APAC Webinar Week - Big Data on AWS. RedShift, EMR, & IOT
AWS APAC Webinar Week - Big Data on AWS. RedShift, EMR, & IOTAWS APAC Webinar Week - Big Data on AWS. RedShift, EMR, & IOT
AWS APAC Webinar Week - Big Data on AWS. RedShift, EMR, & IOT
 
Supercharging the Value of Your Data with Amazon S3
Supercharging the Value of Your Data with Amazon S3Supercharging the Value of Your Data with Amazon S3
Supercharging the Value of Your Data with Amazon S3
 
Real-time Streaming and Querying with Amazon Kinesis and Amazon Elastic MapRe...
Real-time Streaming and Querying with Amazon Kinesis and Amazon Elastic MapRe...Real-time Streaming and Querying with Amazon Kinesis and Amazon Elastic MapRe...
Real-time Streaming and Querying with Amazon Kinesis and Amazon Elastic MapRe...
 
Introduction to AWS Glue
Introduction to AWS GlueIntroduction to AWS Glue
Introduction to AWS Glue
 

Andere mochten auch

Event+driven+programming key+features
Event+driven+programming key+featuresEvent+driven+programming key+features
Event+driven+programming key+features
Faisal Aziz
 
Event oriented programming
Event oriented programmingEvent oriented programming
Event oriented programming
Ashwini Awatare
 
Ch 3 event driven programming
Ch 3 event driven programmingCh 3 event driven programming
Ch 3 event driven programming
Chaffey College
 
Software development lifecycle
Software development lifecycleSoftware development lifecycle
Software development lifecycle
nicky_walters
 

Andere mochten auch (20)

Design Patterns using Amazon DynamoDB
 Design Patterns using Amazon DynamoDB Design Patterns using Amazon DynamoDB
Design Patterns using Amazon DynamoDB
 
Event driven programming amazeballs
Event driven programming amazeballsEvent driven programming amazeballs
Event driven programming amazeballs
 
Event+driven+programming key+features
Event+driven+programming key+featuresEvent+driven+programming key+features
Event+driven+programming key+features
 
Event driventheory
Event driventheoryEvent driventheory
Event driventheory
 
Event driven theory
Event driven theoryEvent driven theory
Event driven theory
 
Event oriented programming
Event oriented programmingEvent oriented programming
Event oriented programming
 
Building a Real-Time Geospatial-Aware Recommendation Engine
 Building a Real-Time Geospatial-Aware Recommendation Engine Building a Real-Time Geospatial-Aware Recommendation Engine
Building a Real-Time Geospatial-Aware Recommendation Engine
 
Ch 3 event driven programming
Ch 3 event driven programmingCh 3 event driven programming
Ch 3 event driven programming
 
Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...
Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...
Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...
 
Building Applications with DynamoDB
Building Applications with DynamoDBBuilding Applications with DynamoDB
Building Applications with DynamoDB
 
Synapseindia dotnet development chapter 14 event-driven programming
Synapseindia dotnet development  chapter 14 event-driven programmingSynapseindia dotnet development  chapter 14 event-driven programming
Synapseindia dotnet development chapter 14 event-driven programming
 
Nesc tutorial
Nesc tutorialNesc tutorial
Nesc tutorial
 
API Thinking - How to Design APIs Through Systems Design
API Thinking - How to Design APIs Through Systems DesignAPI Thinking - How to Design APIs Through Systems Design
API Thinking - How to Design APIs Through Systems Design
 
Wireless sensor network wireless network
Wireless sensor network wireless networkWireless sensor network wireless network
Wireless sensor network wireless network
 
Event Driven Javascript
Event Driven JavascriptEvent Driven Javascript
Event Driven Javascript
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
 
Decisions
DecisionsDecisions
Decisions
 
Simple debugging
Simple debuggingSimple debugging
Simple debugging
 
Design for edp
Design for edpDesign for edp
Design for edp
 
Software development lifecycle
Software development lifecycleSoftware development lifecycle
Software development lifecycle
 

Ähnlich wie (WRK302) Event-Driven Programming

Ähnlich wie (WRK302) Event-Driven Programming (20)

AWS Webcast - Build high-scale applications with Amazon DynamoDB
AWS Webcast - Build high-scale applications with Amazon DynamoDBAWS Webcast - Build high-scale applications with Amazon DynamoDB
AWS Webcast - Build high-scale applications with Amazon DynamoDB
 
Amazon Dynamo DB for Developers (김일호) - AWS DB Day
Amazon Dynamo DB for Developers (김일호) - AWS DB DayAmazon Dynamo DB for Developers (김일호) - AWS DB Day
Amazon Dynamo DB for Developers (김일호) - AWS DB Day
 
Deep Dive on Amazon DynamoDB
Deep Dive on Amazon DynamoDBDeep Dive on Amazon DynamoDB
Deep Dive on Amazon DynamoDB
 
개발자가 알아야 할 Amazon DynamoDB 활용법 :: 김일호 :: AWS Summit Seoul 2016
개발자가 알아야 할 Amazon DynamoDB 활용법 :: 김일호 :: AWS Summit Seoul 2016개발자가 알아야 할 Amazon DynamoDB 활용법 :: 김일호 :: AWS Summit Seoul 2016
개발자가 알아야 할 Amazon DynamoDB 활용법 :: 김일호 :: AWS Summit Seoul 2016
 
AWS re:Invent 2016: How DataXu scaled its Attribution System to handle billio...
AWS re:Invent 2016: How DataXu scaled its Attribution System to handle billio...AWS re:Invent 2016: How DataXu scaled its Attribution System to handle billio...
AWS re:Invent 2016: How DataXu scaled its Attribution System to handle billio...
 
DynamoDB Design Workshop
DynamoDB Design WorkshopDynamoDB Design Workshop
DynamoDB Design Workshop
 
Deep Dive: Amazon DynamoDB
Deep Dive: Amazon DynamoDBDeep Dive: Amazon DynamoDB
Deep Dive: Amazon DynamoDB
 
Getting Strated with Amazon Dynamo DB (Jim Scharf) - AWS DB Day
Getting Strated with Amazon Dynamo DB (Jim Scharf) - AWS DB DayGetting Strated with Amazon Dynamo DB (Jim Scharf) - AWS DB Day
Getting Strated with Amazon Dynamo DB (Jim Scharf) - AWS DB Day
 
Deep Dive on Amazon DynamoDB
Deep Dive on Amazon DynamoDBDeep Dive on Amazon DynamoDB
Deep Dive on Amazon DynamoDB
 
AWS Webcast - Dynamo DB
AWS Webcast - Dynamo DBAWS Webcast - Dynamo DB
AWS Webcast - Dynamo DB
 
Raleigh DevDay 2017: Real time data processing using AWS Lambda
Raleigh DevDay 2017: Real time data processing using AWS LambdaRaleigh DevDay 2017: Real time data processing using AWS Lambda
Raleigh DevDay 2017: Real time data processing using AWS Lambda
 
SRV404 Deep Dive on Amazon DynamoDB
SRV404 Deep Dive on Amazon DynamoDBSRV404 Deep Dive on Amazon DynamoDB
SRV404 Deep Dive on Amazon DynamoDB
 
(DAT401) Amazon DynamoDB Deep Dive
(DAT401) Amazon DynamoDB Deep Dive(DAT401) Amazon DynamoDB Deep Dive
(DAT401) Amazon DynamoDB Deep Dive
 
Dynamodb Presentation
Dynamodb PresentationDynamodb Presentation
Dynamodb Presentation
 
Deep Dive - DynamoDB
Deep Dive - DynamoDBDeep Dive - DynamoDB
Deep Dive - DynamoDB
 
SMC303 Real-time Data Processing Using AWS Lambda
SMC303 Real-time Data Processing Using AWS LambdaSMC303 Real-time Data Processing Using AWS Lambda
SMC303 Real-time Data Processing Using AWS Lambda
 
Data Collection and Storage
Data Collection and StorageData Collection and Storage
Data Collection and Storage
 
(MBL305) You Have Data from the Devices, Now What?: Getting the Value of the IoT
(MBL305) You Have Data from the Devices, Now What?: Getting the Value of the IoT(MBL305) You Have Data from the Devices, Now What?: Getting the Value of the IoT
(MBL305) You Have Data from the Devices, Now What?: Getting the Value of the IoT
 
Real-time Data Processing Using AWS Lambda
Real-time Data Processing Using AWS LambdaReal-time Data Processing Using AWS Lambda
Real-time Data Processing Using AWS Lambda
 
Real-Time Event Processing
Real-Time Event ProcessingReal-Time Event Processing
Real-Time Event Processing
 

Mehr von Amazon Web Services

Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
Amazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
Amazon Web Services
 

Mehr von Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

(WRK302) Event-Driven Programming

  • 1. © 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Daniela Miao, Software Engineer, AWS, DynamoDB October 2015 WRK302 Event-Driven Programming With Amazon DynamoDB Streams and AWS Lambda
  • 2. What to Expect from the Session Why Amazon DynamoDB? Amazon DynamoDB Basics Amazon DynamoDB Streams AWS Lambda Building an event-driven application Summary
  • 4. Customers wanted a database with… Reliably low latency at any scale Elastic throughput and storage Flexible queries and data models Strong consistency Availability and fault-tolerance
  • 5. What Amazon DynamoDB Provides… Fully-managed NoSQL database service Consistent, single-digit millisecond latency Independent throughput and storage scaling Supports both document and key-value data models Automatic data replication across three facilities
  • 7. Data model Tables: collection of items Items: collection of attributes Attributes: name-value pairs • Scalar: number, string, binary, boolean, null • Multi-valued: string set, number set, binary set • Document: list, map
  • 8. Data model RecordID PlayerName Score NickName 1 Alice 999 AliceTheMalice 2 Bob 888 Sample table: GameRecords • Note attributes can be optional
  • 9. Primary key – hash RecordID PlayerName Score NickName 1 Alice 999 AliceTheMalice 2 Bob 888 Hash type primary key: primary key is made of one attribute, required for all items
  • 10. 55 A9 54 Distributing hash keys Hash key uniquely identifies an item Hash key is used for building an unordered hash index 00 FF RecordId = 1 Name = Alice Hash (1) = 7B RecordId = 2 Name = Bob Hash (2) = 48 RecordId = 3 Name = John Hash (3) = CD Key Space
  • 11. 55 A954 AA FF Distributing hash keys Table can be partitioned for scale 00 FF RecordId = 1 Name = Alice Hash (1) = 7B RecordId = 2 Name = Bob Hash (2) = 48 RecordId = 3 Name = John Hash (3) = CD Key Space
  • 12. Primary key – hash and range Customer# Order# Item 1 10 Shoes 1 11 Toys 2 11 Pen Hash and range type primary key: the primary key is made of two attributes, required for all items
  • 13. Hash range table Within an unordered hash index, data is sorted by the range key 00 FF Hash (2) = 48 Customer# = 2 Order# = 10 Item = Pen Customer# = 2 Order# = 11 Item = Shoes Customer# = 1 Order# = 10 Item = Toy Customer# = 1 Order# = 11 Item = Boots Hash (1) = 7B Customer# = 3 Order# = 10 Item = Book Customer# = 3 Order# = 11 Item = Paper Hash (3) = CD 55 A954 AA Partition 1 Partition 2 Partition 3
  • 14. Query and scan A query operation finds items in a table using only primary key attribute values. • Hash key attribute-value pair is required • Range key attribute-value pair is optional • In the previous example, query for all orders of a specific customer by setting “customer# = 1". A scan operation examines every item in the table. • Returns all of the data attributes for every item
  • 16. Amazon DynamoDB StreamsAmazon DynamoDB Streams Stream of updates to a table in a continous pipeline Records all modifications made to items of the table Scales with table size and throughput StreamsTable DynamoDB Client Application Updates
  • 17. Customer application Amazon DynamoDB replicator using DynamoDB Streams Copies incoming data to a different table in real-time Blog post published describing the application “DynamoDB delivers even more stability, redundancy, and speed for our document-based data and requires less hands-on administration, so we can focus on building the software that powers Mapbox.”
  • 18. View Type Record Content Old image—before update RecordID = 1, Name = Alice New image—after update RecordID = 1, Name = Alison Old and new images RecordID = 1, Name = Alice RecordID = 1, Name = Alison Keys only RecordID = 1 View types UpdateItem: (RecordID = 1, Name = Alice)  (RecordID = 1, Name = Alison) Entire image of the item is returned, not just the changes
  • 19. Stream Table Partition 1 Partition 2 Partition 3 Partition 4 Partition 5 Table Shard 1 Shard 2 Shard 3 Shard 4 KCL Worker KCL Worker KCL Worker KCL Worker Amazon Kinesis Client Library Application DynamoDB Client Application Updates Amazon DynamoDB Streams and Amazon Kinesis Client Library
  • 20. Analytics with Amazon DynamoDB Streams Collect and de-dupe data in DynamoDB Aggregate data in-memory and flush periodically Performing real-time aggregation and analytics
  • 21. DynamoDB Streams Open source cross-region replication library Asia Pacific (Sydney) EU (Ireland) Replica US East (N. Virginia) Cross-region replication
  • 22. Cross-region replication library Horizontal scaling Bootstrapping existing items Fault tolerance Optimized for cost and performance
  • 24. AWS Lambda Event-driven compute in the cloud Lambda functions: stateless, request-driven code execution • Triggered by events in other services: e.g., write to an Amazon DynamoDB table Ability to transform data as it reaches the cloud
  • 25. AWS Lambda Customers can focus on business logic, no need to manage infrastructure Lambda scales to match the event rate Pay for only what you use • Fine-grained pricing: purchase compute time in 100ms increments • No hourly, daily, or monthly minimums
  • 26. Popular usage scenarios Data triggers with Amazon S3 or Amazon DynamoDB Audit and notify • Monitor AWS CloudTrail logs and use Lambda functions to send Amazon SNS notifications Custom deployment rules using AWS CloudFormation Validate cross-device sync data with Amazon Cognito Custom events by publishing to Amazon Kinesis
  • 28. Sample Scenario Amazon DynamoDB table and Streams AWS Lambda Send notification via Amazon SNS Update another table
  • 30. Popular usage scenarios Mobile gaming application GameScoreRecords table • Records of game scores • Want to implement a list of aggregate scores for each user GameScoresByUser table updated by AWS Lambda
  • 31. Self-paced Hands-on Lab Zip file included with the workshop package Use lab guide to complete each exercise in your group Solutions provided in a separate directory – do NOT use unless truly stuck
  • 33. Use QR code or link above to download the group activity package and follow the lab guide. http://reinventworkshop.s3.amazonaws.com/workshop.zip
  • 34. Thank you! After the break, there will be a group-based activity to build an event-driven application