SlideShare a Scribd company logo
©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved
Building	a	serverless	data	pipeline
Julien	Simon,	Principal	Technical	Evangelist,	AWS	
julsimon@amazon.fr		
@julsimon
Werner	Vogels,	CTO,	Amazon.com	
AWS	re:Invent	2015
AWS	Lambda	
•  Deploy	pure	funcJons	in	Java,	Python	and	Node.js	
•  Works	nicely	with	AWS	managed	services:		
Amazon	S3,	Amazon	DynamoDB,	etc.	
•  Build	event-driven	applicaJons	
•  Build	RESTful	APIs	in	conjuncJon	with	Amazon	API	Gateway	
	
•  Pay	as	you	go:	number	of	requests	+	execuJon	Jme	(100ms	slots)
Managed	services	
+		
AWS	Lambda	
=		
Serverless	architecture
Another	way	to	put	it…	
	
Tim	Wagner,		
General	Manager,		
AWS	Lambda	
	
	
Serverless	conference,	NYC,	May	2016
MOBILE
CHAT APP
AD DATA ANALYTICS
AND ROUTING
MOBILE APP
ANALYTICS
IMAGE CONTENT
FILTERING
REAL-TIME VIDEO
AD BIDDING
NEWS CONTENT
PROCESSING
GENE SEQUENCE
SEARCH
CLOUD
TELEPHONY
DATA
PROCESSING
WEB
APPLICATIONS WEB APPLICATIONS
THREAT INTELLIGENCE
AND ANALYTICS
NEWS CONTENT
PROCESSING
GAME METRICS ANALYTICS
Selected	serverless	customers	
PRODUCT
RECOMMANDATION
https://blog.instant.cm/a-serverless-architecture-with-zero-maintenance-and-infinite-scalability-b00c2ceb4c2b
http://highscalability.com/blog/2015/12/7/the-serverless-start-up-down-with-servers.html
Instant.cm:	100%	Serverless
https://read.acloud.guru/serverless-the-future-of-software-architecture-d4473ffed864
A	Cloud	Guru:	100%	Serverless
AWS Lambda ‘Hello World’ (Python)
1.  Write a simple Lambda function in Python
2.  Create a REST API with API Gateway (resource + POST method)
3.  Deploy the API
4.  Invoke the API with ‘curl’
A simple Lambda function in Python
def lambda_handler(event,context):
   result = event['value1'] + event['value2']
   return result
aws lambda create-function --function-name myFunc 
--handler myFunc.lambda_handler --runtime python2.7 
--zip-file fileb://myFunc.zip --memory-size 128 
--role arn:aws:iam::ACCOUNT_NUMBER:role/lambda_basic_execution
curl -H "Content-Type: application/json" 
-X POST -d "{"value1":5, "value2":7}" 
https://API_ENDPOINT/STAGE/RESOURCE
12
AWS Lambda in Java with Eclipse
https://java.awsblog.com/post/TxWZES6J1RSQ2Z/Testing-Lambda-functions-using-the-AWS-Toolkit-for-Eclipse
AWS Lambda ‘Hello World’ (Java)
1.  In Eclipse, write a simple Lambda function triggered by an S3 event
2.  Unit-test the function with Junit
3.  Using the AWS Eclipse plug-in, upload and run the function in AWS
4.  Run the function again in the AWS Console
AWS Lambda with the Serverless framework
http://github.com/serverless/serverless
•  Run/test AWS Lambda functions locally, or remotely
•  Auto-deploys & versions your Lambda functions
•  Auto-deploys your REST API to AWS API Gateway
•  Auto-deploys your Lambda events
•  Support for multiple stages
•  Support for multiple regions within stages
•  Manage & deploy AWS CloudFormation resources
Building	a	serverless	data	pipeline	
Lambda
DynamoDB
Kinesis
Firehose
API Gateway
HTTP POST 

