際際滷

際際滷Share a Scribd company logo
AWS Lambda and Serverless
Look mam, nee servers!
Mike Shutlar, Expert Flamebaiter
for DevOps North East 2017-01-19
Lambda
What is AWS Lambda?
A compute service
No infrastructure resources...
 to provision
 to set up
 to manage
 to pay for 24/7 whether in use or not
Scales automatically
Only pay for what is used
What is AWS Lambda?
BYOC - Bring Your Own Code
Available runtimes:
 Node.js v4.3
 Python 2.7
 Java 8
 C# (.NET Core 1.0.1)
Behind the scenes: executes within Amazon Linux containers
Lambda Functions
Confusingly named
Stateless
 Store state in DynamoDB, S3, etc...
 Can cache in /tmp - unreliably
Will run if...
 Configured to act on events (e.g. S3 bucket writes)
 Directly invoked via the API
 Scheduled to
 Configured as an endpoint for API Gateway
 This allows its use in serverless
Lambda Functions
Can call primitive Linux utilities
Can create threads/processes
 These can be frozen
Package function in a zip
 Can include libraries
 Can include native libraries
 Can include native binaries
 Max 50 MB compressed/250 MB uncompressed
Lambda Function Configuration
Allocate memory
 128 MB  1536 MB
 Affects CPU resources allocated
Set timeout (up to 300 seconds)
Can VPC-enable with an ENI (so can access private resources)
Can set up dead letter queue (Lambda retries failures twice)
Environment vars, versioning, aliases
Lambda Function Execution
From cold:
1. New container is created
2. Lambda function code copied to it
3. Lambda function is initialised
4. Lambda function is executed
5. Container is frozen when function terminates/times out
 This also can be referred to as warmed/hot - yay, confusion!
Steps #1 -> #3 can take time, ~1 to 9 seconds
Python least delay from cold, Java longest
Lambda Function Execution
If warm container is used:
1. Container is thawed
2. Lambda function is executed
3. Container is frozen when function terminates/timeout
Step #1 takes < 100ms
Java has least delay when warm
Note: no guarantees that warm container will be used
Lambda in use
Lambda in use in production
Web form serverless backend
Virus scanning & resizing uploaded files
Simple automatic image thumbnailer
Connecting AWS alarms to internal monitoring
Dynamically calculating subnet CIDRs for CloudFormation stacks
Processing config changes & alerting on unsafe actions
...and more
Benefits of Lambda
Quick to create and deploy
Connective tissue for AWS resources
Reduce server maintenance
Potentially unlimited instant scalability
Smaller attack surface
Cheap! (Generous permanent free tier)
 1m requests/month free, $0.0000002 per request after
 400,000 GB-seconds compute/month free, $0.00001667 per GB-s after
