SlideShare une entreprise Scribd logo
1  sur  28
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Presenter: Vyom Nagrani, Sr. Product Manager, AWS Lambda
Q&A Moderator: Ajay Nair, Sr. Product Manager, AWS Lambda
July 30th, 2015
Best Practices: Real-time Data
Processing with Amazon DynamoDB
Streams and AWS Lambda
Amazon DynamoDB Streams – time-ordered sequence
of item-level changes
• Time and partition ordered log
• Provides a stream of inserts, deletes, updates
• Old item
• New item
• Primary key
• Change type
• Stream items delivered exactly once
• Streams are asynchronous
• Scales with your table
DynamoDB DynamoDB Streams
Benefits of DynamoDB Streams for real-time data
processing
Durability & high availability
• High throughput consensus protocol
• Replicated across multiple AZs
Managed streams
• Simply enable streaming
Performance
• Designed for sub-second latency
Native integration with AWS Lambda
• DynamoDB Triggers invoke a Lambda
function to run your custom code
DynamoDB DynamoDB Streams
DynamoDB Triggers
Lambda function
Run custom code
AWS Lambda: A compute service that runs your code
in response to events
Lambda functions: Stateless, trigger-based code execution
Triggered by events:
• Direct Sync and Async invocations
• Put to an Amazon S3 bucket
• Table update on Amazon DynamoDB
• And many more …
Makes it easy to
• Build back-end services that perform at scale
• Perform data-driven auditing, analysis, and notification
High performance at any scale;
Cost-effective and efficient
No Infrastructure to manage
Pay only for what you use: Lambda
automatically matches capacity to
your request rate. Purchase
compute in 100ms increments.
Bring Your Own Code
“Productivity focused compute platform to build powerful, dynamic, modular
applications in the cloud”
Run code in a choice of standard
languages. Use threads, processes,
files, and shell scripts normally.
Focus on business logic, not
infrastructure. You upload code; AWS
Lambda handles everything else.
Benefits of AWS Lambda for building a server-less data
processing engine
1 2 3
DynamoDB Streams + Lambda = Database Triggers
Run multiple real time applications in parallel
• DynamoDB Streams natively supports Cross Region Replication
• Triggers enables Filtering, Monitoring, Auditing, Notifications, Aggregation, etc.
• No charge for reads/polls that your AWS Lambda function makes to the DynamoDB
Stream associated with the table
Walkthrough of a simple stream logging application
workflow
Streams
Amazon
DynamoDB
AWS Lambda Amazon
CloudWatch Logs
New table
updates
Walkthrough of setting up DynamoDB Triggers and Lambda
functions through the AWS Console
Walkthrough of setting up DynamoDB Triggers and Lambda
functions through the AWS Console
Walkthrough of setting up DynamoDB Triggers and Lambda
functions through the AWS Console
Walkthrough of setting up DynamoDB Triggers and Lambda
functions through the AWS Console
Walkthrough of setting up DynamoDB Triggers and Lambda
functions through the AWS Console
Walkthrough of setting up DynamoDB Triggers and Lambda
functions through the AWS Console
Walkthrough of setting up DynamoDB Triggers and Lambda
functions through the AWS Console
Walkthrough of setting up DynamoDB Triggers and Lambda
functions through the AWS Console
Walkthrough of setting up DynamoDB Triggers and Lambda
functions through the AWS Console
Walkthrough of setting up DynamoDB Triggers and Lambda
functions through the AWS Console
Walkthrough of setting up DynamoDB Triggers and Lambda
functions through the AWS Console
Today’s demo: Workflow of cross-region replication
and real-time data auditing
Original Table
Data Stream
Amazon
DynamoDB
AWS Lambda
Amazon
DynamoDB
Amazon SNS
Loop through event array
Replicate item to different table
Send notification if suspicious record
In both cases, wait for callbacks before exiting
Demo: Cross region replication and
real-time data auditing using Amazon
DynamoDB and AWS Lambda
Attaching Lambda functions to DynamoDB Streams
• Automatic Shards: One Lambda function concurrently invoked per DynamoDB shard
• Each individual shard follows ordered processing
• A given key will be present in at most one concurrently active shard
• All changes (insert, remove, modify) available for a rolling 24-hour basis
… …
Source
DynamoDB Streams
Destination
1
Lambda
Destination
2
Pollers FunctionsShards
Lambda will scale automaticallyDynamoDB Streams scales by grouping records into shards
Attaching Lambda functions to DynamoDB Streams
• Reading the stream: Stream is exposed via the familiar Amazon Kinesis Client Library
interface
• Read the stream using https://github.com/awslabs/dynamodb-streams-kinesis-adapter
• Records can be retrieved at ~2x rate of the table’s provisioned write capacity
• Automatic Scaling: Both Dynamo DB and Lambda scale automatically with PUT rates
• Default limit of 100 concurrent Lambda functions, can be increased by AWS Support Center
Performance tuning DynamoDB as an event source
• Batch size: Max records that AWS
Lambda will retrieve from DynamoDB at
the time of invoking your function
• Increasing batch size will cause fewer
Lambda function invocations with more
data processed per function
• Starting Position: The position in the
stream where Lambda starts reading
• Set to “Trim Horizon” for starting with
oldest record
• Set to “Latest” for starting with most
recent data
Best practices for creating Lambda functions
• Memory: CPU proportional to the memory configured
• Increasing memory makes your code execute faster (if CPU bound)
• Timeout: Increasing timeout allows for longer functions, but more wait in case of errors
• Retries: For DynamoDB Streams, Lambda has unlimited retries (until data expires)
• Permission model: Lambda pulls data from DynamoDB, so no resource policy needed,
only execution role to allow Lambda access to DynamoDB
Monitoring and Debugging Lambda functions
• Console Dashboard
• Lists all Lambda functions
• Easy editing of resources,
event sources and other
settings
• At-a-glance metrics
• Metrics in CloudWatch
• Requests
• Errors
• Latency
• Throttles
• Logging in CloudWatch Logs
Three Next Steps
1. Enable DynamoDB Streams for your existing DynamoDB tables. DynamoDB
Streams provides a time-ordered sequence of item-level changes made to data in a
table in the last 24 hours.
2. Create and test your first Lambda function. With AWS Lambda, there are no new
languages, tools, or frameworks to learn. You can use any third party library, even
native ones.
3. Use AWS Lambda with DynamoDB Streams to create DynamoDB Triggers … no
infrastructure to manage, and setup a clean and lightweight implementation of
database triggers, NoSQL style!
Thank you!
Visit http://aws.amazon.com/dynamodb,
the AWS blog, and the DynamoDB
forum to learn more and get started
using DynamoDB.
Visit http://aws.amazon.com/lambda, the
AWS Compute blog, and the Lambda
forum to learn more and get started
using Lambda.

