SlideShare une entreprise Scribd logo
1  sur  47
Lessons Learned After a Year of AWS Lambda
● AWS Lambda Overview
● Performance characteristics
● Lambda Integration
● Debugging AWS Lambda
Agenda:
AWS Lambda Overview
AWS Lambda
● Created in 2014, launched at
re:Invent
● Kicked off "serverless" (caveat)
● Function-as-a-Service
○Deploy code, not applications
AWS Lambda Details
● Supports Node.JS, Python, C#, and
Java
● Can call to server functionality
● Code deployment options
○ Uploading as a ZIP file (S3 or HTTP)
○ In-browser editor
Calling AWS Lambda Functions
● Event-based triggers
○ On-Demand via HTTP
● Event Sources
○ AWS Services (S3, DynamoDB, others)
○ API Gateway
○ AWS SDK
Creating a Lambda Function
(in pictures)
Demo
Demo
Demo
Demo
Demo
Demo
Performance Characteristics
● Scraped logs of 2.6 million function
calls
● Pulled from CloudWatch on AWS
○ Function execution only
● Data on computing resources
consumed only
Examining Lambda Performance
● Graphs built on a sample of full data set
(26,000 vs 2.6 million)
○ Sample is not random
● No relation to size of Lambda function
● Confounding factors may be present
● Significant outliers
First, Caveats
Memory vs Execution Time
Memory vs Execution Time
● Does not incorporate HTTP Request
● Not a very strong correlation (r=-0.03)
● Three distinct groupings
● Tip: More memory allocated = faster
processor
Runtime Histogram
Runtime Histogram
● Many functions run in < 100 ms
● Ignores code characteristics
● Ignores significant outliers on both ends
● Bimodal due to function characteristics
Improving the Analysis
● Capture full cycle times if possible
● Correlate runtimes with size of function
● Algorithmic complexity analysis
● Randomize sample selection
Lambda Integration
Four problems to solve:
● Problem 1 - Lambda Ownership
● Problem 2 - Deduplication
● Problem 3 - Triggering Lambda Functions
● Problem 4 - User Security
Lambda Integration
Problem 1 - Lambda Ownership
Option 1: User ownership
● Users host Lambda functions in their AWS
account
● Backand uses provided credentials to call
Lambda
● Maximizes freedom at the expense of ease of
use (also, security)
Problem 1 - Lambda Ownership
Option 2: Backand ownership
● Backand hosts Lambda functions in internal
AWS account
● No need for user's AWS credentials
● Maximizes ease of use at expense of user
freedom
Solution selected: Backand owns code
● Lambda function names need to be unique
● Name length limits:
○ 140 characters for full ARN
○ 64 character subset for function name
Solution Selected: prepend guaranteed unique data
● Backand app names have a uniqueness constraint
● Could also use GUID, but this reduces name length
to 32 characters
Problem 2 - Deduplication
● Most triggers AWS-based
○ S3, DynamoDB, Cloudwatch
○ None work for our use case
● API Gateway
○ Positive: Allows HTTP trigger
○ Negative: Complex configuration
○ Negative: Return value requirements
Solution selected: AWS SDK
Problem 3 - Triggering Lambda
● Default: configure IAM profile and users
○ Need to give every dev access to AWS
○ Does not integrate with org security
○ Needs to be managed in multiple places
● Clients want flexibility and security
○ Need Single Sign-On
○ Need custom third-party security tools
○ Need ease of management
Solution selected: Lambda Launcher
Problem 4 - User Security
Debugging AWS Lambda
Debugging Lambda Functions
● Cloudwatch Integration
○ Provides call record, and console.log()
● Custom parameter input
○ Modal dialog presented before each run
● … and that's it
Emulating Lambda Locally
Three things to mimic:
● Trigger Event
● Machine Environment
● Invocation
Emulating trigger event
● Each trigger sends different data
● Dump data from a sample call
(console.log())
● Keep in mind any transformations (API
Gateway)
Lambda Machine Environment
● Based on Amazon Machine Instance
● Dynamically provisioned (hot vs cold)
● Temporary storage (/tmp, 500 MB)
○ NOT guaranteed to persist
● Cannot accurately model machine
Invoking Lambda
● External Function Call (entry point)
● Custom parameters in "event" object
● Execution context details in "context"
● Callbacks (if supported) in "callback"
Debugging Lambda Locally
● Execution environment hard to
emulate
● Need to mimic input format from
action
● Need to mimic output format
● Need a test harness
Creating a Test Harness (Node.js)
● Function Prototype
● Including Handler
● Mimicking Lambda Invocation
○ Parameters in event object
○ Handlers in the context object
Creating a Test Harness
● Calling a Lambda function
Test Harness Notes
● Callback mechanism
○ Need to adapt for each language
● Using callbacks in context parameter
○ Not supported, overloads context object
● Not a perfect substitute
○ Calls the function, but not from the same
environment
What do we get?
● Per-line output via console.log
● Immediate feedback from command
● Breakpoints and other local debugging
tools
● Unit and Integration tests
● CI/CD compatible (with CLI)
Deploying Your Code
● Zip-file from S3, or manual upload
○ Gotcha: zip only the source
code, not the parent folder!
● Test upload
● Publish new API
● Complex, non-intuitive
Using Backand's CLI Tool
● Backand On-Demand Node.JS
Lambda Functions
● Backand CLI abstracts away
deployment
● npm install -g backand
● Requires registering with Backand
Lambda through a CLI
● Initialize a function
○ backand function init
● Copy your Node.JS code into created
directory and iterate
● Deploy
○ backand function deploy
Calling Your Lambda
● Authentication
○ can be anonymous
○ api.backand.com/1/token
● cURL
curl -H "<auth header>" "https://api.backand.com/1/function/general/<name>"
● JavaScript (with Backand SDK)
backand.function.get(...)
What is Backand?
● Serverless app platform
● Manages your app's database
● Manages your app's security and
authentication
● Provides custom server-side code execution
● Provides hosting options
● Provides logging, analytics, and more
Backand Features
● Automated REST API
● Bring your own Database
● Custom JavaScript Actions
● Server-Side Code Execution
● Batch and Bulk Processing
● Scheduled Tasks
● Automated messages
● Real-time Communications
● User and Role-based
Security
● Social Media Authentication
● GUI Schema Editor
● Custom Queries
● REST API Playground
● Sample Code Generation
● Hosting
● Detailed Analytics
● Logging
● Multi-Platform SDK
● Single Sign On Support
● Live online demo every other Wednesday
● Webinar - Invoking Lambda through Alexa
Thursday, June 22nd, 11 AM Pacific
Learn more at https://www.backand.com
Want to know more?
THANK YOU
https://github.com/backand
matt@backand.com
@matt_billock
`

Contenu connexe

Tendances

Reactive programming using rx java & akka actors - pdx-scala - june 2014
Reactive programming   using rx java & akka actors - pdx-scala - june 2014Reactive programming   using rx java & akka actors - pdx-scala - june 2014
Reactive programming using rx java & akka actors - pdx-scala - june 2014
Thomas Lockney
 

Tendances (20)

Aws Lambda in Swift - NSLondon - 3rd December 2020
Aws Lambda in Swift - NSLondon - 3rd December 2020Aws Lambda in Swift - NSLondon - 3rd December 2020
Aws Lambda in Swift - NSLondon - 3rd December 2020
 
Turbo charging v8 engine
Turbo charging v8 engineTurbo charging v8 engine
Turbo charging v8 engine
 
Testing Spark and Scala
Testing Spark and ScalaTesting Spark and Scala
Testing Spark and Scala
 
AWS Step Function with API Gateway Integration - Metin Kale, Chicago
AWS Step Function with API Gateway Integration - Metin Kale, ChicagoAWS Step Function with API Gateway Integration - Metin Kale, Chicago
AWS Step Function with API Gateway Integration - Metin Kale, Chicago
 
Fast Deployments to Multiple Golang Lambda Functions
Fast Deployments to Multiple Golang Lambda FunctionsFast Deployments to Multiple Golang Lambda Functions
Fast Deployments to Multiple Golang Lambda Functions
 
Logging in Scala
Logging in ScalaLogging in Scala
Logging in Scala
 
Understanding Implicits in Scala
Understanding Implicits in ScalaUnderstanding Implicits in Scala
Understanding Implicits in Scala
 
2020.02.15 DelEx - CI/CD in AWS Cloud
2020.02.15 DelEx - CI/CD in AWS Cloud2020.02.15 DelEx - CI/CD in AWS Cloud
2020.02.15 DelEx - CI/CD in AWS Cloud
 
Dynamic input tables lwc vs aura vs. visualforce
Dynamic input tables  lwc vs aura vs. visualforceDynamic input tables  lwc vs aura vs. visualforce
Dynamic input tables lwc vs aura vs. visualforce
 
Reactive programming using rx java & akka actors - pdx-scala - june 2014
Reactive programming   using rx java & akka actors - pdx-scala - june 2014Reactive programming   using rx java & akka actors - pdx-scala - june 2014
Reactive programming using rx java & akka actors - pdx-scala - june 2014
 
Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scala
 
Aws Developer Associate Overview
Aws Developer Associate OverviewAws Developer Associate Overview
Aws Developer Associate Overview
 
The Fn Project by Jesse Butler
 The Fn Project by Jesse Butler The Fn Project by Jesse Butler
The Fn Project by Jesse Butler
 
Serverless Boston @ Oracle Meetup
Serverless Boston @ Oracle MeetupServerless Boston @ Oracle Meetup
Serverless Boston @ Oracle Meetup
 
OSDC 2018 - Distributed monitoring
OSDC 2018 - Distributed monitoringOSDC 2018 - Distributed monitoring
OSDC 2018 - Distributed monitoring
 
Serverless
ServerlessServerless
Serverless
 
Python Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on FlinkPython Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on Flink
 
Go lambda-presentation
Go lambda-presentationGo lambda-presentation
Go lambda-presentation
 
Productionalizing Spark ML
Productionalizing Spark MLProductionalizing Spark ML
Productionalizing Spark ML
 
Flink Forward Berlin 2017: Dominik Bruhn - Deploying Flink Jobs as Docker Con...
Flink Forward Berlin 2017: Dominik Bruhn - Deploying Flink Jobs as Docker Con...Flink Forward Berlin 2017: Dominik Bruhn - Deploying Flink Jobs as Docker Con...
Flink Forward Berlin 2017: Dominik Bruhn - Deploying Flink Jobs as Docker Con...
 

Similaire à Lessons learned after a year of lambda - AWS Community Day SF 2017

AWS Lambda and Serverless framework: lessons learned while building a serverl...
AWS Lambda and Serverless framework: lessons learned while building a serverl...AWS Lambda and Serverless framework: lessons learned while building a serverl...
AWS Lambda and Serverless framework: lessons learned while building a serverl...
Luciano Mammino
 

Similaire à Lessons learned after a year of lambda - AWS Community Day SF 2017 (20)

AWS Lambda and Serverless framework: lessons learned while building a serverl...
AWS Lambda and Serverless framework: lessons learned while building a serverl...AWS Lambda and Serverless framework: lessons learned while building a serverl...
AWS Lambda and Serverless framework: lessons learned while building a serverl...
 
Writing and deploying serverless python applications
Writing and deploying serverless python applicationsWriting and deploying serverless python applications
Writing and deploying serverless python applications
 
State of serverless
State of serverlessState of serverless
State of serverless
 
PyConIT 2018 Writing and deploying serverless python applications
PyConIT 2018 Writing and deploying serverless python applicationsPyConIT 2018 Writing and deploying serverless python applications
PyConIT 2018 Writing and deploying serverless python applications
 
PyConIE 2017 Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applicationsPyConIE 2017 Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applications
 
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
 
Running R on AWS Lambda by Ana-Maria Niculescu
Running R on AWS Lambda by Ana-Maria NiculescuRunning R on AWS Lambda by Ana-Maria Niculescu
Running R on AWS Lambda by Ana-Maria Niculescu
 
AWS Lambda Features and Uses
AWS Lambda Features and UsesAWS Lambda Features and Uses
AWS Lambda Features and Uses
 
Amazon Web Services lection 5
Amazon Web Services lection 5  Amazon Web Services lection 5
Amazon Web Services lection 5
 
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...
 
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
 
AWS Lambda in C#
AWS Lambda in C#AWS Lambda in C#
AWS Lambda in C#
 
AWS Lambda and the Serverless Cloud
AWS Lambda and the Serverless CloudAWS Lambda and the Serverless Cloud
AWS Lambda and the Serverless Cloud
 
Serverless Computing with AWS
Serverless Computing with AWSServerless Computing with AWS
Serverless Computing with AWS
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
 
NEW LAUNCH! Developing Serverless C# Applications
NEW LAUNCH! Developing Serverless C# ApplicationsNEW LAUNCH! Developing Serverless C# Applications
NEW LAUNCH! Developing Serverless C# Applications
 
Skillenza Build with Serverless Challenge - Advanced Serverless Concepts
Skillenza Build with Serverless Challenge -  Advanced Serverless ConceptsSkillenza Build with Serverless Challenge -  Advanced Serverless Concepts
Skillenza Build with Serverless Challenge - Advanced Serverless Concepts
 
Laskar: High-Velocity GraphQL & Lambda-based Software Development Model
Laskar: High-Velocity GraphQL & Lambda-based Software Development ModelLaskar: High-Velocity GraphQL & Lambda-based Software Development Model
Laskar: High-Velocity GraphQL & Lambda-based Software Development Model
 
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
 
aws lambda & api gateway
aws lambda & api gatewayaws lambda & api gateway
aws lambda & api gateway
 

Dernier

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Lessons learned after a year of lambda - AWS Community Day SF 2017

  • 1. Lessons Learned After a Year of AWS Lambda
  • 2. ● AWS Lambda Overview ● Performance characteristics ● Lambda Integration ● Debugging AWS Lambda Agenda:
  • 4. AWS Lambda ● Created in 2014, launched at re:Invent ● Kicked off "serverless" (caveat) ● Function-as-a-Service ○Deploy code, not applications
  • 5. AWS Lambda Details ● Supports Node.JS, Python, C#, and Java ● Can call to server functionality ● Code deployment options ○ Uploading as a ZIP file (S3 or HTTP) ○ In-browser editor
  • 6. Calling AWS Lambda Functions ● Event-based triggers ○ On-Demand via HTTP ● Event Sources ○ AWS Services (S3, DynamoDB, others) ○ API Gateway ○ AWS SDK
  • 7. Creating a Lambda Function (in pictures)
  • 10. Demo
  • 11. Demo
  • 12. Demo
  • 13. Demo
  • 15. ● Scraped logs of 2.6 million function calls ● Pulled from CloudWatch on AWS ○ Function execution only ● Data on computing resources consumed only Examining Lambda Performance
  • 16. ● Graphs built on a sample of full data set (26,000 vs 2.6 million) ○ Sample is not random ● No relation to size of Lambda function ● Confounding factors may be present ● Significant outliers First, Caveats
  • 18. Memory vs Execution Time ● Does not incorporate HTTP Request ● Not a very strong correlation (r=-0.03) ● Three distinct groupings ● Tip: More memory allocated = faster processor
  • 20. Runtime Histogram ● Many functions run in < 100 ms ● Ignores code characteristics ● Ignores significant outliers on both ends ● Bimodal due to function characteristics
  • 21. Improving the Analysis ● Capture full cycle times if possible ● Correlate runtimes with size of function ● Algorithmic complexity analysis ● Randomize sample selection
  • 23. Four problems to solve: ● Problem 1 - Lambda Ownership ● Problem 2 - Deduplication ● Problem 3 - Triggering Lambda Functions ● Problem 4 - User Security Lambda Integration
  • 24. Problem 1 - Lambda Ownership Option 1: User ownership ● Users host Lambda functions in their AWS account ● Backand uses provided credentials to call Lambda ● Maximizes freedom at the expense of ease of use (also, security)
  • 25. Problem 1 - Lambda Ownership Option 2: Backand ownership ● Backand hosts Lambda functions in internal AWS account ● No need for user's AWS credentials ● Maximizes ease of use at expense of user freedom Solution selected: Backand owns code
  • 26. ● Lambda function names need to be unique ● Name length limits: ○ 140 characters for full ARN ○ 64 character subset for function name Solution Selected: prepend guaranteed unique data ● Backand app names have a uniqueness constraint ● Could also use GUID, but this reduces name length to 32 characters Problem 2 - Deduplication
  • 27. ● Most triggers AWS-based ○ S3, DynamoDB, Cloudwatch ○ None work for our use case ● API Gateway ○ Positive: Allows HTTP trigger ○ Negative: Complex configuration ○ Negative: Return value requirements Solution selected: AWS SDK Problem 3 - Triggering Lambda
  • 28. ● Default: configure IAM profile and users ○ Need to give every dev access to AWS ○ Does not integrate with org security ○ Needs to be managed in multiple places ● Clients want flexibility and security ○ Need Single Sign-On ○ Need custom third-party security tools ○ Need ease of management Solution selected: Lambda Launcher Problem 4 - User Security
  • 30. Debugging Lambda Functions ● Cloudwatch Integration ○ Provides call record, and console.log() ● Custom parameter input ○ Modal dialog presented before each run ● … and that's it
  • 31. Emulating Lambda Locally Three things to mimic: ● Trigger Event ● Machine Environment ● Invocation
  • 32. Emulating trigger event ● Each trigger sends different data ● Dump data from a sample call (console.log()) ● Keep in mind any transformations (API Gateway)
  • 33. Lambda Machine Environment ● Based on Amazon Machine Instance ● Dynamically provisioned (hot vs cold) ● Temporary storage (/tmp, 500 MB) ○ NOT guaranteed to persist ● Cannot accurately model machine
  • 34. Invoking Lambda ● External Function Call (entry point) ● Custom parameters in "event" object ● Execution context details in "context" ● Callbacks (if supported) in "callback"
  • 35. Debugging Lambda Locally ● Execution environment hard to emulate ● Need to mimic input format from action ● Need to mimic output format ● Need a test harness
  • 36. Creating a Test Harness (Node.js) ● Function Prototype ● Including Handler ● Mimicking Lambda Invocation ○ Parameters in event object ○ Handlers in the context object
  • 37. Creating a Test Harness ● Calling a Lambda function
  • 38. Test Harness Notes ● Callback mechanism ○ Need to adapt for each language ● Using callbacks in context parameter ○ Not supported, overloads context object ● Not a perfect substitute ○ Calls the function, but not from the same environment
  • 39. What do we get? ● Per-line output via console.log ● Immediate feedback from command ● Breakpoints and other local debugging tools ● Unit and Integration tests ● CI/CD compatible (with CLI)
  • 40. Deploying Your Code ● Zip-file from S3, or manual upload ○ Gotcha: zip only the source code, not the parent folder! ● Test upload ● Publish new API ● Complex, non-intuitive
  • 41. Using Backand's CLI Tool ● Backand On-Demand Node.JS Lambda Functions ● Backand CLI abstracts away deployment ● npm install -g backand ● Requires registering with Backand
  • 42. Lambda through a CLI ● Initialize a function ○ backand function init ● Copy your Node.JS code into created directory and iterate ● Deploy ○ backand function deploy
  • 43. Calling Your Lambda ● Authentication ○ can be anonymous ○ api.backand.com/1/token ● cURL curl -H "<auth header>" "https://api.backand.com/1/function/general/<name>" ● JavaScript (with Backand SDK) backand.function.get(...)
  • 44. What is Backand? ● Serverless app platform ● Manages your app's database ● Manages your app's security and authentication ● Provides custom server-side code execution ● Provides hosting options ● Provides logging, analytics, and more
  • 45. Backand Features ● Automated REST API ● Bring your own Database ● Custom JavaScript Actions ● Server-Side Code Execution ● Batch and Bulk Processing ● Scheduled Tasks ● Automated messages ● Real-time Communications ● User and Role-based Security ● Social Media Authentication ● GUI Schema Editor ● Custom Queries ● REST API Playground ● Sample Code Generation ● Hosting ● Detailed Analytics ● Logging ● Multi-Platform SDK ● Single Sign On Support
  • 46. ● Live online demo every other Wednesday ● Webinar - Invoking Lambda through Alexa Thursday, June 22nd, 11 AM Pacific Learn more at https://www.backand.com Want to know more?