The document discusses lessons learned from building a serverless company. It introduces Planet 9 Energy and their use of AWS Lambda and the Serverless framework. Key topics covered include security, quality assurance, developer experience, costs, and lessons learned. Some challenges discussed are debugging, API Gateway custom domains, and Lambda limitations. The document emphasizes that serverless architectures provide infinite scalability at low cost but also have some limitations that require management.
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
AWS Lambda & Serverless Lessons
1. AWS Lambda &
Serverless framework
Lessons learned while building a serverless company
26/01/2017@Podgeypoos79 - @loige
2. Luciano Mammino
● @loige on Twitter
● Lmammino on GitHub
● Blog at loige.co
● Co-author of:
Node.js Design Patterns(Second Edition)
3. Padraig O’Brien (a.k.a “Podge”)
● @podgeypoos79 on Twitter
● Does not have a book (yet…)
● Organiser of Nodeschool Dublin and Dun Laoghaire
● Organiser of Dublin Serverless meetup
● He is writing his own database, unicorndb
7. 17.520 * * 24
Meter readings Customer size Data versions
≈4 billion data pts / year (tot.)
SMALL customer ≈3 mln data pts / year MEDIUM customer ≈20 mln data pts / year BIG customer ≈110 mln data pts / year
( Per customer / year )
8. ● Limited number of “Full stack” engineers
● Write & deploy quality code as fast as possible
● Adopt hot and relevant technologies
● No servers... or more to the point, NO CALLS AT 2 AM!
Our requirements
17. What is a lambda?
● Function as a service (FAAS)
● Pay for invocation / processing time
● Virtually “infinite” auto-scaling
● Focus on business logic, not on servers
daaaa!
18. Lambda as micro-services
● Events are first-class citizens
● Every lambda scales independently
● Agility (develop features quick and in an isolated fashion)
Classic micro-services concerns:
● Granularity (how to separate features? BDD? Bounded Contexts?)
● Orchestration (dependencies between lambdas, service discovery…)
32. Unit Testing
● Split business logic into small testable modules
● Use dependency injection for external resources
(DB, Filesystem, etc.)
● Mock dependencies with Sinon
● Aim for 100% coverage
33. ● Use child_process.exec to launch “serverless invoke
local”
● Use node-tap to make assertions on the output
● Test environment recreated locally with docker (e.g.
Postgres test DB).
● Cannot always test locally (Redshift, SNS, SQS…)
Functional Testing
38. Continuous Integration
Git-Flow
● Check code style (ESLint)
● Run unit tests
● Build the project
● Run functional tests
● If commit is on “master”:
Create deployable artifact
● Develop features/fixes locally
using git branches
● Push to GitHub
45. ● Develop locally - Invoke local.
● Deploy to AWS.
● Invoke on AWS and stream the logs.
● This is a SLOW feedback loop.
● Lots of requests to improve local dev.
● Plugins are helping to improve this.
Local development
75. AWS Lambda limitations
● 512 MB of TMP space
● Lambdas can only execute for 300 seconds
● Request Response size of 6 MB
● Event size of 128 Kb
● Max 50 MB for deployment package
80. Recap
● Serverless architectures are COOL!
○ Infinite scalability at low cost
○ Managed service
○ Still has some limitations
● Managing a project might be hard but:
○ Technology progress and open source projects (Serverless.com) will make
things easier
81. Planet 9 Energy tech-team
We are
hiring :)
Peter Saŝa Podge Luciano YOU?
Alberto Joe DomagojHugh Gus Ruth
Check out
Loki.js