Contenu connexe

Tendances

CI-CD with AWS Developer Tools and Fargate_AWSPSSummit_Singapore
CI-CD with AWS Developer Tools and Fargate_AWSPSSummit_SingaporeCI-CD with AWS Developer Tools and Fargate_AWSPSSummit_Singapore
CI-CD with AWS Developer Tools and Fargate_AWSPSSummit_Singapore
Amazon Web Services
 
AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Be...
AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Be...AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Be...
AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Be...
Simplilearn
 

Tendances (20)

Introduce AWS Lambda for newbie and Non-IT
Introduce AWS Lambda for newbie and Non-ITIntroduce AWS Lambda for newbie and Non-IT
Introduce AWS Lambda for newbie and Non-IT
 
AWS CodeCommit, CodeDeploy & CodePipeline
AWS CodeCommit, CodeDeploy & CodePipelineAWS CodeCommit, CodeDeploy & CodePipeline
AWS CodeCommit, CodeDeploy & CodePipeline
 
Deep Dive on AWS Lambda
Deep Dive on AWS LambdaDeep Dive on AWS Lambda
Deep Dive on AWS Lambda
 
AWS Security Hub
AWS Security HubAWS Security Hub
AWS Security Hub
 
Swagger
SwaggerSwagger
Swagger
 
Serverless computing with AWS Lambda
Serverless computing with AWS Lambda Serverless computing with AWS Lambda
Serverless computing with AWS Lambda
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Serverless Framework Intro
Serverless Framework IntroServerless Framework Intro
Serverless Framework Intro
 
