SlideShare a Scribd company logo
C H R I S M I T C H E L L
P R O G R A M M E R A N A L Y S T
E & J G A L L O W I N E R Y
@ M O T O B R E A T H
G I T H U B . C O M / M O T O B R E A T H
B L O G . C H R I S M I T C H E L L O N L I N E . C O M
C H R I S @ C H R I S M I T C H E L L O N L I N E
Lambda Lambda Lambda!
Lets Go Over
 What is Lambda & the Lambda dashboard?
 Versioning with Lambda qualifiers
 Lambda Layers
 Local Development
PRE-REQ’S
 AWS Account
 CLI == Dashboard
 Demo using dashboard, all commands available with CLI
 CLI demo at https://blog.chrismitchellonline.com
 Local development will require AWS CLI and SAM
installed
What Is Lambda
 Run code in the cloud
 Operating system – Amazon Linux
 AMI – amzn-ami-hvm-2017.03.1.20170812-x86_64-
gp2
 Linux kernel – 4.14.77-70.59.amzn1.x86_64
 Docker container the whole thing
 AWS SDK for JavaScript – 2.290.0
 SDK for Python (Boto 3) – 3-1.7.74 botocore-1.10.74
New Lambda Function
 Login via https://aws.amazon.com/console/
 Find Lambda Dashboard
 Create new function
 Use defaults, create new role for function
 Roles
 Create new role
 Existing roll
Lambda Dashboard
 Designer Section
 Integrate Lambda, Layers, Logs, architect your function
 Triggers (Event sources)
 Code
 Write code…
 Environment Variables
 Incorporate environment variables in
 Memory
 Tagging
 More..
Testing Functions
 Test events should match the event that your
function would run from
 Example: API gateway sends video game data
 Configure test events and test function
 Create test events to run your function in the dashboard
 Essentially a “run your code” trigger
Demo
 Enough talk, lets setup a function and see a
dashboard
 Setup a test event
 Run code!
Versioning
 Multiple versions of Lambda code
 Separate DEV/ACC/Prod environment
 Lambda Qualifiers
 Manage what aliases run what code
 Versioning locks in function settings, unable to
change code
 Must change things like memory and environment at
root function level
Creating All Those Things
 Create a new version of our Lambda function code,
will be version 1
 Create 3 aliases, dev,acc,prod, point each of those
aliases to version 1
 Use $LATEST for active development
 Deploy new version of the code, version 2
 Point aliases accordingly.
 Check Qualifiers menu to see where aliases point
Demo Again
 Setup versions for our function
Layers
 Pull custom code into your Lambda function
 Most useful with NPM libraries
 Custom NPM libraries to boot
 Salesforce NPM package
 Reusable across all Lambda functions
Setup Layer
 Setup code locally using NPM install
 Directory structure must match:
 -name_of_layer
-node_js
-npm_modules
-package.json
-index.js
 Zip up directory so your zip file contains node_js
Lambda Layers Dashboard
 Create new layer
 Name, description, license, runtime
 Upload zip
 Set Runtime
 Attach layer to function
 Use the code!
Demo Layers
 See it in action
Local Lambda
 Develop locally, upload code, run in cloud
 Good for large (or all!) functions
 Upload zip directly to Lambda
 Function code section, change dropdown from Edit code inline
 ~10mb upload limit
 Upload zip to S3, load from there
 Better for larger functions
 With Lambda layers we don’t have to include NPM!
 NPM install locally, exclude from zip
Local Lambda with SAM
 AWS Serverless Application Model
 Uses Docker container to simulate running Lambda locally
 Local debugging and testing
 VS Code integration for debugging
 Breakpoints, stepping through code
 Use test events to trigger function similar to Lambda
dashboard
Local Lambda Components
 Install Docker and AWS CLI/SAM
 Create template.yml to define your functions
 One template.yml for many functions
 Define resources and outputs, 1-1 mapping to generate
function calls
Lambda lambda-lambda
 Create debugging config in VS Code
 Add debug configuration -> dropdown -> add new
configuration
 Config type is nodeJS
 See repo for launch.json
 One configuration item per function, matches 1-1 with
template.yml entries
Lambda lambda-lambda
Local Lambda Components Continued
 Test event
 JSON file that matches test events from either dashboard or
other AWS triggers
 One test event per function
 Layers
 Layers available either locally (folder)
 ARN from AWS account
 Configure in template.yml
 Bring it together: SAM->template.yml -> VS Code
debug config -> test event
Running Lambda Locally
 From the command line use SAM to trigger your
function
 Can run with or without the debugging
 Use debugging flag --debug-port 5858 to connect to debugger
 Without debug flag will execute your function similar to
running in the dashboard
 sam local invoke LocalLambda -e test-
events/videogames.json --debug-port 5858
Debugging
 If running with --debug-flag 5858 connect VS Code
debugger
 Debug menu -> select debug configuration -> Play
 One to one map with template.yml
 Breakpoints will stop code
 Step in/over code
 Evaluate Watch, Call Stack, and Debug console
Debug All the Things Demo
 Run Lambda code locally with Debug