Serverless
Voting Application
An example serverless application
https://github.com/infectedsoundsystem/lambda-refarch-
webapp
Voting Application Components
AWS CloudFormation
To provision the AWS resources
Uses JSON/YAML templates
Allows to define infrastructure as code
Transforms AWS Serverless Application Model definitions
Amazon S3
Object storage
One bucket stores the Lambda code to deploy via CloudFormation
Another bucket stores the website HTML and assets
This bucket is configured for static website hosting
Amazon DynamoDB
NoSQL database PaaS with built-in HA/durability
Two tables, one for votes and one for vote aggregation
DynamoDB Streams enable reading and processing updates to the vote table
Amazon Cognito
Service that provides identity management and data sync
Primarily used for mobile applications
Used here to provide an identity pool to allow browser-side code to run as an
unauthenticated user that has IAM permissions to scan the DynamoDB vote
aggregation table directly
Amazon API Gateway
Allows to create publicly available REST APIs
Done by creating resources, and methods for these
These manage the requests and responses when invoking our Lambda function
One resource used here for voting via the website
Gives a public HTTPS endpoint for a Lambda function to be triggered via an
Ajax request containing the users vote
AWS Lambda
Four Lambda functions used here:
One to register votes received via the website
One that listens to a DynamoDB stream from the votes table, and aggregates the votes when
there are changes
One used as CloudFormation custom resource to create/configure our Cognito Identity Pool
One used as CFN custom resource to automatically configure static files with resource values
AWS Serverless Application Model
Used to define serverless applications on AWS
Based on CloudFormation
Defined in CFN templates and deployed as CFN stack
SAM objects simplify definition of common serverless resources
CloudFormation transformation expands these to normal CFN resource
definitions
https://github.com/awslabs/serverless-application-model
Putting it all together...
Demo
Demo
Please go to http://done.1f55.uk
Flame war!
Benefits of Serverless
Over traditional server architectures
Modularity and separation
Isolated deployments and failures
No ongoing server maintenance
Potentially unlimited instant scalability
Smaller attack surface
Cheap!
> 90%
Running cost reduction when compared to a traditional HA server architecture.
(Thats before factoring in additional cost savings from reduced man-hours
incurred performing maintenance etc...)
Downsides & Hurdles
Compared to traditional server architectures
Not every web application will be suited for it
Occasional latency spike due to Lambda container creation (additional ~2-3 secs
average for Node.js runtime)
Requires initial learning curve to enable design and development of appropriate
application architectures
One last benefit...
All management of
the application can
be done in code.
Questions?
@mikeshutlar
linkedin.com/in/MikeShutlar
git.io/vMMm8
Thanks for voting!

More Related Content

Viewers also liked (16)