DEV204_Debugging Modern Applications Introduction to AWS X-Ray
DEV204_Debugging Modern Applications Introduction to AWS X-RayDEV204_Debugging Modern Applications Introduction to AWS X-Ray
DEV204_Debugging Modern Applications Introduction to AWS X-Ray
 
Introduction to AWS IAM
Introduction to AWS IAMIntroduction to AWS IAM
Introduction to AWS IAM
 
Intro to AWS Lambda
Intro to AWS Lambda Intro to AWS Lambda
Intro to AWS Lambda
 
CI/CD on AWS
CI/CD on AWSCI/CD on AWS
CI/CD on AWS
 
Deep Dive into AWS SAM
Deep Dive into AWS SAMDeep Dive into AWS SAM
Deep Dive into AWS SAM
 
Detailed Analysis of AWS Lambda vs EC2
 Detailed Analysis of AWS Lambda vs EC2 Detailed Analysis of AWS Lambda vs EC2
Detailed Analysis of AWS Lambda vs EC2
 
Deep Dive - CI/CD on AWS
Deep Dive - CI/CD on AWSDeep Dive - CI/CD on AWS
Deep Dive - CI/CD on AWS
 
Building APIs with Amazon API Gateway
Building APIs with Amazon API GatewayBuilding APIs with Amazon API Gateway
Building APIs with Amazon API Gateway
 
IAM Introduction
IAM IntroductionIAM Introduction
IAM Introduction
 
CI-CD with AWS Developer Tools and Fargate_AWSPSSummit_Singapore
CI-CD with AWS Developer Tools and Fargate_AWSPSSummit_SingaporeCI-CD with AWS Developer Tools and Fargate_AWSPSSummit_Singapore
CI-CD with AWS Developer Tools and Fargate_AWSPSSummit_Singapore
 
kafka
kafkakafka
kafka
 
AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Be...
AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Be...AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Be...
AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Be...
 

Similaire à Real-time Data Processing with Amazon DynamoDB Streams and AWS Lambda

Real Time Data Processing Using AWS Lambda - DevDay Austin 2017
Real Time Data Processing Using AWS Lambda - DevDay Austin 2017Real Time Data Processing Using AWS Lambda - DevDay Austin 2017
Real Time Data Processing Using AWS Lambda - DevDay Austin 2017
Amazon Web Services
 

Similaire à Real-time Data Processing with Amazon DynamoDB Streams and AWS Lambda (20)

Getting Started with Serverless Architectures | AWS Public Sector Summit 2016
Getting Started with Serverless Architectures | AWS Public Sector Summit 2016Getting Started with Serverless Architectures | AWS Public Sector Summit 2016
Getting Started with Serverless Architectures | AWS Public Sector Summit 2016
 
AWS April Webinar Series - AWS Lambda: Event-driven Code for Devices and the ...
AWS April Webinar Series - AWS Lambda: Event-driven Code for Devices and the ...AWS April Webinar Series - AWS Lambda: Event-driven Code for Devices and the ...
AWS April Webinar Series - AWS Lambda: Event-driven Code for Devices and the ...
 
A Walk in the Cloud with AWS Lambda
A Walk in the Cloud with AWS LambdaA Walk in the Cloud with AWS Lambda
A Walk in the Cloud with AWS Lambda
 
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
 
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
 
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
 
Serverless Architecture Patterns
Serverless Architecture PatternsServerless Architecture Patterns
Serverless Architecture Patterns
 
Production Ready Serverless Java Applications in 3 Weeks AWS UG Cologne Febru...
Production Ready Serverless Java Applications in 3 Weeks AWS UG Cologne Febru...Production Ready Serverless Java Applications in 3 Weeks AWS UG Cologne Febru...
Production Ready Serverless Java Applications in 3 Weeks AWS UG Cologne Febru...
 
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
 
What's New with Amazon DynamoDB - AWS Online Tech Talks
What's New with Amazon DynamoDB - AWS Online Tech TalksWhat's New with Amazon DynamoDB - AWS Online Tech Talks
What's New with Amazon DynamoDB - AWS Online Tech Talks
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Getting Started with AWS Lambda & Serverless Cloud
Getting Started with AWS Lambda & Serverless CloudGetting Started with AWS Lambda & Serverless Cloud
Getting Started with AWS Lambda & Serverless Cloud
 