In Closing
 More Lambda features
 Applications
 Monitoring
 Code Deploy
 Create triggers to use Lambda functions in other
AWS services
Thanks!
 Drop me a line:
 chris@chrismitchellonline.com
 Twitter: @motobreath
 Github: https://www.github.com/motobreath
 Slides will be here!
 Blog: blog.chrismitchellonline.com

More Related Content

PDF
PPTX
2020.02.15 DelEx - CI/CD in AWS Cloud
PPTX
High Performance Serverless Functions in Scala
PPTX
Chatbots with Serverless
PDF
AWS Lambda from the trenches
PDF
Frail & Cast Iron tools - a Postman Case Study
PPTX
JakartaJS: Serverless in production
2020.02.15 DelEx - CI/CD in AWS Cloud
High Performance Serverless Functions in Scala
Chatbots with Serverless
AWS Lambda from the trenches
Frail & Cast Iron tools - a Postman Case Study
JakartaJS: Serverless in production

What's hot (14)

PDF
Manage any AWS resources with Terraform 0.12 - April 2020
PPT
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
PDF
AWS Primer and Quickstart
PPTX
C# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
PDF
Chris Omland - AWS Code Deploy - BSDC 2016
PPTX
End-to-end CI/CD deployments of containerized applications using AWS services
PDF
The future of paas is serverless
PDF
Serverless in production, an experience report (linuxing in london)
PDF
Serverless cat detector workshop - cloudyna 2017 (16.12.2017)
PPT
Conejo Architecture
PDF
Squeezing Machine Learning into Serverless for Image Recognition - AWS Meetup...
PPTX
Localize content Devops
PDF
Serverless testing @ serverlessdays Hamburg
PDF
20180321 使用aws 建立 notification system
Manage any AWS resources with Terraform 0.12 - April 2020
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
AWS Primer and Quickstart
C# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
Chris Omland - AWS Code Deploy - BSDC 2016
End-to-end CI/CD deployments of containerized applications using AWS services
The future of paas is serverless
Serverless in production, an experience report (linuxing in london)
Serverless cat detector workshop - cloudyna 2017 (16.12.2017)
Conejo Architecture
Squeezing Machine Learning into Serverless for Image Recognition - AWS Meetup...
Localize content Devops
Serverless testing @ serverlessdays Hamburg
20180321 使用aws 建立 notification system
Ad

Similar to Lambda lambda-lambda (16)

PDF
Girish Bhatia: 2024 CommunityDay AWS Lambda develop locally with SAM, Docker ...
PDF
Building a chatbot – step by step
PDF
AWS CodeDeploy
PPTX
Introduction to AWS lambda & Serverless Application1.pptx
PDF
Aws Lambda in Swift - NSLondon - 3rd December 2020
PDF
What’s new in serverless - re:Invent 2020
PPTX
Aws meetup building_lambda
PDF
Serverless in production, an experience report (JeffConf)
PDF
Writing Rust Command Line Applications
PDF
Serverless in production, an experience report (Going Serverless)
PPTX
Alexa101 course slides
PDF
Serverless in production, an experience report (CoDe-Conf)
PDF
10 Tips For Serverless Backends With NodeJS and AWS Lambda
PPTX
Containerless in the Cloud with AWS Lambda
PDF
Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
PDF
Into The Box | Alexa and ColdBox Api's
Girish Bhatia: 2024 CommunityDay AWS Lambda develop locally with SAM, Docker ...
Building a chatbot – step by step
AWS CodeDeploy
Introduction to AWS lambda & Serverless Application1.pptx
Aws Lambda in Swift - NSLondon - 3rd December 2020
What’s new in serverless - re:Invent 2020
Aws meetup building_lambda
Serverless in production, an experience report (JeffConf)
Writing Rust Command Line Applications
Serverless in production, an experience report (Going Serverless)
Alexa101 course slides
Serverless in production, an experience report (CoDe-Conf)
10 Tips For Serverless Backends With NodeJS and AWS Lambda
Containerless in the Cloud with AWS Lambda
Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
Into The Box | Alexa and ColdBox Api's
Ad

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Cloud computing and distributed systems.
PDF
Machine learning based COVID-19 study performance prediction
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
KodekX | Application Modernization Development
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Cloud computing and distributed systems.
Machine learning based COVID-19 study performance prediction
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Mobile App Security Testing_ A Comprehensive Guide.pdf
Big Data Technologies - Introduction.pptx
Programs and apps: productivity, graphics, security and other tools
Building Integrated photovoltaic BIPV_UPV.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Understanding_Digital_Forensics_Presentation.pptx
Network Security Unit 5.pdf for BCA BBA.
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
KodekX | Application Modernization Development
MYSQL Presentation for SQL database connectivity
Diabetes mellitus diagnosis method based random forest with bat algorithm