A quick introduction to AWS Lambda
A quick introduction to AWS LambdaA quick introduction to AWS Lambda
A quick introduction to AWS Lambda
ogeisser
Security Boundaries and Functions of Services for Serverless Architectures on...
Security Boundaries and Functions of Services for Serverless Architectures on...Security Boundaries and Functions of Services for Serverless Architectures on...
Security Boundaries and Functions of Services for Serverless Architectures on...
AWS Germany
Connecting the Unconnected: IoT Made Simple
Connecting the Unconnected: IoT Made SimpleConnecting the Unconnected: IoT Made Simple
Connecting the Unconnected: IoT Made Simple
Danilo Poccia
AWS Lambda - A quick introduction #advancedaws
AWS Lambda - A quick introduction #advancedawsAWS Lambda - A quick introduction #advancedaws
AWS Lambda - A quick introduction #advancedaws
Chris Richardson
Big Data: Architectures and Approaches
Big Data: Architectures and ApproachesBig Data: Architectures and Approaches
Big Data: Architectures and Approaches
Thoughtworks
Big Data Analytics: Reference Architectures and Case Studies by Serhiy Haziye...
Big Data Analytics: Reference Architectures and Case Studies by Serhiy Haziye...Big Data Analytics: Reference Architectures and Case Studies by Serhiy Haziye...
Big Data Analytics: Reference Architectures and Case Studies by Serhiy Haziye...
SoftServe
Goto Berlin - Migrating to Microservices (Fast Delivery)
Goto Berlin - Migrating to Microservices (Fast Delivery)Goto Berlin - Migrating to Microservices (Fast Delivery)
Goto Berlin - Migrating to Microservices (Fast Delivery)
Adrian Cockcroft
Microservices on AWS using AWS Lambda and Docker Containers
Microservices on AWS using AWS Lambda and Docker ContainersMicroservices on AWS using AWS Lambda and Docker Containers
Microservices on AWS using AWS Lambda and Docker Containers
Danilo Poccia
Big Data & Analytics Architecture
Big Data & Analytics ArchitectureBig Data & Analytics Architecture
Big Data & Analytics Architecture
Arvind Sathi
Big Data Architecture
Big Data ArchitectureBig Data Architecture
Big Data Architecture
Guido Schmutz
Microservice Architecture on AWS using AWS Lambda and Docker Containers
Microservice Architecture on AWS using AWS Lambda and Docker ContainersMicroservice Architecture on AWS using AWS Lambda and Docker Containers
Microservice Architecture on AWS using AWS Lambda and Docker Containers
Danilo Poccia
Lambda architecture for real time big data
Lambda architecture for real time big dataLambda architecture for real time big data
Lambda architecture for real time big data
Trieu Nguyen
Comprehensive Terraform Training
Comprehensive Terraform TrainingComprehensive Terraform Training
Comprehensive Terraform Training
Yevgeniy Brikman
Big Data and Fast Data - Lambda Architecture in Action
Big Data and Fast Data - Lambda Architecture in ActionBig Data and Fast Data - Lambda Architecture in Action
Big Data and Fast Data - Lambda Architecture in Action
Guido Schmutz
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECS
Yevgeniy Brikman
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Yevgeniy Brikman
A quick introduction to AWS Lambda
A quick introduction to AWS LambdaA quick introduction to AWS Lambda
A quick introduction to AWS Lambda
ogeisser
Security Boundaries and Functions of Services for Serverless Architectures on...
Security Boundaries and Functions of Services for Serverless Architectures on...Security Boundaries and Functions of Services for Serverless Architectures on...
Security Boundaries and Functions of Services for Serverless Architectures on...
AWS Germany
Connecting the Unconnected: IoT Made Simple
Connecting the Unconnected: IoT Made SimpleConnecting the Unconnected: IoT Made Simple
Connecting the Unconnected: IoT Made Simple
Danilo Poccia
AWS Lambda - A quick introduction #advancedaws
AWS Lambda - A quick introduction #advancedawsAWS Lambda - A quick introduction #advancedaws
AWS Lambda - A quick introduction #advancedaws
Chris Richardson
Big Data: Architectures and Approaches
Big Data: Architectures and ApproachesBig Data: Architectures and Approaches
Big Data: Architectures and Approaches
Thoughtworks
Big Data Analytics: Reference Architectures and Case Studies by Serhiy Haziye...
Big Data Analytics: Reference Architectures and Case Studies by Serhiy Haziye...Big Data Analytics: Reference Architectures and Case Studies by Serhiy Haziye...
Big Data Analytics: Reference Architectures and Case Studies by Serhiy Haziye...
SoftServe
Goto Berlin - Migrating to Microservices (Fast Delivery)
Goto Berlin - Migrating to Microservices (Fast Delivery)Goto Berlin - Migrating to Microservices (Fast Delivery)
Goto Berlin - Migrating to Microservices (Fast Delivery)
Adrian Cockcroft
Microservices on AWS using AWS Lambda and Docker Containers
Microservices on AWS using AWS Lambda and Docker ContainersMicroservices on AWS using AWS Lambda and Docker Containers
Microservices on AWS using AWS Lambda and Docker Containers
Danilo Poccia
Big Data & Analytics Architecture
Big Data & Analytics ArchitectureBig Data & Analytics Architecture
Big Data & Analytics Architecture
Arvind Sathi
Big Data Architecture
Big Data ArchitectureBig Data Architecture
Big Data Architecture
Guido Schmutz
Microservice Architecture on AWS using AWS Lambda and Docker Containers
Microservice Architecture on AWS using AWS Lambda and Docker ContainersMicroservice Architecture on AWS using AWS Lambda and Docker Containers
Microservice Architecture on AWS using AWS Lambda and Docker Containers
Danilo Poccia
Lambda architecture for real time big data
Lambda architecture for real time big dataLambda architecture for real time big data
Lambda architecture for real time big data
Trieu Nguyen
Comprehensive Terraform Training
Comprehensive Terraform TrainingComprehensive Terraform Training
Comprehensive Terraform Training
Yevgeniy Brikman
Big Data and Fast Data - Lambda Architecture in Action
Big Data and Fast Data - Lambda Architecture in ActionBig Data and Fast Data - Lambda Architecture in Action
Big Data and Fast Data - Lambda Architecture in Action
Guido Schmutz
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECS
Yevgeniy Brikman
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Yevgeniy Brikman

Similar to Lambda and serverless - DevOps North East Jan 2017 (13)

