SlideShare una empresa de Scribd logo
1 de 17
Serverless IoT with AWS
Lambda
Walkthrough, Enterprise
Implications
Bob Balaban
SGAArchitect
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
Agenda
• “Serverless” Use Case: IoT
• Demo overview
• Click a button, get an email
• Step by Step
• Config
• Test
• Code
• Test again
• Enterprise perspectives
• Q&A
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
IoT: Internet of Things
• Many (103? 106? 109?) devices sending data to a collection point for
(real time?) analysis and reporting
• Many issues at scale!
• Software (architecture and implementation)
• Hardware (security, deployment, maintenance…)
• AWS Lambda is an interesting approach
• Fits with microservices architectures
• Small, stateless (usually) chunks of bizlogic
• Potential for significant cost savings (you don’t pay for idle time)
• Azure Functions, Google Cloud Functions, IBM OpenWhisk…
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
Microservices + Serverless
• The right service
• For the right price
• In the right location
• At the right time
• On demand!
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
Demo: Click a button, get an email
Setup and Coding
• Configure the button
• Unit Test
• Write the code
• Unit Test
• End-to-end Test
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
Configure the Button - 1
• Go to AWS IoT console
• Create a “thing” (these are region-specific!!)
• Create x509 certificate for the button, activate
• Download cert and private key files
• Create an IoT Policy to authorize the button to access services
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
{ "Version": "2012-10-17",
"Statement": [
{ "Effect": "Allow",
"Action": "iot:Publish",
"Resource": "*"
}
]}
Configure the Button - 2
• Certificate -> Attach Policy
• Certificate -> Attach Thing
• Find “Custom IoT Endpoint”
• (e.g. <account#>.iot.us-west-2.amazonaws.com)
• Program the button:
• Hold down button until blue light flashes (sets up wi-fi hotspot
• Connect laptop wi-fi to hotspot (pw is last 8 digits of button serial number)
• Browse to http://192.168.0.1/index.html
• Enter wi-fi connection info (SSID, pw if needed)
• Upload certificate, private key, add in custom endpoint…
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
Configure the Button - 3
• Test your connectivity
• IoT console, “MQTT Client” tab
• Generate client ID, Connect
• Subscribe to topic “iotbutton/+” (or instead of +, specific button serial number)
• Click the button!
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
Write the Lambda Code - 1
• AWS tutorial:
http://docs.aws.amazon.com/iot/latest/developerguide/iot-button-
lambda.html
• Go to AWS Lambda Console
• “Create a Lambda Function”
• Select “iot-button-email” blueprint, select runtime (node.js-4.3)
• On “Configure Triggers” page, select “IoT Button”, enter serial
number
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
Write the Lambda Code - 2
• Go to “Configure Function”, review the code in the editor
• Replace hardcoded email string
• For authorization: “Create role from template”
• Give it a name
• Select template “AWS IoT Button permissions”
• Allows function code to access outside services (especially SNS)
• Click “Create”
• Add trigger: AWS IoT -> IoTButton, enter serial number
• Unit Test:
• Click “Test”, you should get an email
• Actions -> Configure Test event”, set it up to send the right data
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
Test it!
• Click the button
• Blinking white light
• Steady green
• Email should arrive within a few seconds
• Go to CloudWatch
• Logs
• Click on button log stream
• Review log events, see billing info on log “REPORT”
• Look at metrics (not especially interesting for small numbers of events)
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
Enhance it!
• Hardcoded email address is not really practical
• Create DynamDb table that maps button ID to an email addr
• Re-factor event handler to look up email dynamically
• Node.js async “callback” pattern
• Create another table to record hits
• Modify Lambda role permissions, add “Microservice permissions”
• Add some extra logging
• Test it!
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
Enterprise Perspectives
• Config needs way more automation
• Try doing 1000 buttons…
• Then try managing 1000 lambda functions…
• Pre manufacture hardware with required files? How to keep it secure…
• Policies/permissions (button, lambda)
• “Printf” style debugging is SO 1970s
• Need local framework(s) to debug code for real
• You want to know how much it’s going to cost to run your system
BEFORE you go to production
• http://serverlesscalc.com/#
• APM tools?
• Idle-time behavior, you pay for spin-up time
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
Other Options for Invoking Functions (Lambda
Events)
• AWS Services – Publishes events which invoke Lambda
• S3 – Asynchronous invocation by S3
• DynamoDB / Kinesis Streams – Lambda polls the stream(s) and invokes synchronously
• Cognito – Invokes synchronously
• HTTPS – Custom REST API and endpoint using API Gateway
• Custom Apps – Client/mobile/web app publish events via SDKs
• Scheduled Events – Schedule events via AWS Lambda Console
• Hours, Days, Weeks, cron expression
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
Serverless Challenges
LessOps requires new ways of thinking about deployment, testing, etc.
Serverless billing can be challenging and not always cheaper than IaaS.
Invoking functions requires the cloud vendors to launch containers (startup
considerations).
New development skills required including cloud knowledge
Small stateless functions require new coding patterns
Stateful coding requires even more skill
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
Thank you!
Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
Q & A

Más contenido relacionado

La actualidad más candente

Serverless Applications on AWS
Serverless Applications on AWSServerless Applications on AWS
Serverless Applications on AWSDean Bryen
 
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 ...Amazon Web Services
 
AWS Lambda: Event-driven Code in the Cloud
AWS Lambda: Event-driven Code in the CloudAWS Lambda: Event-driven Code in the Cloud
AWS Lambda: Event-driven Code in the CloudAmazon Web Services
 
Static web apps by GitHub action
Static web apps by GitHub actionStatic web apps by GitHub action
Static web apps by GitHub actionSeven Peaks Speaks
 
Serverless Framework (2018)
Serverless Framework (2018)Serverless Framework (2018)
Serverless Framework (2018)Rowell Belen
 
Azure functions
Azure functionsAzure functions
Azure functionsvivek p s
 
AWS Lambda: Event-driven Code in the Cloud
AWS Lambda: Event-driven Code in the CloudAWS Lambda: Event-driven Code in the Cloud
AWS Lambda: Event-driven Code in the CloudAmazon Web Services
 
Serverless computing with AWS Lambda
Serverless computing with AWS Lambda Serverless computing with AWS Lambda
Serverless computing with AWS Lambda Apigee | Google Cloud
 
AWS March 2016 Webinar Series Getting Started with Serverless Architectures
AWS March 2016 Webinar Series   Getting Started with Serverless ArchitecturesAWS March 2016 Webinar Series   Getting Started with Serverless Architectures
AWS March 2016 Webinar Series Getting Started with Serverless ArchitecturesAmazon Web Services
 
Azure serverless architectures
Azure serverless architecturesAzure serverless architectures
Azure serverless architecturesBenoit Le Pichon
 
AWS Lambda - A quick introduction #advancedaws
AWS Lambda - A quick introduction #advancedawsAWS Lambda - A quick introduction #advancedaws
AWS Lambda - A quick introduction #advancedawsChris Richardson
 
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 LambdaAmazon Web Services
 
Getting sh*t done with Azure Functions (on AKS!)
Getting sh*t done with Azure Functions (on AKS!)Getting sh*t done with Azure Functions (on AKS!)
Getting sh*t done with Azure Functions (on AKS!)Rick van den Bosch
 
Building API in the cloud using Azure Functions
Building API in the cloud using Azure FunctionsBuilding API in the cloud using Azure Functions
Building API in the cloud using Azure FunctionsAleksandar Bozinovski
 
Lambda and serverless - DevOps North East Jan 2017
Lambda and serverless - DevOps North East Jan 2017Lambda and serverless - DevOps North East Jan 2017
Lambda and serverless - DevOps North East Jan 2017Mike Shutlar
 
AWS Serverless concepts and solutions
AWS Serverless concepts and solutionsAWS Serverless concepts and solutions
AWS Serverless concepts and solutionsElenaIvannikova3
 
February 2016 Webinar Series Migrate Your Apps from Parse to AWS
February 2016 Webinar Series   Migrate Your Apps from Parse to AWSFebruary 2016 Webinar Series   Migrate Your Apps from Parse to AWS
February 2016 Webinar Series Migrate Your Apps from Parse to AWSAmazon Web Services
 

La actualidad más candente (20)

Serverless Applications on AWS
Serverless Applications on AWSServerless Applications on AWS
Serverless Applications on AWS
 
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 ...
 
AWS Lambda: Event-driven Code in the Cloud
AWS Lambda: Event-driven Code in the CloudAWS Lambda: Event-driven Code in the Cloud
AWS Lambda: Event-driven Code in the Cloud
 
Static web apps by GitHub action
Static web apps by GitHub actionStatic web apps by GitHub action
Static web apps by GitHub action
 
Serverless Framework (2018)
Serverless Framework (2018)Serverless Framework (2018)
Serverless Framework (2018)
 
Azure functions
Azure functionsAzure functions
Azure functions
 
AWS Lambda: Event-driven Code in the Cloud
AWS Lambda: Event-driven Code in the CloudAWS Lambda: Event-driven Code in the Cloud
AWS Lambda: Event-driven Code in the Cloud
 
Serverless computing with AWS Lambda
Serverless computing with AWS Lambda Serverless computing with AWS Lambda
Serverless computing with AWS Lambda
 
AWS March 2016 Webinar Series Getting Started with Serverless Architectures
AWS March 2016 Webinar Series   Getting Started with Serverless ArchitecturesAWS March 2016 Webinar Series   Getting Started with Serverless Architectures
AWS March 2016 Webinar Series Getting Started with Serverless Architectures
 
AWS Service Drill Downs
AWS Service Drill DownsAWS Service Drill Downs
AWS Service Drill Downs
 
Azure serverless architectures
Azure serverless architecturesAzure serverless architectures
Azure serverless architectures
 
AWS Lambda - A quick introduction #advancedaws
AWS Lambda - A quick introduction #advancedawsAWS Lambda - A quick introduction #advancedaws
AWS Lambda - A quick introduction #advancedaws
 
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
 
Getting sh*t done with Azure Functions (on AKS!)
Getting sh*t done with Azure Functions (on AKS!)Getting sh*t done with Azure Functions (on AKS!)
Getting sh*t done with Azure Functions (on AKS!)
 
Building API in the cloud using Azure Functions
Building API in the cloud using Azure FunctionsBuilding API in the cloud using Azure Functions
Building API in the cloud using Azure Functions
 
Lambda and serverless - DevOps North East Jan 2017
Lambda and serverless - DevOps North East Jan 2017Lambda and serverless - DevOps North East Jan 2017
Lambda and serverless - DevOps North East Jan 2017
 
AWS Serverless concepts and solutions
AWS Serverless concepts and solutionsAWS Serverless concepts and solutions
AWS Serverless concepts and solutions
 
February 2016 Webinar Series Migrate Your Apps from Parse to AWS
February 2016 Webinar Series   Migrate Your Apps from Parse to AWSFebruary 2016 Webinar Series   Migrate Your Apps from Parse to AWS
February 2016 Webinar Series Migrate Your Apps from Parse to AWS
 
Serverless meetup
Serverless meetupServerless meetup
Serverless meetup
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
 

Similar a Serverless IoT with AWS Lambda

Building Serverless Chat Bots - AWS August Webinar Series
Building Serverless Chat Bots - AWS August Webinar SeriesBuilding Serverless Chat Bots - AWS August Webinar Series
Building Serverless Chat Bots - AWS August Webinar SeriesAmazon Web Services
 
What's New for the Windows Azure Developer? Lots! (July 2013)
What's New for the Windows Azure Developer?  Lots! (July 2013)What's New for the Windows Azure Developer?  Lots! (July 2013)
What's New for the Windows Azure Developer? Lots! (July 2013)Michael Collier
 
Deep-Dive: Building Native iOS and Android Application with the AWS Mobile SDK
Deep-Dive: Building Native iOS and Android Application with the AWS Mobile SDKDeep-Dive: Building Native iOS and Android Application with the AWS Mobile SDK
Deep-Dive: Building Native iOS and Android Application with the AWS Mobile SDKAmazon Web Services
 
Iot meets Serverless
Iot meets ServerlessIot meets Serverless
Iot meets ServerlessNarendran R
 
AWS IoT Button and Lambda to power a blockchain project - AWS Serverless Web Day
AWS IoT Button and Lambda to power a blockchain project - AWS Serverless Web DayAWS IoT Button and Lambda to power a blockchain project - AWS Serverless Web Day
AWS IoT Button and Lambda to power a blockchain project - AWS Serverless Web DayAWS Germany
 
AWS March 2016 Webinar Series - AWS IoT Real Time Stream Processing with AWS ...
AWS March 2016 Webinar Series - AWS IoT Real Time Stream Processing with AWS ...AWS March 2016 Webinar Series - AWS IoT Real Time Stream Processing with AWS ...
AWS March 2016 Webinar Series - AWS IoT Real Time Stream Processing with AWS ...Amazon Web Services
 
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...MongoDB
 
amazon-cognito-auth-in-minutes
amazon-cognito-auth-in-minutesamazon-cognito-auth-in-minutes
amazon-cognito-auth-in-minutesVladimir Budilov
 
Azure Stream Analytics : Analyse Data in Motion
Azure Stream Analytics  : Analyse Data in MotionAzure Stream Analytics  : Analyse Data in Motion
Azure Stream Analytics : Analyse Data in MotionRuhani Arora
 
GDC 2015 - Game Analytics with AWS Redshift, Kinesis, and the Mobile SDK
GDC 2015 - Game Analytics with AWS Redshift, Kinesis, and the Mobile SDKGDC 2015 - Game Analytics with AWS Redshift, Kinesis, and the Mobile SDK
GDC 2015 - Game Analytics with AWS Redshift, Kinesis, and the Mobile SDKNate Wiger
 
Serverless Design Patterns
Serverless Design PatternsServerless Design Patterns
Serverless Design PatternsYan Cui
 
(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 IoTAmazon Web Services
 
Serveless design patterns
Serveless design patternsServeless design patterns
Serveless design patternsYan Cui
 
AWS re:Invent 2016: Deep-Dive: Native, Hybrid and Web patterns with Serverles...
AWS re:Invent 2016: Deep-Dive: Native, Hybrid and Web patterns with Serverles...AWS re:Invent 2016: Deep-Dive: Native, Hybrid and Web patterns with Serverles...
AWS re:Invent 2016: Deep-Dive: Native, Hybrid and Web patterns with Serverles...Amazon Web Services
 
#SPFestSea azr302 The SharePoint Framework and the #MicrosoftGraph under ster...
#SPFestSea azr302 The SharePoint Framework and the #MicrosoftGraph under ster...#SPFestSea azr302 The SharePoint Framework and the #MicrosoftGraph under ster...
#SPFestSea azr302 The SharePoint Framework and the #MicrosoftGraph under ster...Vincent Biret
 
Controlling your home with IoT Hub
Controlling your home with IoT HubControlling your home with IoT Hub
Controlling your home with IoT HubStamatis Pavlis
 
Azure Functions Hands-on lab | Global Azure Bootcamp | Radu Vunvulea
Azure Functions Hands-on lab | Global Azure Bootcamp | Radu VunvuleaAzure Functions Hands-on lab | Global Azure Bootcamp | Radu Vunvulea
Azure Functions Hands-on lab | Global Azure Bootcamp | Radu VunvuleaRadu Vunvulea
 
One Click Enterprise IoT Services - March 2017 AWS Online Tech Talks
One Click Enterprise IoT Services - March 2017 AWS Online Tech TalksOne Click Enterprise IoT Services - March 2017 AWS Online Tech Talks
One Click Enterprise IoT Services - March 2017 AWS Online Tech TalksAmazon Web Services
 

Similar a Serverless IoT with AWS Lambda (20)

Building Serverless Chat Bots - AWS August Webinar Series
Building Serverless Chat Bots - AWS August Webinar SeriesBuilding Serverless Chat Bots - AWS August Webinar Series
Building Serverless Chat Bots - AWS August Webinar Series
 
What's New for the Windows Azure Developer? Lots! (July 2013)
What's New for the Windows Azure Developer?  Lots! (July 2013)What's New for the Windows Azure Developer?  Lots! (July 2013)
What's New for the Windows Azure Developer? Lots! (July 2013)
 
Connecting to AWS IoT
Connecting to AWS IoTConnecting to AWS IoT
Connecting to AWS IoT
 
Deep-Dive: Building Native iOS and Android Application with the AWS Mobile SDK
Deep-Dive: Building Native iOS and Android Application with the AWS Mobile SDKDeep-Dive: Building Native iOS and Android Application with the AWS Mobile SDK
Deep-Dive: Building Native iOS and Android Application with the AWS Mobile SDK
 
Iot meets Serverless
Iot meets ServerlessIot meets Serverless
Iot meets Serverless
 
Getting Started with AWS IoT
Getting Started with AWS IoTGetting Started with AWS IoT
Getting Started with AWS IoT
 
AWS IoT Button and Lambda to power a blockchain project - AWS Serverless Web Day
AWS IoT Button and Lambda to power a blockchain project - AWS Serverless Web DayAWS IoT Button and Lambda to power a blockchain project - AWS Serverless Web Day
AWS IoT Button and Lambda to power a blockchain project - AWS Serverless Web Day
 
AWS March 2016 Webinar Series - AWS IoT Real Time Stream Processing with AWS ...
AWS March 2016 Webinar Series - AWS IoT Real Time Stream Processing with AWS ...AWS March 2016 Webinar Series - AWS IoT Real Time Stream Processing with AWS ...
AWS March 2016 Webinar Series - AWS IoT Real Time Stream Processing with AWS ...
 
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
 
amazon-cognito-auth-in-minutes
amazon-cognito-auth-in-minutesamazon-cognito-auth-in-minutes
amazon-cognito-auth-in-minutes
 
Azure Stream Analytics : Analyse Data in Motion
Azure Stream Analytics  : Analyse Data in MotionAzure Stream Analytics  : Analyse Data in Motion
Azure Stream Analytics : Analyse Data in Motion
 
GDC 2015 - Game Analytics with AWS Redshift, Kinesis, and the Mobile SDK
GDC 2015 - Game Analytics with AWS Redshift, Kinesis, and the Mobile SDKGDC 2015 - Game Analytics with AWS Redshift, Kinesis, and the Mobile SDK
GDC 2015 - Game Analytics with AWS Redshift, Kinesis, and the Mobile SDK
 
Serverless Design Patterns
Serverless Design PatternsServerless Design Patterns
Serverless Design Patterns
 
(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
 
Serveless design patterns
Serveless design patternsServeless design patterns
Serveless design patterns
 
AWS re:Invent 2016: Deep-Dive: Native, Hybrid and Web patterns with Serverles...
AWS re:Invent 2016: Deep-Dive: Native, Hybrid and Web patterns with Serverles...AWS re:Invent 2016: Deep-Dive: Native, Hybrid and Web patterns with Serverles...
AWS re:Invent 2016: Deep-Dive: Native, Hybrid and Web patterns with Serverles...
 
#SPFestSea azr302 The SharePoint Framework and the #MicrosoftGraph under ster...
#SPFestSea azr302 The SharePoint Framework and the #MicrosoftGraph under ster...#SPFestSea azr302 The SharePoint Framework and the #MicrosoftGraph under ster...
#SPFestSea azr302 The SharePoint Framework and the #MicrosoftGraph under ster...
 
Controlling your home with IoT Hub
Controlling your home with IoT HubControlling your home with IoT Hub
Controlling your home with IoT Hub
 
Azure Functions Hands-on lab | Global Azure Bootcamp | Radu Vunvulea
Azure Functions Hands-on lab | Global Azure Bootcamp | Radu VunvuleaAzure Functions Hands-on lab | Global Azure Bootcamp | Radu Vunvulea
Azure Functions Hands-on lab | Global Azure Bootcamp | Radu Vunvulea
 
One Click Enterprise IoT Services - March 2017 AWS Online Tech Talks
One Click Enterprise IoT Services - March 2017 AWS Online Tech TalksOne Click Enterprise IoT Services - March 2017 AWS Online Tech Talks
One Click Enterprise IoT Services - March 2017 AWS Online Tech Talks
 

Último

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
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 - DevoxxUKJago de Vreede
 
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...Zilliz
 
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, ...Angeliki Cooney
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
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, Adobeapidays
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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 DiscoveryTrustArc
 
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...Orbitshub
 
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 educationjfdjdjcjdnsjd
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
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 connectorsNanddeep Nachan
 
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 SavingEdi Saputra
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
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...apidays
 
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...Martijn de Jong
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 

Último (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
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
 
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...
 
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, ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
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...
 
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
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
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
 
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
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
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...
 
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...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 

Serverless IoT with AWS Lambda

  • 1. Serverless IoT with AWS Lambda Walkthrough, Enterprise Implications Bob Balaban SGAArchitect Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
  • 2. Agenda • “Serverless” Use Case: IoT • Demo overview • Click a button, get an email • Step by Step • Config • Test • Code • Test again • Enterprise perspectives • Q&A Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
  • 3. IoT: Internet of Things • Many (103? 106? 109?) devices sending data to a collection point for (real time?) analysis and reporting • Many issues at scale! • Software (architecture and implementation) • Hardware (security, deployment, maintenance…) • AWS Lambda is an interesting approach • Fits with microservices architectures • Small, stateless (usually) chunks of bizlogic • Potential for significant cost savings (you don’t pay for idle time) • Azure Functions, Google Cloud Functions, IBM OpenWhisk… Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
  • 4. Microservices + Serverless • The right service • For the right price • In the right location • At the right time • On demand! Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
  • 5. Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc. Demo: Click a button, get an email
  • 6. Setup and Coding • Configure the button • Unit Test • Write the code • Unit Test • End-to-end Test Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
  • 7. Configure the Button - 1 • Go to AWS IoT console • Create a “thing” (these are region-specific!!) • Create x509 certificate for the button, activate • Download cert and private key files • Create an IoT Policy to authorize the button to access services Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "iot:Publish", "Resource": "*" } ]}
  • 8. Configure the Button - 2 • Certificate -> Attach Policy • Certificate -> Attach Thing • Find “Custom IoT Endpoint” • (e.g. <account#>.iot.us-west-2.amazonaws.com) • Program the button: • Hold down button until blue light flashes (sets up wi-fi hotspot • Connect laptop wi-fi to hotspot (pw is last 8 digits of button serial number) • Browse to http://192.168.0.1/index.html • Enter wi-fi connection info (SSID, pw if needed) • Upload certificate, private key, add in custom endpoint… Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
  • 9. Configure the Button - 3 • Test your connectivity • IoT console, “MQTT Client” tab • Generate client ID, Connect • Subscribe to topic “iotbutton/+” (or instead of +, specific button serial number) • Click the button! Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
  • 10. Write the Lambda Code - 1 • AWS tutorial: http://docs.aws.amazon.com/iot/latest/developerguide/iot-button- lambda.html • Go to AWS Lambda Console • “Create a Lambda Function” • Select “iot-button-email” blueprint, select runtime (node.js-4.3) • On “Configure Triggers” page, select “IoT Button”, enter serial number Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
  • 11. Write the Lambda Code - 2 • Go to “Configure Function”, review the code in the editor • Replace hardcoded email string • For authorization: “Create role from template” • Give it a name • Select template “AWS IoT Button permissions” • Allows function code to access outside services (especially SNS) • Click “Create” • Add trigger: AWS IoT -> IoTButton, enter serial number • Unit Test: • Click “Test”, you should get an email • Actions -> Configure Test event”, set it up to send the right data Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
  • 12. Test it! • Click the button • Blinking white light • Steady green • Email should arrive within a few seconds • Go to CloudWatch • Logs • Click on button log stream • Review log events, see billing info on log “REPORT” • Look at metrics (not especially interesting for small numbers of events) Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
  • 13. Enhance it! • Hardcoded email address is not really practical • Create DynamDb table that maps button ID to an email addr • Re-factor event handler to look up email dynamically • Node.js async “callback” pattern • Create another table to record hits • Modify Lambda role permissions, add “Microservice permissions” • Add some extra logging • Test it! Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
  • 14. Enterprise Perspectives • Config needs way more automation • Try doing 1000 buttons… • Then try managing 1000 lambda functions… • Pre manufacture hardware with required files? How to keep it secure… • Policies/permissions (button, lambda) • “Printf” style debugging is SO 1970s • Need local framework(s) to debug code for real • You want to know how much it’s going to cost to run your system BEFORE you go to production • http://serverlesscalc.com/# • APM tools? • Idle-time behavior, you pay for spin-up time Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
  • 15. Other Options for Invoking Functions (Lambda Events) • AWS Services – Publishes events which invoke Lambda • S3 – Asynchronous invocation by S3 • DynamoDB / Kinesis Streams – Lambda polls the stream(s) and invokes synchronously • Cognito – Invokes synchronously • HTTPS – Custom REST API and endpoint using API Gateway • Custom Apps – Client/mobile/web app publish events via SDKs • Scheduled Events – Schedule events via AWS Lambda Console • Hours, Days, Weeks, cron expression Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
  • 16. Serverless Challenges LessOps requires new ways of thinking about deployment, testing, etc. Serverless billing can be challenging and not always cheaper than IaaS. Invoking functions requires the cloud vendors to launch containers (startup considerations). New development skills required including cloud knowledge Small stateless functions require new coding patterns Stateful coding requires even more skill Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc.
  • 17. Thank you! Serverless-Boston Meet-up Nov. 2, 2016, ©SGA, Inc. Q & A

Notas del editor

  1. The history of cloud has been continuous abstraction of infrastructure essentially enabled with trust. The more you trust the cloud the more you will rely on it for your solutions. In 2006 AWS created the EC2 service which abstracted the datacenter, server hardware, hypervisor, networking, and associated security. The datacenter abstraction lowers costs, time to market, and operational risk. It took ten years for cloud to become mainstream and many firms now have a cloud first strategy. No longer are we only migrating monolithic apps but building new native cloud solutions. In 2014 AWS introduced Lambda which abstracts the O/S and offers a compute service. This server abstraction again lowers costs, time to market, and operational risk. Since companies are becoming cloud savvy the adoption to serverless will be faster. Perhaps in five years it will supplant IaaS. Today, we see a collection of isolated clouds, each rich with their own set of services. The future is on-demand intercloud applications. While you can enjoy cloud services natively, anticipate whole clouds and services becoming abstracted with frameworks (serverless.com) and by cloud services themselves (Auth0). As always, there are advantages and disadvantages to abstracting.
  2. Deployments will require a new strategy, new coding patterns. For example, serverless.com has a good article on some patterns to consider. If anyone is interested in speaking about patterns please contact us to give a talk. The Graph Pattern is an interesting use of GraphQL, an abstraction of data access and relationships, between clients and servers. serverless.com is working on the Graph Gateway Pattern which uses the Microservices Pattern with GraphQL