/prod/logger writeTo
Kinesis
DynamoDB
ToFirehose
S3
eventTable
DynamoDB
streams
bucket
EMR,
Redshift,
…
firehoseToS3
Kinesis StreamsLambda Lambda
KinesisTo
DynamoDB
Web apps
Step 1: create DynamoDB table
aws dynamodb create-table 
--table-name eventTable 
--attribute-definitions 
AttributeName=userId,AttributeType=N 
AttributeName=timestamp,AttributeType=N 
--key-schema 
AttributeName=userId,KeyType=HASH 
AttributeName=timestamp,KeyType=RANGE 
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 
--stream-specification StreamEnabled=true,StreamViewType=NEW_IMAGE
eventTable
DynamoDB
Step 2: IAM role for Lambda function
aws iam create-role 
--role-name writeToDynamoDB_role 
--assume-role-policy-document file://lambda_trust_policy.json
aws iam create-policy 
--policy-name writeToDynamoDB_policy 
--policy-document file://writeToDynamoDB_policy.json
aws iam attach-role-policy 
--role-name writeToDynamoDB_role 
--policy-arn WRITETODYNAMODB_POLICY_ARN
Step 3: create Lambda function
S3
DynamoDB
eventTable
Web apps
dynamodb.
put_item()
Lambda
aws lambda create-function 
--function-name writeToDynamoDB 
--role WRITETODYNAMO_DB_ROLE 
--zip-file fileb://writeToDynamoDB.zip 
--handler writeToDynamoDB.lambda_handler 
--runtime python2.7 
--memory-size 128 
--description "Write events to DynamoDB”
Step 4: create Kinesis Stream
DynamoDB
S3
eventTable
Web apps
dynamodb.
put_item()
Lambda
aws kinesis create-stream --stream-name APItoDynamoDB --shard-count 1
Kinesis Streams
Step 5: IAM role for Lambda function
aws iam create-role 
--role-name writeToKinesis_role 
--assume-role-policy-document file://lambda_trust_policy.json
aws iam create-policy 
--policy-name writeToKinesis_policy 
--policy-document file://writeToKinesis_policy.json
aws iam attach-role-policy 
--role-name writeToKinesis_role 
--policy-arn WRITETOKINESIS_POLICY_ARN
Step 6: create Lambda function
DynamoDB
S3
eventTable
Web apps
DynamoDB
streams
dynamodb.
put_item()
Lambda
aws lambda create-function 
--function-name writeToKinesis
--role WRITETOKINESIS_ROLE 
--zip-file fileb://writeToKinesis.zip 
--handler writeToKinesis.lambda_handler 
--runtime python2.7 
--memory-size 128 
--description "Write events to Kinesis”
Kinesis StreamsLambda
KinesisTo
DynamoDB
writeTo
Kinesis
Step 7: create API
DynamoDB
S3
eventTable
Web apps
DynamoDB
streams
dynamodb.
put_item()
Lambda
Painful to do with the CLI: 9 aws apigateway calls :-/
à  Use the console
à  Use a Swagger File
http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html
à  Use the Serverless framework
Kinesis StreamsLambda
KinesisTo
DynamoDB
writeTo
Kinesis
API Gateway
Step 8: create IAM role
aws iam create-role 
--role-name DynamoDBToFirehose_role 
--assume-role-policy-document file://lambda_trust_policy.json
aws iam create-policy 
--policy-name DynamoDBToFirehose_policy 
--policy-document file://DynamoDBToFirehose_policy.json
aws iam attach-role-policy 
--role-name DynamoDBToFirehose_role 
--policy-arn DYNAMODBTOFIREHOSE_POLICY_ARN
Step	9:	create	Lambda	funcIon	and	DynamoDB	trigger	
aws lambda create-function 
--function-name DynamoDBToFirehose 
--role DYNAMODBTOFIREHOSE_ROLE_ARN 
--zip-file fileb://DynamoDBToFirehose.zip 
--handler DynamoDBToFirehose.lambda_handler 
--runtime python2.7 
--memory-size 128 
--description "Write DynamoDB stream to Kinesis Firehose"
aws lambda create-event-source-mapping 
--function-name DynamoDBToFirehose 
--event-source DYNAMODB_STREAM_ARN 
--batch-size 10 
--starting-position TRIM_HORIZON
Lambda
DynamoDB
ToFirehose
eventTable
DynamoDB
streams
DynamoDB
Step	10:	create	IAM	role	
aws iam create-role 
--role-name firehoseToS3_role 
--assume-role-policy-document file://firehose_trust_policy.json
aws iam create-policy 
--policy-name firehoseToS3_policy 
--policy-document file://firehoseToS3_policy.json
aws iam attach-role-policy 
--role-name firehoseToS3_role 
--policy-arn FIREHOSETOS3_POLICY_ARN
Step	11:	create	S3	bucket	
aws s3 mb s3://jsimon-public
Lambda
DynamoDB
ToFirehose
eventTable
DynamoDB
streams
DynamoDB
Step	12:	create	Kinesis	Firehose	stream	
aws firehose create-delivery-stream 
--delivery-stream-name firehoseToS3 
--s3-destination-configuration 
RoleARN=FIREHOSETOS3_ROLE_ARN, 
BucketARN="arn:aws:s3:::jsimon-public", 
Prefix="firehose", 
BufferingHints={SizeInMBs=1,IntervalInSeconds=60}, 
CompressionFormat="GZIP", 
EncryptionConfiguration={NoEncryptionConfig="NoEncryption"}
Kinesis
Firehose
firehoseToS3
Lambda
DynamoDB
ToFirehose
eventTable
DynamoDB
streams
DynamoDB
Building	a	serverless	data	pipeline	
Lambda
DynamoDB
Kinesis
Firehose
API Gateway
HTTP POST 