Getting Started with AWS Lambda & Serverless Cloud
Getting Started with AWS Lambda & Serverless CloudGetting Started with AWS Lambda & Serverless Cloud
Getting Started with AWS Lambda & Serverless Cloud
Ian Massingham
AWS Lambda Functions A Comprehensive Guide
AWS Lambda Functions A Comprehensive GuideAWS Lambda Functions A Comprehensive Guide
AWS Lambda Functions A Comprehensive Guide
Inexture Solutions
Introduction to AWS Lambda with Python
Introduction to AWS Lambda with PythonIntroduction to AWS Lambda with Python
Introduction to AWS Lambda with Python
adaplo
AWS Lambda Features and Uses
AWS Lambda Features and UsesAWS Lambda Features and Uses
AWS Lambda Features and Uses
GlobalLogic Ukraine
Ctvrtkon #64 - AWS Serverless - Michal Hat叩k
Ctvrtkon #64 - AWS Serverless - Michal Hat叩kCtvrtkon #64 - AWS Serverless - Michal Hat叩k
Ctvrtkon #64 - AWS Serverless - Michal Hat叩k
Ctvrtkoncz
Webinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
Webinar: Serverless Architectures with AWS Lambda and MongoDB AtlasWebinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
Webinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
MongoDB
Serverless design considerations for Cloud Native workloads
Serverless design considerations for Cloud Native workloadsServerless design considerations for Cloud Native workloads
Serverless design considerations for Cloud Native workloads
Tensult
Deploying Serverless Cloud Optical Character Recognition in Support of NASA A...
Deploying Serverless Cloud Optical Character Recognition in Support of NASA A...Deploying Serverless Cloud Optical Character Recognition in Support of NASA A...
Deploying Serverless Cloud Optical Character Recognition in Support of NASA A...
Chris Shenton
Containerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS LambdaContainerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS Lambda
Ryan Cuprak
Lambda and DynamoDB best practices
Lambda and DynamoDB best practicesLambda and DynamoDB best practices
Lambda and DynamoDB best practices
Yan Cui
Serverless Optical Character Recognition in support of Astronaut Safety AWS M...
Serverless Optical Character Recognition in support of Astronaut Safety AWS M...Serverless Optical Character Recognition in support of Astronaut Safety AWS M...
Serverless Optical Character Recognition in support of Astronaut Safety AWS M...
Chris Shenton
Serverless OCR for NASA EVA: AWS Meetup DC 2017-12-12
Serverless OCR for NASA EVA: AWS Meetup DC 2017-12-12Serverless OCR for NASA EVA: AWS Meetup DC 2017-12-12
Serverless OCR for NASA EVA: AWS Meetup DC 2017-12-12
Chris Shenton
Introduction to AWS lambda & Serverless Application1.pptx
Introduction to AWS lambda & Serverless Application1.pptxIntroduction to AWS lambda & Serverless Application1.pptx
Introduction to AWS lambda & Serverless Application1.pptx
Mohammed Shefeeq
Getting Started with AWS Lambda & Serverless Cloud
Getting Started with AWS Lambda & Serverless CloudGetting Started with AWS Lambda & Serverless Cloud
Getting Started with AWS Lambda & Serverless Cloud
Ian Massingham
AWS Lambda Functions A Comprehensive Guide
AWS Lambda Functions A Comprehensive GuideAWS Lambda Functions A Comprehensive Guide
AWS Lambda Functions A Comprehensive Guide
Inexture Solutions
Introduction to AWS Lambda with Python
Introduction to AWS Lambda with PythonIntroduction to AWS Lambda with Python
Introduction to AWS Lambda with Python
adaplo
Ctvrtkon #64 - AWS Serverless - Michal Hat叩k
Ctvrtkon #64 - AWS Serverless - Michal Hat叩kCtvrtkon #64 - AWS Serverless - Michal Hat叩k
Ctvrtkon #64 - AWS Serverless - Michal Hat叩k
Ctvrtkoncz
Webinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
Webinar: Serverless Architectures with AWS Lambda and MongoDB AtlasWebinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
Webinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
MongoDB
Serverless design considerations for Cloud Native workloads
Serverless design considerations for Cloud Native workloadsServerless design considerations for Cloud Native workloads
Serverless design considerations for Cloud Native workloads
Tensult
Deploying Serverless Cloud Optical Character Recognition in Support of NASA A...
Deploying Serverless Cloud Optical Character Recognition in Support of NASA A...Deploying Serverless Cloud Optical Character Recognition in Support of NASA A...
Deploying Serverless Cloud Optical Character Recognition in Support of NASA A...
Chris Shenton
Containerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS LambdaContainerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS Lambda
Ryan Cuprak
Lambda and DynamoDB best practices
Lambda and DynamoDB best practicesLambda and DynamoDB best practices
Lambda and DynamoDB best practices
Yan Cui
Serverless Optical Character Recognition in support of Astronaut Safety AWS M...
Serverless Optical Character Recognition in support of Astronaut Safety AWS M...Serverless Optical Character Recognition in support of Astronaut Safety AWS M...
Serverless Optical Character Recognition in support of Astronaut Safety AWS M...
Chris Shenton
Serverless OCR for NASA EVA: AWS Meetup DC 2017-12-12
Serverless OCR for NASA EVA: AWS Meetup DC 2017-12-12Serverless OCR for NASA EVA: AWS Meetup DC 2017-12-12
Serverless OCR for NASA EVA: AWS Meetup DC 2017-12-12
Chris Shenton
Introduction to AWS lambda & Serverless Application1.pptx
Introduction to AWS lambda & Serverless Application1.pptxIntroduction to AWS lambda & Serverless Application1.pptx
Introduction to AWS lambda & Serverless Application1.pptx
Mohammed Shefeeq