Real Time Data Processing Using AWS Lambda - DevDay Austin 2017
Real Time Data Processing Using AWS Lambda - DevDay Austin 2017Real Time Data Processing Using AWS Lambda - DevDay Austin 2017
Real Time Data Processing Using AWS Lambda - DevDay Austin 2017
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Serverless Architecture Patterns
Serverless Architecture PatternsServerless Architecture Patterns
Serverless Architecture Patterns
 
serverless_architecture_patterns_london_loft.pdf
serverless_architecture_patterns_london_loft.pdfserverless_architecture_patterns_london_loft.pdf
serverless_architecture_patterns_london_loft.pdf
 
Real Time Data Processing Using AWS Lambda - DevDay Los Angeles 2017
Real Time Data Processing Using AWS Lambda - DevDay Los Angeles 2017Real Time Data Processing Using AWS Lambda - DevDay Los Angeles 2017
Real Time Data Processing Using AWS Lambda - DevDay Los Angeles 2017
 
DevTalks Romania - Getting Started with AWS Lambda & the Serverless Cloud
DevTalks Romania - Getting Started with AWS Lambda & the Serverless CloudDevTalks Romania - Getting Started with AWS Lambda & the Serverless Cloud
DevTalks Romania - Getting Started with AWS Lambda & the Serverless Cloud
 
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
 
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
 

Plus de 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
 

Plus de 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
 