/prod/logger writeTo
Kinesis
DynamoDB
ToFirehose
S3
eventTable
DynamoDB
streams
bucket
EMR,
Redshift,
…
firehoseToS3
Kinesis StreamsLambda Lambda
KinesisTo
DynamoDB
Web apps
Lines of code: 16
Number of servers: zero
Performance & scalability: maximum
https://github.com/juliensimon/aws/tree/master/serverlessPipeline
Ready	for	some	tesIng?	
hRp://api.julien.org
Upcoming	book	on	AWS	Lambda	
Wri^en	by	AWS	Technical	
Evangelist	Danilo	Poccia	
	
Early	release	available	at:	
	
h^ps://www.manning.com/
books/aws-lambda-in-acJon
Going	further	
AWS re:Invent 2014 | (MBL202) NEW LAUNCH: Getting Started with AWS Lambda
https://www.youtube.com/watch?v=UFj27laTWQA
AWS re:Invent 2015 | (DEV203) Amazon API Gateway & AWS Lambda to Build Secure and Scalable APIs
https://www.youtube.com/watch?v=ZBxWZ9bgd44
AWS re:Invent 2015 | (DVO209) JAWS: The Monstrously Scalable Serverless Framework
https://www.youtube.com/watch?v=D_U6luQ6I90
https://github.com/serverless/serverless
AWS re:Invent 2015 | (ARC308) The Serverless Company Using AWS Lambda
https://www.youtube.com/watch?v=U8ODkSCJpJU
AWS re:Invent 2015 | (CMP407) Lambda as Cron: Scheduling Invocations in AWS Lambda
https://www.youtube.com/watch?v=FhJxTIq81AU
Reference architectures
http://www.allthingsdistributed.com/2016/06/aws-lambda-serverless-reference-architectures.html
AWS User Groups
Lille
Paris
Rennes
Nantes
Bordeaux
Lyon
Montpellier
Toulouse
facebook.com/groups/AWSFrance/
@aws_actus
AWS Enterprise Summit – 27/10/2016, Paris
http://amzn.to/1X2yp0i
Merci !
	
Julien	Simon,	Principal	Technical	Evangelist,	AWS	
julsimon@amazon.fr	
@julsimon

More Related Content

PDF
Serverless Frameworks on AWS
Julien SIMON
 
PDF
Developing and deploying serverless applications (February 2017)
Julien SIMON
 
PDF
Building serverless apps with Node.js
Julien SIMON
 
PDF
AWS CloudFormation (February 2016)
Julien SIMON
 