Recently uploaded (20)

Human Centered Design By Gnanasambandham
Human Centered Design By GnanasambandhamHuman Centered Design By Gnanasambandham
Human Centered Design By Gnanasambandham
Gnanasambandham Anbazhagan CSP, CSM, CSPO
Solana Developer Hiring for Enterprises Key Considerations.pdf
Solana Developer Hiring for Enterprises Key Considerations.pdfSolana Developer Hiring for Enterprises Key Considerations.pdf
Solana Developer Hiring for Enterprises Key Considerations.pdf
Lisa ward
Transactional Outbox & Inbox Patterns.pptx
Transactional Outbox & Inbox Patterns.pptxTransactional Outbox & Inbox Patterns.pptx
Transactional Outbox & Inbox Patterns.pptx
Maysam Mousa
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI
Getting the Best of TrueDEM April News & Updates
Getting the Best of TrueDEM  April News & UpdatesGetting the Best of TrueDEM  April News & Updates
Getting the Best of TrueDEM April News & Updates
panagenda
Benefits of Moving Ellucian Banner to Oracle Cloud
Benefits of Moving Ellucian Banner to Oracle CloudBenefits of Moving Ellucian Banner to Oracle Cloud
Benefits of Moving Ellucian Banner to Oracle Cloud
AstuteBusiness
Mastering Azure Durable Functions - Building Resilient and Scalable Workflows
Mastering Azure Durable Functions - Building Resilient and Scalable WorkflowsMastering Azure Durable Functions - Building Resilient and Scalable Workflows
Mastering Azure Durable Functions - Building Resilient and Scalable Workflows
Callon Campbell
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly MeetupLeadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
GDG Kathmandu
AI Driven Posture Analysis Fall Detection System for the Elderly.pdf
AI Driven Posture Analysis Fall Detection System for the Elderly.pdfAI Driven Posture Analysis Fall Detection System for the Elderly.pdf
AI Driven Posture Analysis Fall Detection System for the Elderly.pdf
Patrick Ogbuitepu
ScotSecure Cyber Security Summit 2025 Edinburgh
ScotSecure Cyber Security Summit 2025 EdinburghScotSecure Cyber Security Summit 2025 Edinburgh
ScotSecure Cyber Security Summit 2025 Edinburgh
Ray Bugg
All-Data, Any-AI Integration: FME & Amazon Bedrock in the Real-World
All-Data, Any-AI Integration: FME & Amazon Bedrock in the Real-WorldAll-Data, Any-AI Integration: FME & Amazon Bedrock in the Real-World
All-Data, Any-AI Integration: FME & Amazon Bedrock in the Real-World
Safe Software
Threat Modeling a Batch Job System - AWS Security Community Day
Threat Modeling a Batch Job System - AWS Security Community DayThreat Modeling a Batch Job System - AWS Security Community Day
Threat Modeling a Batch Job System - AWS Security Community Day
Teri Radichel
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
DianaGray10
Smarter RAG Pipelines: Scaling Search with Milvus and Feast
Smarter RAG Pipelines: Scaling Search with Milvus and FeastSmarter RAG Pipelines: Scaling Search with Milvus and Feast
Smarter RAG Pipelines: Scaling Search with Milvus and Feast
Zilliz
Migrating to the Isolated worker process in Azure Functions .pptx
Migrating to the Isolated worker process in Azure Functions .pptxMigrating to the Isolated worker process in Azure Functions .pptx
Migrating to the Isolated worker process in Azure Functions .pptx
Callon Campbell
Artificial Neural Networks, basics, its variations and examples
Artificial Neural Networks, basics, its variations and examplesArtificial Neural Networks, basics, its variations and examples
Artificial Neural Networks, basics, its variations and examples
anandsimple
Build Your Uber Clone App with Advanced Features
Build Your Uber Clone App with Advanced FeaturesBuild Your Uber Clone App with Advanced Features
Build Your Uber Clone App with Advanced Features
V3cube
UiPath NY AI Series: Session 4: UiPath AutoPilot for Developers using Studio Web
UiPath NY AI Series: Session 4: UiPath AutoPilot for Developers using Studio WebUiPath NY AI Series: Session 4: UiPath AutoPilot for Developers using Studio Web
UiPath NY AI Series: Session 4: UiPath AutoPilot for Developers using Studio Web
DianaGray10
Research Data Management (RDM): the management of dat in the research process
Research Data Management (RDM): the management of dat in the research processResearch Data Management (RDM): the management of dat in the research process
Research Data Management (RDM): the management of dat in the research process
HeilaPienaar
Automated Engineering of Domain-Specific Metamorphic Testing Environments
Automated Engineering of Domain-Specific Metamorphic Testing EnvironmentsAutomated Engineering of Domain-Specific Metamorphic Testing Environments
Automated Engineering of Domain-Specific Metamorphic Testing Environments
Pablo G坦mez Abajo
Solana Developer Hiring for Enterprises Key Considerations.pdf
Solana Developer Hiring for Enterprises Key Considerations.pdfSolana Developer Hiring for Enterprises Key Considerations.pdf
Solana Developer Hiring for Enterprises Key Considerations.pdf
Lisa ward
Transactional Outbox & Inbox Patterns.pptx
Transactional Outbox & Inbox Patterns.pptxTransactional Outbox & Inbox Patterns.pptx
Transactional Outbox & Inbox Patterns.pptx
Maysam Mousa
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI
Getting the Best of TrueDEM April News & Updates
Getting the Best of TrueDEM  April News & UpdatesGetting the Best of TrueDEM  April News & Updates
Getting the Best of TrueDEM April News & Updates
panagenda
Benefits of Moving Ellucian Banner to Oracle Cloud
Benefits of Moving Ellucian Banner to Oracle CloudBenefits of Moving Ellucian Banner to Oracle Cloud
Benefits of Moving Ellucian Banner to Oracle Cloud
AstuteBusiness
Mastering Azure Durable Functions - Building Resilient and Scalable Workflows
Mastering Azure Durable Functions - Building Resilient and Scalable WorkflowsMastering Azure Durable Functions - Building Resilient and Scalable Workflows
Mastering Azure Durable Functions - Building Resilient and Scalable Workflows
Callon Campbell
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly MeetupLeadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
GDG Kathmandu
AI Driven Posture Analysis Fall Detection System for the Elderly.pdf
AI Driven Posture Analysis Fall Detection System for the Elderly.pdfAI Driven Posture Analysis Fall Detection System for the Elderly.pdf
AI Driven Posture Analysis Fall Detection System for the Elderly.pdf
Patrick Ogbuitepu
ScotSecure Cyber Security Summit 2025 Edinburgh
ScotSecure Cyber Security Summit 2025 EdinburghScotSecure Cyber Security Summit 2025 Edinburgh
ScotSecure Cyber Security Summit 2025 Edinburgh
Ray Bugg
All-Data, Any-AI Integration: FME & Amazon Bedrock in the Real-World
All-Data, Any-AI Integration: FME & Amazon Bedrock in the Real-WorldAll-Data, Any-AI Integration: FME & Amazon Bedrock in the Real-World
All-Data, Any-AI Integration: FME & Amazon Bedrock in the Real-World
Safe Software
Threat Modeling a Batch Job System - AWS Security Community Day
Threat Modeling a Batch Job System - AWS Security Community DayThreat Modeling a Batch Job System - AWS Security Community Day
Threat Modeling a Batch Job System - AWS Security Community Day
Teri Radichel
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
DianaGray10
Smarter RAG Pipelines: Scaling Search with Milvus and Feast
Smarter RAG Pipelines: Scaling Search with Milvus and FeastSmarter RAG Pipelines: Scaling Search with Milvus and Feast
Smarter RAG Pipelines: Scaling Search with Milvus and Feast
Zilliz
Migrating to the Isolated worker process in Azure Functions .pptx
Migrating to the Isolated worker process in Azure Functions .pptxMigrating to the Isolated worker process in Azure Functions .pptx
Migrating to the Isolated worker process in Azure Functions .pptx
Callon Campbell
Artificial Neural Networks, basics, its variations and examples
Artificial Neural Networks, basics, its variations and examplesArtificial Neural Networks, basics, its variations and examples
Artificial Neural Networks, basics, its variations and examples
anandsimple
Build Your Uber Clone App with Advanced Features
Build Your Uber Clone App with Advanced FeaturesBuild Your Uber Clone App with Advanced Features
Build Your Uber Clone App with Advanced Features
V3cube
UiPath NY AI Series: Session 4: UiPath AutoPilot for Developers using Studio Web
UiPath NY AI Series: Session 4: UiPath AutoPilot for Developers using Studio WebUiPath NY AI Series: Session 4: UiPath AutoPilot for Developers using Studio Web
UiPath NY AI Series: Session 4: UiPath AutoPilot for Developers using Studio Web
DianaGray10
Research Data Management (RDM): the management of dat in the research process
Research Data Management (RDM): the management of dat in the research processResearch Data Management (RDM): the management of dat in the research process
Research Data Management (RDM): the management of dat in the research process
HeilaPienaar
Automated Engineering of Domain-Specific Metamorphic Testing Environments
Automated Engineering of Domain-Specific Metamorphic Testing EnvironmentsAutomated Engineering of Domain-Specific Metamorphic Testing Environments
Automated Engineering of Domain-Specific Metamorphic Testing Environments
Pablo G坦mez Abajo