Lambda lambda-lambda

  • 1. C H R I S M I T C H E L L P R O G R A M M E R A N A L Y S T E & J G A L L O W I N E R Y @ M O T O B R E A T H G I T H U B . C O M / M O T O B R E A T H B L O G . C H R I S M I T C H E L L O N L I N E . C O M C H R I S @ C H R I S M I T C H E L L O N L I N E Lambda Lambda Lambda!
  • 2. Lets Go Over  What is Lambda & the Lambda dashboard?  Versioning with Lambda qualifiers  Lambda Layers  Local Development
  • 3. PRE-REQ’S  AWS Account  CLI == Dashboard  Demo using dashboard, all commands available with CLI  CLI demo at https://blog.chrismitchellonline.com  Local development will require AWS CLI and SAM installed
  • 4. What Is Lambda  Run code in the cloud  Operating system – Amazon Linux  AMI – amzn-ami-hvm-2017.03.1.20170812-x86_64- gp2  Linux kernel – 4.14.77-70.59.amzn1.x86_64  Docker container the whole thing  AWS SDK for JavaScript – 2.290.0  SDK for Python (Boto 3) – 3-1.7.74 botocore-1.10.74
  • 5. New Lambda Function  Login via https://aws.amazon.com/console/  Find Lambda Dashboard  Create new function  Use defaults, create new role for function  Roles  Create new role  Existing roll
  • 6. Lambda Dashboard  Designer Section  Integrate Lambda, Layers, Logs, architect your function  Triggers (Event sources)  Code  Write code…  Environment Variables  Incorporate environment variables in  Memory  Tagging  More..
  • 7. Testing Functions  Test events should match the event that your function would run from  Example: API gateway sends video game data  Configure test events and test function  Create test events to run your function in the dashboard  Essentially a “run your code” trigger
  • 8. Demo  Enough talk, lets setup a function and see a dashboard  Setup a test event  Run code!
  • 9. Versioning  Multiple versions of Lambda code  Separate DEV/ACC/Prod environment  Lambda Qualifiers  Manage what aliases run what code  Versioning locks in function settings, unable to change code  Must change things like memory and environment at root function level
  • 10. Creating All Those Things  Create a new version of our Lambda function code, will be version 1  Create 3 aliases, dev,acc,prod, point each of those aliases to version 1  Use $LATEST for active development  Deploy new version of the code, version 2  Point aliases accordingly.  Check Qualifiers menu to see where aliases point
  • 11. Demo Again  Setup versions for our function
  • 12. Layers  Pull custom code into your Lambda function  Most useful with NPM libraries  Custom NPM libraries to boot  Salesforce NPM package  Reusable across all Lambda functions
  • 13. Setup Layer  Setup code locally using NPM install  Directory structure must match:  -name_of_layer -node_js -npm_modules -package.json -index.js  Zip up directory so your zip file contains node_js
  • 14. Lambda Layers Dashboard  Create new layer  Name, description, license, runtime  Upload zip  Set Runtime  Attach layer to function  Use the code!
  • 15. Demo Layers  See it in action
  • 16. Local Lambda  Develop locally, upload code, run in cloud  Good for large (or all!) functions  Upload zip directly to Lambda  Function code section, change dropdown from Edit code inline  ~10mb upload limit  Upload zip to S3, load from there  Better for larger functions  With Lambda layers we don’t have to include NPM!  NPM install locally, exclude from zip
  • 17. Local Lambda with SAM  AWS Serverless Application Model  Uses Docker container to simulate running Lambda locally  Local debugging and testing  VS Code integration for debugging  Breakpoints, stepping through code  Use test events to trigger function similar to Lambda dashboard
  • 18. Local Lambda Components  Install Docker and AWS CLI/SAM  Create template.yml to define your functions  One template.yml for many functions  Define resources and outputs, 1-1 mapping to generate function calls
  • 20.  Create debugging config in VS Code  Add debug configuration -> dropdown -> add new configuration  Config type is nodeJS  See repo for launch.json  One configuration item per function, matches 1-1 with template.yml entries
  • 22. Local Lambda Components Continued  Test event  JSON file that matches test events from either dashboard or other AWS triggers  One test event per function  Layers  Layers available either locally (folder)  ARN from AWS account  Configure in template.yml  Bring it together: SAM->template.yml -> VS Code debug config -> test event
  • 23. Running Lambda Locally  From the command line use SAM to trigger your function  Can run with or without the debugging  Use debugging flag --debug-port 5858 to connect to debugger  Without debug flag will execute your function similar to running in the dashboard  sam local invoke LocalLambda -e test- events/videogames.json --debug-port 5858
  • 24. Debugging  If running with --debug-flag 5858 connect VS Code debugger  Debug menu -> select debug configuration -> Play  One to one map with template.yml  Breakpoints will stop code  Step in/over code  Evaluate Watch, Call Stack, and Debug console
  • 25. Debug All the Things Demo  Run Lambda code locally with Debug
  • 26. In Closing  More Lambda features  Applications  Monitoring  Code Deploy  Create triggers to use Lambda functions in other AWS services
  • 27. Thanks!  Drop me a line:  chris@chrismitchellonline.com  Twitter: @motobreath  Github: https://www.github.com/motobreath  Slides will be here!  Blog: blog.chrismitchellonline.com