Dernier

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Dernier (20)

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...
 
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...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
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
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Real-time Data Processing with Amazon DynamoDB Streams and AWS Lambda

  • 1. © 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Presenter: Vyom Nagrani, Sr. Product Manager, AWS Lambda Q&A Moderator: Ajay Nair, Sr. Product Manager, AWS Lambda July 30th, 2015 Best Practices: Real-time Data Processing with Amazon DynamoDB Streams and AWS Lambda
  • 2. Amazon DynamoDB Streams – time-ordered sequence of item-level changes • Time and partition ordered log • Provides a stream of inserts, deletes, updates • Old item • New item • Primary key • Change type • Stream items delivered exactly once • Streams are asynchronous • Scales with your table DynamoDB DynamoDB Streams
  • 3. Benefits of DynamoDB Streams for real-time data processing Durability & high availability • High throughput consensus protocol • Replicated across multiple AZs Managed streams • Simply enable streaming Performance • Designed for sub-second latency Native integration with AWS Lambda • DynamoDB Triggers invoke a Lambda function to run your custom code DynamoDB DynamoDB Streams DynamoDB Triggers Lambda function Run custom code
  • 4. AWS Lambda: A compute service that runs your code in response to events Lambda functions: Stateless, trigger-based code execution Triggered by events: • Direct Sync and Async invocations • Put to an Amazon S3 bucket • Table update on Amazon DynamoDB • And many more … Makes it easy to • Build back-end services that perform at scale • Perform data-driven auditing, analysis, and notification
  • 5. High performance at any scale; Cost-effective and efficient No Infrastructure to manage Pay only for what you use: Lambda automatically matches capacity to your request rate. Purchase compute in 100ms increments. Bring Your Own Code “Productivity focused compute platform to build powerful, dynamic, modular applications in the cloud” Run code in a choice of standard languages. Use threads, processes, files, and shell scripts normally. Focus on business logic, not infrastructure. You upload code; AWS Lambda handles everything else. Benefits of AWS Lambda for building a server-less data processing engine 1 2 3
  • 6. DynamoDB Streams + Lambda = Database Triggers Run multiple real time applications in parallel • DynamoDB Streams natively supports Cross Region Replication • Triggers enables Filtering, Monitoring, Auditing, Notifications, Aggregation, etc. • No charge for reads/polls that your AWS Lambda function makes to the DynamoDB Stream associated with the table
  • 7. Walkthrough of a simple stream logging application workflow Streams Amazon DynamoDB AWS Lambda Amazon CloudWatch Logs New table updates
  • 8. Walkthrough of setting up DynamoDB Triggers and Lambda functions through the AWS Console
  • 9. Walkthrough of setting up DynamoDB Triggers and Lambda functions through the AWS Console
  • 10. Walkthrough of setting up DynamoDB Triggers and Lambda functions through the AWS Console
  • 11. Walkthrough of setting up DynamoDB Triggers and Lambda functions through the AWS Console
  • 12. Walkthrough of setting up DynamoDB Triggers and Lambda functions through the AWS Console
  • 13. Walkthrough of setting up DynamoDB Triggers and Lambda functions through the AWS Console
  • 14. Walkthrough of setting up DynamoDB Triggers and Lambda functions through the AWS Console
  • 15. Walkthrough of setting up DynamoDB Triggers and Lambda functions through the AWS Console
  • 16. Walkthrough of setting up DynamoDB Triggers and Lambda functions through the AWS Console
  • 17. Walkthrough of setting up DynamoDB Triggers and Lambda functions through the AWS Console
  • 18. Walkthrough of setting up DynamoDB Triggers and Lambda functions through the AWS Console
  • 19. Today’s demo: Workflow of cross-region replication and real-time data auditing Original Table Data Stream Amazon DynamoDB AWS Lambda Amazon DynamoDB Amazon SNS
  • 20. Loop through event array Replicate item to different table Send notification if suspicious record In both cases, wait for callbacks before exiting
  • 21. Demo: Cross region replication and real-time data auditing using Amazon DynamoDB and AWS Lambda
  • 22. Attaching Lambda functions to DynamoDB Streams • Automatic Shards: One Lambda function concurrently invoked per DynamoDB shard • Each individual shard follows ordered processing • A given key will be present in at most one concurrently active shard • All changes (insert, remove, modify) available for a rolling 24-hour basis … … Source DynamoDB Streams Destination 1 Lambda Destination 2 Pollers FunctionsShards Lambda will scale automaticallyDynamoDB Streams scales by grouping records into shards
  • 23. Attaching Lambda functions to DynamoDB Streams • Reading the stream: Stream is exposed via the familiar Amazon Kinesis Client Library interface • Read the stream using https://github.com/awslabs/dynamodb-streams-kinesis-adapter • Records can be retrieved at ~2x rate of the table’s provisioned write capacity • Automatic Scaling: Both Dynamo DB and Lambda scale automatically with PUT rates • Default limit of 100 concurrent Lambda functions, can be increased by AWS Support Center
  • 24. Performance tuning DynamoDB as an event source • Batch size: Max records that AWS Lambda will retrieve from DynamoDB at the time of invoking your function • Increasing batch size will cause fewer Lambda function invocations with more data processed per function • Starting Position: The position in the stream where Lambda starts reading • Set to “Trim Horizon” for starting with oldest record • Set to “Latest” for starting with most recent data
  • 25. Best practices for creating Lambda functions • Memory: CPU proportional to the memory configured • Increasing memory makes your code execute faster (if CPU bound) • Timeout: Increasing timeout allows for longer functions, but more wait in case of errors • Retries: For DynamoDB Streams, Lambda has unlimited retries (until data expires) • Permission model: Lambda pulls data from DynamoDB, so no resource policy needed, only execution role to allow Lambda access to DynamoDB
  • 26. Monitoring and Debugging Lambda functions • Console Dashboard • Lists all Lambda functions • Easy editing of resources, event sources and other settings • At-a-glance metrics • Metrics in CloudWatch • Requests • Errors • Latency • Throttles • Logging in CloudWatch Logs
  • 27. Three Next Steps 1. Enable DynamoDB Streams for your existing DynamoDB tables. DynamoDB Streams provides a time-ordered sequence of item-level changes made to data in a table in the last 24 hours. 2. Create and test your first Lambda function. With AWS Lambda, there are no new languages, tools, or frameworks to learn. You can use any third party library, even native ones. 3. Use AWS Lambda with DynamoDB Streams to create DynamoDB Triggers … no infrastructure to manage, and setup a clean and lightweight implementation of database triggers, NoSQL style!
  • 28. Thank you! Visit http://aws.amazon.com/dynamodb, the AWS blog, and the DynamoDB forum to learn more and get started using DynamoDB. Visit http://aws.amazon.com/lambda, the AWS Compute blog, and the Lambda forum to learn more and get started using Lambda.