Lambda and serverless - DevOps North East Jan 2017

  • 1. AWS Lambda and Serverless Look mam, nee servers! Mike Shutlar, Expert Flamebaiter for DevOps North East 2017-01-19
  • 3. What is AWS Lambda? A compute service No infrastructure resources... to provision to set up to manage to pay for 24/7 whether in use or not Scales automatically Only pay for what is used
  • 4. What is AWS Lambda? BYOC - Bring Your Own Code Available runtimes: Node.js v4.3 Python 2.7 Java 8 C# (.NET Core 1.0.1) Behind the scenes: executes within Amazon Linux containers
  • 5. Lambda Functions Confusingly named Stateless Store state in DynamoDB, S3, etc... Can cache in /tmp - unreliably Will run if... Configured to act on events (e.g. S3 bucket writes) Directly invoked via the API Scheduled to Configured as an endpoint for API Gateway This allows its use in serverless
  • 6. Lambda Functions Can call primitive Linux utilities Can create threads/processes These can be frozen Package function in a zip Can include libraries Can include native libraries Can include native binaries Max 50 MB compressed/250 MB uncompressed
  • 7. Lambda Function Configuration Allocate memory 128 MB 1536 MB Affects CPU resources allocated Set timeout (up to 300 seconds) Can VPC-enable with an ENI (so can access private resources) Can set up dead letter queue (Lambda retries failures twice) Environment vars, versioning, aliases
  • 8. Lambda Function Execution From cold: 1. New container is created 2. Lambda function code copied to it 3. Lambda function is initialised 4. Lambda function is executed 5. Container is frozen when function terminates/times out This also can be referred to as warmed/hot - yay, confusion! Steps #1 -> #3 can take time, ~1 to 9 seconds Python least delay from cold, Java longest
  • 9. Lambda Function Execution If warm container is used: 1. Container is thawed 2. Lambda function is executed 3. Container is frozen when function terminates/timeout Step #1 takes < 100ms Java has least delay when warm Note: no guarantees that warm container will be used
  • 11. Lambda in use in production Web form serverless backend Virus scanning & resizing uploaded files Simple automatic image thumbnailer Connecting AWS alarms to internal monitoring Dynamically calculating subnet CIDRs for CloudFormation stacks Processing config changes & alerting on unsafe actions ...and more
  • 12. Benefits of Lambda Quick to create and deploy Connective tissue for AWS resources Reduce server maintenance Potentially unlimited instant scalability Smaller attack surface Cheap! (Generous permanent free tier) 1m requests/month free, $0.0000002 per request after 400,000 GB-seconds compute/month free, $0.00001667 per GB-s after
  • 14. Voting Application An example serverless application https://github.com/infectedsoundsystem/lambda-refarch- webapp
  • 16. AWS CloudFormation To provision the AWS resources Uses JSON/YAML templates Allows to define infrastructure as code Transforms AWS Serverless Application Model definitions
  • 17. Amazon S3 Object storage One bucket stores the Lambda code to deploy via CloudFormation Another bucket stores the website HTML and assets This bucket is configured for static website hosting
  • 18. Amazon DynamoDB NoSQL database PaaS with built-in HA/durability Two tables, one for votes and one for vote aggregation DynamoDB Streams enable reading and processing updates to the vote table
  • 19. Amazon Cognito Service that provides identity management and data sync Primarily used for mobile applications Used here to provide an identity pool to allow browser-side code to run as an unauthenticated user that has IAM permissions to scan the DynamoDB vote aggregation table directly
  • 20. Amazon API Gateway Allows to create publicly available REST APIs Done by creating resources, and methods for these These manage the requests and responses when invoking our Lambda function One resource used here for voting via the website Gives a public HTTPS endpoint for a Lambda function to be triggered via an Ajax request containing the users vote
  • 21. AWS Lambda Four Lambda functions used here: One to register votes received via the website One that listens to a DynamoDB stream from the votes table, and aggregates the votes when there are changes One used as CloudFormation custom resource to create/configure our Cognito Identity Pool One used as CFN custom resource to automatically configure static files with resource values
  • 22. AWS Serverless Application Model Used to define serverless applications on AWS Based on CloudFormation Defined in CFN templates and deployed as CFN stack SAM objects simplify definition of common serverless resources CloudFormation transformation expands these to normal CFN resource definitions https://github.com/awslabs/serverless-application-model
  • 23. Putting it all together...
  • 24. Demo
  • 25. Demo
  • 26. Please go to http://done.1f55.uk Flame war!
  • 28. Over traditional server architectures Modularity and separation Isolated deployments and failures No ongoing server maintenance Potentially unlimited instant scalability Smaller attack surface Cheap!
  • 29. > 90% Running cost reduction when compared to a traditional HA server architecture. (Thats before factoring in additional cost savings from reduced man-hours incurred performing maintenance etc...)
  • 31. Compared to traditional server architectures Not every web application will be suited for it Occasional latency spike due to Lambda container creation (additional ~2-3 secs average for Node.js runtime) Requires initial learning curve to enable design and development of appropriate application architectures
  • 33. All management of the application can be done in code.