PPTX
Moving Viadeo to AWS (2015)
Julien SIMON
 
PDF
Serverless architecture with AWS Lambda (June 2016)
Julien SIMON
 
PDF
An introduction to serverless architectures (February 2017)
Julien SIMON
 
PDF
A 60-mn tour of AWS compute (March 2016)
Julien SIMON
 
Serverless Frameworks on AWS
Julien SIMON
 
Developing and deploying serverless applications (February 2017)
Julien SIMON
 
Building serverless apps with Node.js
Julien SIMON
 
AWS CloudFormation (February 2016)
Julien SIMON
 
Moving Viadeo to AWS (2015)
Julien SIMON
 
Serverless architecture with AWS Lambda (June 2016)
Julien SIMON
 
An introduction to serverless architectures (February 2017)
Julien SIMON
 
A 60-mn tour of AWS compute (March 2016)
Julien SIMON
 

What's hot (17)

PDF
Amazon ECS (December 2015)
Julien SIMON
 
PDF
A real-life account of moving 100% to a public cloud
Julien SIMON
 
PDF
Running Docker clusters on AWS (June 2016)
Julien SIMON
 
PDF
Write less (code) and build more with serverless
Dhaval Nagar
 
PDF
Using Amazon CloudWatch Events, AWS Lambda and Spark Streaming to Process EC...
Julien SIMON
 
PDF
Continuous Deployment with Amazon Web Services
Julien SIMON
 
PDF
Amazon ECS (March 2016)
Julien SIMON
 
PDF
Building a data warehouse with Amazon Redshift … and a quick look at Amazon ...
Julien SIMON
 
PDF
Docker Paris #28
Julien SIMON
 
PPTX
從劍宗到氣宗 - 談AWS ECS與Serverless最佳實踐
Pahud Hsieh
 
PDF
Meeyup aws-loadbalancing-28032015
Jhalak Modi
 
PDF
Workshop AWS IoT @ SIDO
Julien SIMON
 
PDF
Infrastructure as code with Amazon Web Services
Julien SIMON
 
PDF
Building A Dynamic Website - 31st Jan 2015
Jhalak Modi
 
PDF
Docker Paris #29
Julien SIMON
 
PDF
CI&CD on AWS - Meetup Roma Oct 2016
Paolo latella
 
