SlideShare a Scribd company logo
AWS Lambda: Best Practices
and Common Mistakes
Given by Derek C. Ashmore
Aws Community Days -- Chicago
June 20, 2019
©2018 Derek C. Ashmore, All Rights Reserved 1
Who am I?
• Professional Geek
since 1987
• Java/J2EE/Java EE
since 1999
• AWS since 2010
• Specialties
• Cloud
Workshops
• Cloud-native
Applications
• Yes – I still code!
©2018 Derek C. Ashmore, All Rights Reserved 2
Discussion Resources
• This slide deck
– https://www.slideshare.net/derekashmore/presentations
• Sample code on my Github
– https://github.com/Derek-Ashmore/
• Slide deck has hyper-links!
– Don’t bother writing down URLs
©2018 Derek C. Ashmore, All Rights Reserved 3
Agenda
The
“What”
and “Why”
of AWS
Lambda
Code-Level
Tips
Operation
and Design
Habits
When to
use
Lambdas
Summary /
Q&A
©2016 Derek C. Ashmore, All Rights Reserved 4
What are AWS Lambdas?
• You provide custom code -> AWS runs it
– Java, Go, PowerShell, Node.js, C#, Python, and Ruby
• Computing power with less management
– AWS manages that hardware
– AWS autoscales that hardware
– AWS maintains that hardware
• Lambdas are event driven
– API Gateway (e.g. RESTful Web Service call)
– Many more
• Lambdas are stateless
• Not to be confused with “Lambda Expressions” in Java 8
©2016 Derek C. Ashmore, All Rights Reserved 5
Lambda Implementation Examples
• NodeJS
©2018 Derek C. Ashmore, All Rights Reserved 6
• Python
• Java
Agenda
The
“What”
and “Why”
of AWS
Lambda
Code-Level
Tips
Operation
and Design
Habits
When to
use
Lambdas
Summary /
Q&A
©2016 Derek C. Ashmore, All Rights Reserved 7
What Makes a “Best Practice”?
• Makes Support Easier
• Increases Reuse
• Increases Performance
• Minimizes Resource Consumption
– Labor
– Runtime
©2018 Derek C. Ashmore, All Rights Reserved 8
Report Inputs/Env on Exception
• Place a Try / Catch in your handler
– Python Example
– Java Example
• Also check your arguments with a clear error message
©2018 Derek C. Ashmore, All Rights Reserved 9
def crossAccountHandler(event, context):
try:
………………
except Exception as e:
e.args += (event,vars(context))
raise
Check Arguments Up Front
• Check your arguments with a clear error message
– Python Example
– Java Example
©2018 Derek C. Ashmore, All Rights Reserved 10
def crossAccountHandler(event, context):
try:
if 'Assumed_Role' in event:
…………………
else:
raise Exception('Assumed_Role not provided as argument')
except Exception as e:
Specify Lambda Source Repo
• Explicitly put the source repository name in the Lambda comments
– In most organizations, the repository name isn’t obvious
– Others changing your code need it
– You don’t want source control to be out of date
©2018 Derek C. Ashmore, All Rights Reserved 11
"""
secretLambda.py
……………
Source Control: https://github.com/Derek-Ashmore/AWSDevOpsUtilities
"""
Separate Lambda from Business Logic
• Make business logic reusable
– Callable by other applications
– Usable on premises
• Easier to locally develop and debug
– Lambda-specific logic is thin!
©2018 Derek C. Ashmore, All Rights Reserved 12
def startStopHandler(event, context):
try:
executeStopStart(datetime.datetime.now()
, os.getenv('Scheduled_StartTime', ‘’)
, os.getenv('Scheduled_StopTime', ‘’)
, os.getenv('Scheduled_StartStop_Days', 'M,T,W,R,F’))
……………
return 0;
Agenda
The
“What”
and “Why”
of AWS
Lambda
Code-Level
Tips
Operation
and Design
Habits
When to
use
Lambdas
Summary /
Q&A
©2016 Derek C. Ashmore, All Rights Reserved 13
Automate builds and deployments!
©2018 Derek C. Ashmore, All Rights Reserved 14
Lambda Copies Everywhere!
• Changes / Bug Fixes need to be deployed everywhere
• Solving with automation solves the wrong problem!
©2018 Derek C. Ashmore, All Rights Reserved 15
One Copy for All!
• Scalable – only need to add accounts over time
• Bugfixes in one place
• Configuration usually in common DynamoDB table(s)
• Sample in Python here
©2018 Derek C. Ashmore, All Rights Reserved 16
Cross-Account Execution
• Algorithm is
– Assume a remote-account role using STS
• The response has temporary credentials
– Create a session using the remote account creds
– Do work in the remote account
• Example here: Derek-Ashmore/AWSDevOpsUtilities (Github)
©2018 Derek C. Ashmore, All Rights Reserved 17
For workloads over 15 min
• Executor that invokes lambda asynchronously for
each account
• Sample in Python here
©2018 Derek C. Ashmore, All Rights Reserved 18
Limit Custom Nesting to One Level
• Debugging with nested executions is
– Time consuming and difficult
– Can’t do locally
– Absolutely requires unique correlation id for the entire transaction
• Allows you to tell invocation history for one logical transaction
– Instead of deep custom nesting, use AWS Step Functions
• Use Step Functions if you need more
©2018 Derek C. Ashmore, All Rights Reserved 19
Nested Calls using AWS Step Functions
• AWS Step Functions
– Uses a State Machine model
• Think turn-style to get access to train
– States are “Locked” and “Unlocked”
– Locked → Payment input allowed, then “Unlocked”
– Unlocked → One person allowed through, then “Locked”
– Automatically provides correlation between invocations
• Unified logs for the entire transaction
©2018 Derek C. Ashmore, All Rights Reserved 20
Use Configuration Injection
• No environment specifics hardcoded in the Lambda deployment
• Use Environment Variables on the Lambda Definition
– No un-encrypted secrets (e.g. database password)
• Use Arguments in the triggering event
– No un-encrypted secrets
• Anti-Example
– Splunk forwarding Lambda with hard-coded Splunk channels
©2018 Derek C. Ashmore, All Rights Reserved 21
Providing Secrets to Lambdas
• Secrets are needed items like credentials of any type.
• Use IAM Roles to grant permission to read secrets
• Options are:
– Use KMS
• Encrypt credential and base64 encode it
– Place encrypted version in environment variable
• Sample Lambda and Encryption Script (here)
– Use a Digital Vault (e.g. AWS Secrets Manager)
• Sample Lambda here
©2018 Derek C. Ashmore, All Rights Reserved 22
AWS Secrets Manager
• Use IAM Roles to grant
permission to read secrets
• You don’t need a “secret” to
get a “secret”!
©2018 Derek C. Ashmore, All Rights Reserved 23
Avoid Heavy-Footprint Dependencies
• Minimizes load time
– Mitigates cold-start problem
• Java
– Use Guice over Spring
• Python
– Use AWS provided deps first (list is
here)
• Lambda “Warmers” are an anti-
pattern
– Indicates a work-load that shouldn’t be
deployed as a Lambda
– Tune your warm-up time
©2018 Derek C. Ashmore, All Rights Reserved 24
Idempotence
• Possible for your Lambda to be invoked multiple times for the same event
– Prevent repeat actions from having a different effect.
• Options
– Record the event id –> Skip repeated events
• Most event sources provide a unique request id
– Lambda invoking lambda does not!
• Negatively affects performance
– 1 extra read
– 1 extra write
• Need to roll-off old events
– Insure that the effect is the same each time
• Not perfect → You don’t control invocation order
©2018 Derek C. Ashmore, All Rights Reserved 25
Agenda
The
“What”
and “Why”
of AWS
Lambda
Code-Level
Tips
Operation
and Design
Habits
When to
use
Lambdas
Summary /
Q&A
©2016 Derek C. Ashmore, All Rights Reserved 26
Suitable workloads for Lambda’s
• Workloads that
– Take less than 15 min
– Are stateless
– Idempotent
• Evaluate cost with calculator: https://dashbird.io/lambda-cost-calculator/
• Typical examples
– Streaming data processors
– Dynamo DB Change Processors
– AWS-specific DevOps Tasks
• Security Enforcement
• Uptime Scheduling
• AWS Change Event processing
– CloudFormation Macros
©2018 Derek C. Ashmore, All Rights Reserved 27
Lambda can herd the cats!
• Using Lambda to enforce security
– Automatic Remediation
• Unlike AWS Config, Lambdas can take action!
• Unwanted port exposures
– Unauthorized exposure of 0.0.0.0/0 to the world
• Decentralized Management
– Empowers the organization
– Improves speed to market
• Less bottleneck by admin groups
– Still keeps the enterprise secure
©2018 Derek C. Ashmore, All Rights Reserved 28
Lambda Alternatives
• Use Kubernetes
– Operates as a Lambda type service in Kubernetes
– Functions get shut down when not used – like Lambda behind the
scenes
– Serverless workloads are Containerized
• Run on premises or on any Cloud
– Examples
• Fission
• Knative
• Kubeless
©2018 Derek C. Ashmore, All Rights Reserved 29
Further Reading
• This slide deck
– https://www.slideshare.net/derekashmore/presentations
• AWS Lambda Reading List
– http://www.derekashmore.com/2016/04/aws-lambda-reading-list.html
• Amazon’s Published Best Practice List
– https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html
©2018 Derek C. Ashmore, All Rights Reserved 30
Questions?
• Derek Ashmore:
– Blog: www.derekashmore.com
– LinkedIn: www.linkedin.com/in/derekashmore
• Connect Invites from attendees welcome
– Twitter: https://twitter.com/Derek_Ashmore
– GitHub: https://github.com/Derek-Ashmore
– Book: http://dvtpress.com/
©2018 Derek C. Ashmore, All Rights Reserved 31

More Related Content

What's hot

Serverless AI - London Loft
Serverless AI - London LoftServerless AI - London Loft
Serverless AI - London Loft
Amazon Web Services
 
AWS Lambda@Edge Lightning Demos
AWS Lambda@Edge Lightning Demos AWS Lambda@Edge Lightning Demos
AWS Lambda@Edge Lightning Demos
Amazon Web Services
 
Stephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Stephen Liedig: Building Serverless Backends with AWS Lambda and API GatewayStephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Stephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Steve Androulakis
 
Deep Dive on Elastic Load Balancing
Deep Dive on Elastic Load BalancingDeep Dive on Elastic Load Balancing
Deep Dive on Elastic Load Balancing
Amazon Web Services
 
Real Time Data Processing Using AWS Lambda - DevDay Los Angeles 2017
Real Time Data Processing Using AWS Lambda - DevDay Los Angeles 2017Real Time Data Processing Using AWS Lambda - DevDay Los Angeles 2017
Real Time Data Processing Using AWS Lambda - DevDay Los Angeles 2017
Amazon Web Services
 
Running Containerised Applications at Scale on AWS
Running Containerised Applications at Scale on AWSRunning Containerised Applications at Scale on AWS
Running Containerised Applications at Scale on AWS
Amazon Web Services
 
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
Amazon Web Services
 
把您的 Amazon Lex Chatbot 與訊息服務集成
把您的 Amazon Lex Chatbot 與訊息服務集成把您的 Amazon Lex Chatbot 與訊息服務集成
把您的 Amazon Lex Chatbot 與訊息服務集成
Amazon Web Services
 
Introduce AWS Lambda for newbie and Non-IT
Introduce AWS Lambda for newbie and Non-ITIntroduce AWS Lambda for newbie and Non-IT
Introduce AWS Lambda for newbie and Non-IT
Chitpong Wuttanan
 
Introduction to AWS X-Ray
Introduction to AWS X-RayIntroduction to AWS X-Ray
Introduction to AWS X-Ray
Amazon Web Services
 
Picking the right AWS backend for your Java application (May 2017)
Picking the right AWS backend for your Java application (May 2017)Picking the right AWS backend for your Java application (May 2017)
Picking the right AWS backend for your Java application (May 2017)
Julien SIMON
 
Advanced Task Scheduling with Amazon ECS (June 2017)
Advanced Task Scheduling with Amazon ECS (June 2017)Advanced Task Scheduling with Amazon ECS (June 2017)
Advanced Task Scheduling with Amazon ECS (June 2017)
Julien SIMON
 
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
AWS Chicago
 
(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...
(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...
(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...
Amazon Web Services
 
Building Global Serverless Backends
Building Global Serverless BackendsBuilding Global Serverless Backends
Building Global Serverless BackendsAmazon Web Services
 
Picking the right AWS backend for your Java application (May 2017)
Picking the right AWS backend for your Java application (May 2017)Picking the right AWS backend for your Java application (May 2017)
Picking the right AWS backend for your Java application (May 2017)
Julien SIMON
 
AWS Certified Cloud Practitioner Course S7-S10
AWS Certified Cloud Practitioner Course S7-S10AWS Certified Cloud Practitioner Course S7-S10
AWS Certified Cloud Practitioner Course S7-S10
Neal Davis
 
Infrastructure is code with the AWS cloud development kit
Infrastructure is code with the AWS cloud development kitInfrastructure is code with the AWS cloud development kit
Infrastructure is code with the AWS cloud development kit
AWS User Group Pune
 
(BAC304) Deploying a Disaster Recovery Site on AWS: Minimal Cost with Maximum...
(BAC304) Deploying a Disaster Recovery Site on AWS: Minimal Cost with Maximum...(BAC304) Deploying a Disaster Recovery Site on AWS: Minimal Cost with Maximum...
(BAC304) Deploying a Disaster Recovery Site on AWS: Minimal Cost with Maximum...
Amazon Web Services
 
aws lambda & api gateway
aws lambda & api gatewayaws lambda & api gateway
aws lambda & api gateway
fumihiko hata
 

What's hot (20)

Serverless AI - London Loft
Serverless AI - London LoftServerless AI - London Loft
Serverless AI - London Loft
 
AWS Lambda@Edge Lightning Demos
AWS Lambda@Edge Lightning Demos AWS Lambda@Edge Lightning Demos
AWS Lambda@Edge Lightning Demos
 
Stephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Stephen Liedig: Building Serverless Backends with AWS Lambda and API GatewayStephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Stephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
 
Deep Dive on Elastic Load Balancing
Deep Dive on Elastic Load BalancingDeep Dive on Elastic Load Balancing
Deep Dive on Elastic Load Balancing
 
Real Time Data Processing Using AWS Lambda - DevDay Los Angeles 2017
Real Time Data Processing Using AWS Lambda - DevDay Los Angeles 2017Real Time Data Processing Using AWS Lambda - DevDay Los Angeles 2017
Real Time Data Processing Using AWS Lambda - DevDay Los Angeles 2017
 
Running Containerised Applications at Scale on AWS
Running Containerised Applications at Scale on AWSRunning Containerised Applications at Scale on AWS
Running Containerised Applications at Scale on AWS
 
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
 
把您的 Amazon Lex Chatbot 與訊息服務集成
把您的 Amazon Lex Chatbot 與訊息服務集成把您的 Amazon Lex Chatbot 與訊息服務集成
把您的 Amazon Lex Chatbot 與訊息服務集成
 
Introduce AWS Lambda for newbie and Non-IT
Introduce AWS Lambda for newbie and Non-ITIntroduce AWS Lambda for newbie and Non-IT
Introduce AWS Lambda for newbie and Non-IT
 
Introduction to AWS X-Ray
Introduction to AWS X-RayIntroduction to AWS X-Ray
Introduction to AWS X-Ray
 
Picking the right AWS backend for your Java application (May 2017)
Picking the right AWS backend for your Java application (May 2017)Picking the right AWS backend for your Java application (May 2017)
Picking the right AWS backend for your Java application (May 2017)
 
Advanced Task Scheduling with Amazon ECS (June 2017)
Advanced Task Scheduling with Amazon ECS (June 2017)Advanced Task Scheduling with Amazon ECS (June 2017)
Advanced Task Scheduling with Amazon ECS (June 2017)
 
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
 
(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...
(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...
(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...
 
Building Global Serverless Backends
Building Global Serverless BackendsBuilding Global Serverless Backends
Building Global Serverless Backends
 
Picking the right AWS backend for your Java application (May 2017)
Picking the right AWS backend for your Java application (May 2017)Picking the right AWS backend for your Java application (May 2017)
Picking the right AWS backend for your Java application (May 2017)
 
AWS Certified Cloud Practitioner Course S7-S10
AWS Certified Cloud Practitioner Course S7-S10AWS Certified Cloud Practitioner Course S7-S10
AWS Certified Cloud Practitioner Course S7-S10
 
Infrastructure is code with the AWS cloud development kit
Infrastructure is code with the AWS cloud development kitInfrastructure is code with the AWS cloud development kit
Infrastructure is code with the AWS cloud development kit
 
(BAC304) Deploying a Disaster Recovery Site on AWS: Minimal Cost with Maximum...
(BAC304) Deploying a Disaster Recovery Site on AWS: Minimal Cost with Maximum...(BAC304) Deploying a Disaster Recovery Site on AWS: Minimal Cost with Maximum...
(BAC304) Deploying a Disaster Recovery Site on AWS: Minimal Cost with Maximum...
 
aws lambda & api gateway
aws lambda & api gatewayaws lambda & api gateway
aws lambda & api gateway
 

Similar to AWS Lambda: Best Practices and Common Mistakes - AWS Community Days 2019

AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2020
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2020AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2020
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2020
Derek Ashmore
 
AWS Lambda for Architects - Chicago Coder Conference -2016-06-07
AWS Lambda for Architects - Chicago Coder Conference -2016-06-07AWS Lambda for Architects - Chicago Coder Conference -2016-06-07
AWS Lambda for Architects - Chicago Coder Conference -2016-06-07
Derek Ashmore
 
AWS Lambda Deployments: Best Practices and Common Mistakes O'Reilly Software...
AWS Lambda Deployments:  Best Practices and Common Mistakes O'Reilly Software...AWS Lambda Deployments:  Best Practices and Common Mistakes O'Reilly Software...
AWS Lambda Deployments: Best Practices and Common Mistakes O'Reilly Software...
Derek Ashmore
 
Aws Lambda for Java Architects - Illinois VJug -2016-05-03
Aws Lambda for Java Architects - Illinois VJug -2016-05-03Aws Lambda for Java Architects - Illinois VJug -2016-05-03
Aws Lambda for Java Architects - Illinois VJug -2016-05-03
Derek Ashmore
 
Aws Lambda for Java Architects - Illinois JUG-Northwest -2016-08-02
Aws Lambda for Java Architects - Illinois JUG-Northwest -2016-08-02Aws Lambda for Java Architects - Illinois JUG-Northwest -2016-08-02
Aws Lambda for Java Architects - Illinois JUG-Northwest -2016-08-02
Derek Ashmore
 
Aws Lambda for Java Architects - JavaOne -2016-09-19
Aws Lambda for Java Architects - JavaOne -2016-09-19Aws Lambda for Java Architects - JavaOne -2016-09-19
Aws Lambda for Java Architects - JavaOne -2016-09-19
Derek Ashmore
 
Aws Lambda for Java Architects CJug-Chicago 2016-08-30
Aws Lambda for Java Architects CJug-Chicago 2016-08-30Aws Lambda for Java Architects CJug-Chicago 2016-08-30
Aws Lambda for Java Architects CJug-Chicago 2016-08-30
Derek Ashmore
 
Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018
Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018
Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018
Derek Ashmore
 
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Chris Munns
 
Become a Serverless Black Belt - Optimizing Your Serverless Applications - AW...
Become a Serverless Black Belt - Optimizing Your Serverless Applications - AW...Become a Serverless Black Belt - Optimizing Your Serverless Applications - AW...
Become a Serverless Black Belt - Optimizing Your Serverless Applications - AW...
Amazon Web Services
 
Build and Deploy Serverless Applications with AWS SAM
Build and Deploy Serverless Applications with AWS SAM Build and Deploy Serverless Applications with AWS SAM
Build and Deploy Serverless Applications with AWS SAM
Amazon Web Services
 
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...Amazon Web Services
 
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
Chris Munns
 
Serverless use cases with AWS Lambda - More Serverless Event
Serverless use cases with AWS Lambda - More Serverless EventServerless use cases with AWS Lambda - More Serverless Event
Serverless use cases with AWS Lambda - More Serverless Event
Boaz Ziniman
 
Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...
Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...
Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...
Amazon Web Services
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep Dive
Amazon Web Services
 
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Amazon Web Services
 
Meetup callback
Meetup callbackMeetup callback
Meetup callback
Wayne Scarano
 
2018 10-19-jc conf-embrace-legacy-java-ee-by-aws-serverless
2018 10-19-jc conf-embrace-legacy-java-ee-by-aws-serverless2018 10-19-jc conf-embrace-legacy-java-ee-by-aws-serverless
2018 10-19-jc conf-embrace-legacy-java-ee-by-aws-serverless
Kim Kao
 
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
Amazon Web Services
 

Similar to AWS Lambda: Best Practices and Common Mistakes - AWS Community Days 2019 (20)

AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2020
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2020AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2020
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2020
 
AWS Lambda for Architects - Chicago Coder Conference -2016-06-07
AWS Lambda for Architects - Chicago Coder Conference -2016-06-07AWS Lambda for Architects - Chicago Coder Conference -2016-06-07
AWS Lambda for Architects - Chicago Coder Conference -2016-06-07
 
AWS Lambda Deployments: Best Practices and Common Mistakes O'Reilly Software...
AWS Lambda Deployments:  Best Practices and Common Mistakes O'Reilly Software...AWS Lambda Deployments:  Best Practices and Common Mistakes O'Reilly Software...
AWS Lambda Deployments: Best Practices and Common Mistakes O'Reilly Software...
 
Aws Lambda for Java Architects - Illinois VJug -2016-05-03
Aws Lambda for Java Architects - Illinois VJug -2016-05-03Aws Lambda for Java Architects - Illinois VJug -2016-05-03
Aws Lambda for Java Architects - Illinois VJug -2016-05-03
 
Aws Lambda for Java Architects - Illinois JUG-Northwest -2016-08-02
Aws Lambda for Java Architects - Illinois JUG-Northwest -2016-08-02Aws Lambda for Java Architects - Illinois JUG-Northwest -2016-08-02
Aws Lambda for Java Architects - Illinois JUG-Northwest -2016-08-02
 
Aws Lambda for Java Architects - JavaOne -2016-09-19
Aws Lambda for Java Architects - JavaOne -2016-09-19Aws Lambda for Java Architects - JavaOne -2016-09-19
Aws Lambda for Java Architects - JavaOne -2016-09-19
 
Aws Lambda for Java Architects CJug-Chicago 2016-08-30
Aws Lambda for Java Architects CJug-Chicago 2016-08-30Aws Lambda for Java Architects CJug-Chicago 2016-08-30
Aws Lambda for Java Architects CJug-Chicago 2016-08-30
 
Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018
Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018
Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018
 
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
 
Become a Serverless Black Belt - Optimizing Your Serverless Applications - AW...
Become a Serverless Black Belt - Optimizing Your Serverless Applications - AW...Become a Serverless Black Belt - Optimizing Your Serverless Applications - AW...
Become a Serverless Black Belt - Optimizing Your Serverless Applications - AW...
 
Build and Deploy Serverless Applications with AWS SAM
Build and Deploy Serverless Applications with AWS SAM Build and Deploy Serverless Applications with AWS SAM
Build and Deploy Serverless Applications with AWS SAM
 
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
 
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
 
Serverless use cases with AWS Lambda - More Serverless Event
Serverless use cases with AWS Lambda - More Serverless EventServerless use cases with AWS Lambda - More Serverless Event
Serverless use cases with AWS Lambda - More Serverless Event
 
Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...
Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...
Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep Dive
 
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...
 
Meetup callback
Meetup callbackMeetup callback
Meetup callback
 
2018 10-19-jc conf-embrace-legacy-java-ee-by-aws-serverless
2018 10-19-jc conf-embrace-legacy-java-ee-by-aws-serverless2018 10-19-jc conf-embrace-legacy-java-ee-by-aws-serverless
2018 10-19-jc conf-embrace-legacy-java-ee-by-aws-serverless
 
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
 

Recently uploaded

Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 

Recently uploaded (20)

Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 

AWS Lambda: Best Practices and Common Mistakes - AWS Community Days 2019

  • 1. AWS Lambda: Best Practices and Common Mistakes Given by Derek C. Ashmore Aws Community Days -- Chicago June 20, 2019 ©2018 Derek C. Ashmore, All Rights Reserved 1
  • 2. Who am I? • Professional Geek since 1987 • Java/J2EE/Java EE since 1999 • AWS since 2010 • Specialties • Cloud Workshops • Cloud-native Applications • Yes – I still code! ©2018 Derek C. Ashmore, All Rights Reserved 2
  • 3. Discussion Resources • This slide deck – https://www.slideshare.net/derekashmore/presentations • Sample code on my Github – https://github.com/Derek-Ashmore/ • Slide deck has hyper-links! – Don’t bother writing down URLs ©2018 Derek C. Ashmore, All Rights Reserved 3
  • 4. Agenda The “What” and “Why” of AWS Lambda Code-Level Tips Operation and Design Habits When to use Lambdas Summary / Q&A ©2016 Derek C. Ashmore, All Rights Reserved 4
  • 5. What are AWS Lambdas? • You provide custom code -> AWS runs it – Java, Go, PowerShell, Node.js, C#, Python, and Ruby • Computing power with less management – AWS manages that hardware – AWS autoscales that hardware – AWS maintains that hardware • Lambdas are event driven – API Gateway (e.g. RESTful Web Service call) – Many more • Lambdas are stateless • Not to be confused with “Lambda Expressions” in Java 8 ©2016 Derek C. Ashmore, All Rights Reserved 5
  • 6. Lambda Implementation Examples • NodeJS ©2018 Derek C. Ashmore, All Rights Reserved 6 • Python • Java
  • 7. Agenda The “What” and “Why” of AWS Lambda Code-Level Tips Operation and Design Habits When to use Lambdas Summary / Q&A ©2016 Derek C. Ashmore, All Rights Reserved 7
  • 8. What Makes a “Best Practice”? • Makes Support Easier • Increases Reuse • Increases Performance • Minimizes Resource Consumption – Labor – Runtime ©2018 Derek C. Ashmore, All Rights Reserved 8
  • 9. Report Inputs/Env on Exception • Place a Try / Catch in your handler – Python Example – Java Example • Also check your arguments with a clear error message ©2018 Derek C. Ashmore, All Rights Reserved 9 def crossAccountHandler(event, context): try: ……………… except Exception as e: e.args += (event,vars(context)) raise
  • 10. Check Arguments Up Front • Check your arguments with a clear error message – Python Example – Java Example ©2018 Derek C. Ashmore, All Rights Reserved 10 def crossAccountHandler(event, context): try: if 'Assumed_Role' in event: ………………… else: raise Exception('Assumed_Role not provided as argument') except Exception as e:
  • 11. Specify Lambda Source Repo • Explicitly put the source repository name in the Lambda comments – In most organizations, the repository name isn’t obvious – Others changing your code need it – You don’t want source control to be out of date ©2018 Derek C. Ashmore, All Rights Reserved 11 """ secretLambda.py …………… Source Control: https://github.com/Derek-Ashmore/AWSDevOpsUtilities """
  • 12. Separate Lambda from Business Logic • Make business logic reusable – Callable by other applications – Usable on premises • Easier to locally develop and debug – Lambda-specific logic is thin! ©2018 Derek C. Ashmore, All Rights Reserved 12 def startStopHandler(event, context): try: executeStopStart(datetime.datetime.now() , os.getenv('Scheduled_StartTime', ‘’) , os.getenv('Scheduled_StopTime', ‘’) , os.getenv('Scheduled_StartStop_Days', 'M,T,W,R,F’)) …………… return 0;
  • 13. Agenda The “What” and “Why” of AWS Lambda Code-Level Tips Operation and Design Habits When to use Lambdas Summary / Q&A ©2016 Derek C. Ashmore, All Rights Reserved 13
  • 14. Automate builds and deployments! ©2018 Derek C. Ashmore, All Rights Reserved 14
  • 15. Lambda Copies Everywhere! • Changes / Bug Fixes need to be deployed everywhere • Solving with automation solves the wrong problem! ©2018 Derek C. Ashmore, All Rights Reserved 15
  • 16. One Copy for All! • Scalable – only need to add accounts over time • Bugfixes in one place • Configuration usually in common DynamoDB table(s) • Sample in Python here ©2018 Derek C. Ashmore, All Rights Reserved 16
  • 17. Cross-Account Execution • Algorithm is – Assume a remote-account role using STS • The response has temporary credentials – Create a session using the remote account creds – Do work in the remote account • Example here: Derek-Ashmore/AWSDevOpsUtilities (Github) ©2018 Derek C. Ashmore, All Rights Reserved 17
  • 18. For workloads over 15 min • Executor that invokes lambda asynchronously for each account • Sample in Python here ©2018 Derek C. Ashmore, All Rights Reserved 18
  • 19. Limit Custom Nesting to One Level • Debugging with nested executions is – Time consuming and difficult – Can’t do locally – Absolutely requires unique correlation id for the entire transaction • Allows you to tell invocation history for one logical transaction – Instead of deep custom nesting, use AWS Step Functions • Use Step Functions if you need more ©2018 Derek C. Ashmore, All Rights Reserved 19
  • 20. Nested Calls using AWS Step Functions • AWS Step Functions – Uses a State Machine model • Think turn-style to get access to train – States are “Locked” and “Unlocked” – Locked → Payment input allowed, then “Unlocked” – Unlocked → One person allowed through, then “Locked” – Automatically provides correlation between invocations • Unified logs for the entire transaction ©2018 Derek C. Ashmore, All Rights Reserved 20
  • 21. Use Configuration Injection • No environment specifics hardcoded in the Lambda deployment • Use Environment Variables on the Lambda Definition – No un-encrypted secrets (e.g. database password) • Use Arguments in the triggering event – No un-encrypted secrets • Anti-Example – Splunk forwarding Lambda with hard-coded Splunk channels ©2018 Derek C. Ashmore, All Rights Reserved 21
  • 22. Providing Secrets to Lambdas • Secrets are needed items like credentials of any type. • Use IAM Roles to grant permission to read secrets • Options are: – Use KMS • Encrypt credential and base64 encode it – Place encrypted version in environment variable • Sample Lambda and Encryption Script (here) – Use a Digital Vault (e.g. AWS Secrets Manager) • Sample Lambda here ©2018 Derek C. Ashmore, All Rights Reserved 22
  • 23. AWS Secrets Manager • Use IAM Roles to grant permission to read secrets • You don’t need a “secret” to get a “secret”! ©2018 Derek C. Ashmore, All Rights Reserved 23
  • 24. Avoid Heavy-Footprint Dependencies • Minimizes load time – Mitigates cold-start problem • Java – Use Guice over Spring • Python – Use AWS provided deps first (list is here) • Lambda “Warmers” are an anti- pattern – Indicates a work-load that shouldn’t be deployed as a Lambda – Tune your warm-up time ©2018 Derek C. Ashmore, All Rights Reserved 24
  • 25. Idempotence • Possible for your Lambda to be invoked multiple times for the same event – Prevent repeat actions from having a different effect. • Options – Record the event id –> Skip repeated events • Most event sources provide a unique request id – Lambda invoking lambda does not! • Negatively affects performance – 1 extra read – 1 extra write • Need to roll-off old events – Insure that the effect is the same each time • Not perfect → You don’t control invocation order ©2018 Derek C. Ashmore, All Rights Reserved 25
  • 26. Agenda The “What” and “Why” of AWS Lambda Code-Level Tips Operation and Design Habits When to use Lambdas Summary / Q&A ©2016 Derek C. Ashmore, All Rights Reserved 26
  • 27. Suitable workloads for Lambda’s • Workloads that – Take less than 15 min – Are stateless – Idempotent • Evaluate cost with calculator: https://dashbird.io/lambda-cost-calculator/ • Typical examples – Streaming data processors – Dynamo DB Change Processors – AWS-specific DevOps Tasks • Security Enforcement • Uptime Scheduling • AWS Change Event processing – CloudFormation Macros ©2018 Derek C. Ashmore, All Rights Reserved 27
  • 28. Lambda can herd the cats! • Using Lambda to enforce security – Automatic Remediation • Unlike AWS Config, Lambdas can take action! • Unwanted port exposures – Unauthorized exposure of 0.0.0.0/0 to the world • Decentralized Management – Empowers the organization – Improves speed to market • Less bottleneck by admin groups – Still keeps the enterprise secure ©2018 Derek C. Ashmore, All Rights Reserved 28
  • 29. Lambda Alternatives • Use Kubernetes – Operates as a Lambda type service in Kubernetes – Functions get shut down when not used – like Lambda behind the scenes – Serverless workloads are Containerized • Run on premises or on any Cloud – Examples • Fission • Knative • Kubeless ©2018 Derek C. Ashmore, All Rights Reserved 29
  • 30. Further Reading • This slide deck – https://www.slideshare.net/derekashmore/presentations • AWS Lambda Reading List – http://www.derekashmore.com/2016/04/aws-lambda-reading-list.html • Amazon’s Published Best Practice List – https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html ©2018 Derek C. Ashmore, All Rights Reserved 30
  • 31. Questions? • Derek Ashmore: – Blog: www.derekashmore.com – LinkedIn: www.linkedin.com/in/derekashmore • Connect Invites from attendees welcome – Twitter: https://twitter.com/Derek_Ashmore – GitHub: https://github.com/Derek-Ashmore – Book: http://dvtpress.com/ ©2018 Derek C. Ashmore, All Rights Reserved 31