PDF
Scaling your web app horizontally and vertically (ahmedabad amazon aws cloud...
Jhalak Modi
 
Amazon ECS (December 2015)
Julien SIMON
 
A real-life account of moving 100% to a public cloud
Julien SIMON
 
Running Docker clusters on AWS (June 2016)
Julien SIMON
 
Write less (code) and build more with serverless
Dhaval Nagar
 
Using Amazon CloudWatch Events, AWS Lambda and Spark Streaming to Process EC...
Julien SIMON
 
Continuous Deployment with Amazon Web Services
Julien SIMON
 
Amazon ECS (March 2016)
Julien SIMON
 
Building a data warehouse with Amazon Redshift … and a quick look at Amazon ...
Julien SIMON
 
Docker Paris #28
Julien SIMON
 
從劍宗到氣宗 - 談AWS ECS與Serverless最佳實踐
Pahud Hsieh
 
Meeyup aws-loadbalancing-28032015
Jhalak Modi
 
Workshop AWS IoT @ SIDO
Julien SIMON
 
Infrastructure as code with Amazon Web Services
Julien SIMON
 
Building A Dynamic Website - 31st Jan 2015
Jhalak Modi
 
Docker Paris #29
Julien SIMON
 
CI&CD on AWS - Meetup Roma Oct 2016
Paolo latella
 
Scaling your web app horizontally and vertically (ahmedabad amazon aws cloud...
Jhalak Modi
 
Ad

Similar to Building a Serverless Pipeline (20)

PDF
Building serverless applications (April 2018)
Julien SIMON
 
PDF
Em tempo real: Ingestão, processamento e analise de dados
Amazon Web Services LATAM
 
PDF
AWS Floor28 - WildRydes Serverless Data Processsing workshop (Ver2)
Adir Sharabi
 
PPTX
Getting Started with Serverless Architectures
AWS Summits
 
PDF
AWS Community Nordics Virtual Meetup
Anahit Pogosova
 
PDF
Serverless Architectural Patterns and Best Practices | AWS
AWS Germany
 
PDF
Serverless Design Patterns
Yan Cui
 
PDF
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
CodeOps Technologies LLP
 
PDF
Serveless design patterns (VoxxedDays Luxembourg)
Yan Cui
 
PDF
Introduction to Serverless
Steven Bryen
 
PDF
Jumpstart your idea with AWS Serverless [Oct 2020]
Dhaval Nagar
 
PPTX
Going Serverless at AWS Startup Day Bangalore
Madhusudan Shekar
 
PPTX
Aws serverless architecture
genesesoftware
 
PPTX
Serverless Architectural Patterns
Adrian Hornsby
 
PDF
AWS and Serverless Computing
Roberto Casadei
 
PDF
Serverless use cases with AWS Lambda
Boaz Ziniman
 
PDF
JustGiving | Serverless Data Pipelines, API, Messaging and Stream Processing
BEEVA_es
 
PDF
JustGiving – Serverless Data Pipelines, API, Messaging and Stream Processing
Luis Gonzalez
 
PDF
"Serverless" express
Anna Gerber
 
PPTX
Amazon aws big data demystified | Introduction to streaming and messaging flu...
Omid Vahdaty
 
Building serverless applications (April 2018)
Julien SIMON
 
Em tempo real: Ingestão, processamento e analise de dados
Amazon Web Services LATAM
 
AWS Floor28 - WildRydes Serverless Data Processsing workshop (Ver2)
Adir Sharabi
 
Getting Started with Serverless Architectures
AWS Summits
 
AWS Community Nordics Virtual Meetup
Anahit Pogosova
 
Serverless Architectural Patterns and Best Practices | AWS
AWS Germany
 
Serverless Design Patterns
Yan Cui
 
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
CodeOps Technologies LLP
 
Serveless design patterns (VoxxedDays Luxembourg)
Yan Cui
 
Introduction to Serverless
Steven Bryen
 
Jumpstart your idea with AWS Serverless [Oct 2020]
Dhaval Nagar
 
Going Serverless at AWS Startup Day Bangalore
Madhusudan Shekar
 
Aws serverless architecture
genesesoftware
 
Serverless Architectural Patterns
Adrian Hornsby
 
AWS and Serverless Computing
Roberto Casadei
 
Serverless use cases with AWS Lambda
Boaz Ziniman
 
JustGiving | Serverless Data Pipelines, API, Messaging and Stream Processing
BEEVA_es
 
JustGiving – Serverless Data Pipelines, API, Messaging and Stream Processing
Luis Gonzalez
 
"Serverless" express
Anna Gerber
 
Amazon aws big data demystified | Introduction to streaming and messaging flu...
Omid Vahdaty
 
Ad

More from Julien SIMON (20)

PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
Arcee AI - building and working with small language models (06/25)
Julien SIMON
 
PDF
deep_dive_multihead_latent_attention.pdf
Julien SIMON
 
PDF
Deep Dive: Model Distillation with DistillKit
Julien SIMON
 
PDF
Deep Dive: Parameter-Efficient Model Adaptation with LoRA and Spectrum
Julien SIMON
 
PDF
Building High-Quality Domain-Specific Models with Mergekit
Julien SIMON
 
PDF
Tailoring Small Language Models for Enterprise Use Cases
Julien SIMON
 
PDF
Tailoring Small Language Models for Enterprise Use Cases
Julien SIMON
 
PDF
Julien Simon - Deep Dive: Compiling Deep Learning Models
Julien SIMON
 
PDF
Tailoring Small Language Models for Enterprise Use Cases
Julien SIMON
 
PDF
Julien Simon - Deep Dive - Optimizing LLM Inference
Julien SIMON
 
PDF
Julien Simon - Deep Dive - Accelerating Models with Better Attention Layers
Julien SIMON
 
PDF
Julien Simon - Deep Dive - Quantizing LLMs
Julien SIMON
 
PDF
Julien Simon - Deep Dive - Model Merging
Julien SIMON
 
PDF
An introduction to computer vision with Hugging Face
Julien SIMON
 
PDF
Reinventing Deep Learning
 with Hugging Face Transformers
Julien SIMON
 
PDF
Building NLP applications with Transformers
Julien SIMON
 
PPTX
Building Machine Learning Models Automatically (June 2020)
Julien SIMON
 
PDF
Starting your AI/ML project right (May 2020)
Julien SIMON
 
PPTX
Scale Machine Learning from zero to millions of users (April 2020)
Julien SIMON
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Arcee AI - building and working with small language models (06/25)
Julien SIMON
 
deep_dive_multihead_latent_attention.pdf
Julien SIMON
 
Deep Dive: Model Distillation with DistillKit
Julien SIMON
 
Deep Dive: Parameter-Efficient Model Adaptation with LoRA and Spectrum
Julien SIMON
 
Building High-Quality Domain-Specific Models with Mergekit
Julien SIMON
 
Tailoring Small Language Models for Enterprise Use Cases
Julien SIMON
 
Tailoring Small Language Models for Enterprise Use Cases
Julien SIMON
 
Julien Simon - Deep Dive: Compiling Deep Learning Models
Julien SIMON
 
Tailoring Small Language Models for Enterprise Use Cases
Julien SIMON
 
Julien Simon - Deep Dive - Optimizing LLM Inference
Julien SIMON
 
Julien Simon - Deep Dive - Accelerating Models with Better Attention Layers
Julien SIMON
 
Julien Simon - Deep Dive - Quantizing LLMs
Julien SIMON
 
Julien Simon - Deep Dive - Model Merging
Julien SIMON
 
An introduction to computer vision with Hugging Face
Julien SIMON
 
Reinventing Deep Learning
 with Hugging Face Transformers
Julien SIMON
 
Building NLP applications with Transformers
Julien SIMON
 
Building Machine Learning Models Automatically (June 2020)
Julien SIMON
 
Starting your AI/ML project right (May 2020)
Julien SIMON
 
Scale Machine Learning from zero to millions of users (April 2020)
Julien SIMON
 

Recently uploaded (20)

PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
Doc9.....................................
SofiaCollazos
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
Doc9.....................................
SofiaCollazos
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Software Development Methodologies in 2025
KodekX
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 

Building a Serverless Pipeline

  • 1. ©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved Building a serverless data pipeline Julien Simon, Principal Technical Evangelist, AWS [email protected] @julsimon
  • 3. AWS Lambda •  Deploy pure funcJons in Java, Python and Node.js •  Works nicely with AWS managed services: Amazon S3, Amazon DynamoDB, etc. •  Build event-driven applicaJons •  Build RESTful APIs in conjuncJon with Amazon API Gateway •  Pay as you go: number of requests + execuJon Jme (100ms slots)
  • 6. MOBILE CHAT APP AD DATA ANALYTICS AND ROUTING MOBILE APP ANALYTICS IMAGE CONTENT FILTERING REAL-TIME VIDEO AD BIDDING NEWS CONTENT PROCESSING GENE SEQUENCE SEARCH CLOUD TELEPHONY DATA PROCESSING WEB APPLICATIONS WEB APPLICATIONS THREAT INTELLIGENCE AND ANALYTICS NEWS CONTENT PROCESSING GAME METRICS ANALYTICS Selected serverless customers PRODUCT RECOMMANDATION
  • 9. AWS Lambda ‘Hello World’ (Python) 1.  Write a simple Lambda function in Python 2.  Create a REST API with API Gateway (resource + POST method) 3.  Deploy the API 4.  Invoke the API with ‘curl’
  • 10. A simple Lambda function in Python def lambda_handler(event,context):    result = event['value1'] + event['value2']    return result aws lambda create-function --function-name myFunc --handler myFunc.lambda_handler --runtime python2.7 --zip-file fileb://myFunc.zip --memory-size 128 --role arn:aws:iam::ACCOUNT_NUMBER:role/lambda_basic_execution curl -H "Content-Type: application/json" -X POST -d "{"value1":5, "value2":7}" https://API_ENDPOINT/STAGE/RESOURCE 12
  • 11. AWS Lambda in Java with Eclipse https://java.awsblog.com/post/TxWZES6J1RSQ2Z/Testing-Lambda-functions-using-the-AWS-Toolkit-for-Eclipse
  • 12. AWS Lambda ‘Hello World’ (Java) 1.  In Eclipse, write a simple Lambda function triggered by an S3 event 2.  Unit-test the function with Junit 3.  Using the AWS Eclipse plug-in, upload and run the function in AWS 4.  Run the function again in the AWS Console
  • 13. AWS Lambda with the Serverless framework http://github.com/serverless/serverless •  Run/test AWS Lambda functions locally, or remotely •  Auto-deploys & versions your Lambda functions •  Auto-deploys your REST API to AWS API Gateway •  Auto-deploys your Lambda events •  Support for multiple stages •  Support for multiple regions within stages •  Manage & deploy AWS CloudFormation resources
  • 14. Building a serverless data pipeline Lambda DynamoDB Kinesis Firehose API Gateway HTTP POST 
 /prod/logger writeTo Kinesis DynamoDB ToFirehose S3 eventTable DynamoDB streams bucket EMR, Redshift, … firehoseToS3 Kinesis StreamsLambda Lambda KinesisTo DynamoDB Web apps
  • 15. Step 1: create DynamoDB table aws dynamodb create-table --table-name eventTable --attribute-definitions AttributeName=userId,AttributeType=N AttributeName=timestamp,AttributeType=N --key-schema AttributeName=userId,KeyType=HASH AttributeName=timestamp,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 --stream-specification StreamEnabled=true,StreamViewType=NEW_IMAGE eventTable DynamoDB
  • 16. Step 2: IAM role for Lambda function aws iam create-role --role-name writeToDynamoDB_role --assume-role-policy-document file://lambda_trust_policy.json aws iam create-policy --policy-name writeToDynamoDB_policy --policy-document file://writeToDynamoDB_policy.json aws iam attach-role-policy --role-name writeToDynamoDB_role --policy-arn WRITETODYNAMODB_POLICY_ARN
  • 17. Step 3: create Lambda function S3 DynamoDB eventTable Web apps dynamodb. put_item() Lambda aws lambda create-function --function-name writeToDynamoDB --role WRITETODYNAMO_DB_ROLE --zip-file fileb://writeToDynamoDB.zip --handler writeToDynamoDB.lambda_handler --runtime python2.7 --memory-size 128 --description "Write events to DynamoDB”
  • 18. Step 4: create Kinesis Stream DynamoDB S3 eventTable Web apps dynamodb. put_item() Lambda aws kinesis create-stream --stream-name APItoDynamoDB --shard-count 1 Kinesis Streams
  • 19. Step 5: IAM role for Lambda function aws iam create-role --role-name writeToKinesis_role --assume-role-policy-document file://lambda_trust_policy.json aws iam create-policy --policy-name writeToKinesis_policy --policy-document file://writeToKinesis_policy.json aws iam attach-role-policy --role-name writeToKinesis_role --policy-arn WRITETOKINESIS_POLICY_ARN
  • 20. Step 6: create Lambda function DynamoDB S3 eventTable Web apps DynamoDB streams dynamodb. put_item() Lambda aws lambda create-function --function-name writeToKinesis --role WRITETOKINESIS_ROLE --zip-file fileb://writeToKinesis.zip --handler writeToKinesis.lambda_handler --runtime python2.7 --memory-size 128 --description "Write events to Kinesis” Kinesis StreamsLambda KinesisTo DynamoDB writeTo Kinesis
  • 21. Step 7: create API DynamoDB S3 eventTable Web apps DynamoDB streams dynamodb. put_item() Lambda Painful to do with the CLI: 9 aws apigateway calls :-/ à  Use the console à  Use a Swagger File http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html à  Use the Serverless framework Kinesis StreamsLambda KinesisTo DynamoDB writeTo Kinesis API Gateway
  • 22. Step 8: create IAM role aws iam create-role --role-name DynamoDBToFirehose_role --assume-role-policy-document file://lambda_trust_policy.json aws iam create-policy --policy-name DynamoDBToFirehose_policy --policy-document file://DynamoDBToFirehose_policy.json aws iam attach-role-policy --role-name DynamoDBToFirehose_role --policy-arn DYNAMODBTOFIREHOSE_POLICY_ARN
  • 23. Step 9: create Lambda funcIon and DynamoDB trigger aws lambda create-function --function-name DynamoDBToFirehose --role DYNAMODBTOFIREHOSE_ROLE_ARN --zip-file fileb://DynamoDBToFirehose.zip --handler DynamoDBToFirehose.lambda_handler --runtime python2.7 --memory-size 128 --description "Write DynamoDB stream to Kinesis Firehose" aws lambda create-event-source-mapping --function-name DynamoDBToFirehose --event-source DYNAMODB_STREAM_ARN --batch-size 10 --starting-position TRIM_HORIZON Lambda DynamoDB ToFirehose eventTable DynamoDB streams DynamoDB
  • 24. Step 10: create IAM role aws iam create-role --role-name firehoseToS3_role --assume-role-policy-document file://firehose_trust_policy.json aws iam create-policy --policy-name firehoseToS3_policy --policy-document file://firehoseToS3_policy.json aws iam attach-role-policy --role-name firehoseToS3_role --policy-arn FIREHOSETOS3_POLICY_ARN
  • 25. Step 11: create S3 bucket aws s3 mb s3://jsimon-public Lambda DynamoDB ToFirehose eventTable DynamoDB streams DynamoDB
  • 26. Step 12: create Kinesis Firehose stream aws firehose create-delivery-stream --delivery-stream-name firehoseToS3 --s3-destination-configuration RoleARN=FIREHOSETOS3_ROLE_ARN, BucketARN="arn:aws:s3:::jsimon-public", Prefix="firehose", BufferingHints={SizeInMBs=1,IntervalInSeconds=60}, CompressionFormat="GZIP", EncryptionConfiguration={NoEncryptionConfig="NoEncryption"} Kinesis Firehose firehoseToS3 Lambda DynamoDB ToFirehose eventTable DynamoDB streams DynamoDB
  • 27. Building a serverless data pipeline Lambda DynamoDB Kinesis Firehose API Gateway HTTP POST 
 /prod/logger writeTo Kinesis DynamoDB ToFirehose S3 eventTable DynamoDB streams bucket EMR, Redshift, … firehoseToS3 Kinesis StreamsLambda Lambda KinesisTo DynamoDB Web apps Lines of code: 16 Number of servers: zero Performance & scalability: maximum https://github.com/juliensimon/aws/tree/master/serverlessPipeline
  • 30. Going further AWS re:Invent 2014 | (MBL202) NEW LAUNCH: Getting Started with AWS Lambda https://www.youtube.com/watch?v=UFj27laTWQA AWS re:Invent 2015 | (DEV203) Amazon API Gateway & AWS Lambda to Build Secure and Scalable APIs https://www.youtube.com/watch?v=ZBxWZ9bgd44 AWS re:Invent 2015 | (DVO209) JAWS: The Monstrously Scalable Serverless Framework https://www.youtube.com/watch?v=D_U6luQ6I90 https://github.com/serverless/serverless AWS re:Invent 2015 | (ARC308) The Serverless Company Using AWS Lambda https://www.youtube.com/watch?v=U8ODkSCJpJU AWS re:Invent 2015 | (CMP407) Lambda as Cron: Scheduling Invocations in AWS Lambda https://www.youtube.com/watch?v=FhJxTIq81AU Reference architectures http://www.allthingsdistributed.com/2016/06/aws-lambda-serverless-reference-architectures.html
  • 32. AWS Enterprise Summit – 27/10/2016, Paris http://amzn.to/1X2yp0i