Going Serverless with AWS Lambda Bodor László Going Serverless with AWS Lambda T3EE 2016 – November 12, 2016
Bodor László About me Software developer since 2004 TYPO3 since 2007 Flow Framework, Symfony & Silex AWS & Cloud architectures last 2 years Microservices Travel and airplanes Self employed
Serverless ? No servers ? Debunking myths Serverless DOESN’T mean there are no servers! You, THE DEVELOPER - Don’t have to care about servers when coding - Don’t have to manage physical capacities
Focus! Developers should focus on code, not infrastructure! Graphic by © Daniel Krook, IBM
Servers What is the right size for my server ? What capacity I have left on my server ? How many servers should I provision ? Which OS should my server run ? Who should have access to my servers ? How can I detect a compromised server ? How do I keep my server patched ? When should I scale up / out ? Should I tune my settings on the server ? Hardware fails. How do I handle that ?
Focus! Developers should focus on the product, not infrastructure! Graphic by © Daniel Krook, IBM
Microservices Microservices is a software architecture style for complex applications. It is a specialization and an implementation approach for SOA (Service Oriented Architecture) Characteristics: Small services Communicate over network Language agnostic API’s Highly decoupled Focus on a single task Modular approach
What is Serverless anyway ? Function as a Service (FaaS) – cloud functions “Custom code that’s run in ephemeral containers” Mike Roberts (via martinfowler.com/articles/serverless.html) Execution model - triggering 2014 – AWS Lambda Google Cloud Functions, IBM OpenWhisk 2016 – Azure Functions Serverless is the next level of Microservices
AWS Lambda Serverless, event-driven compute service Functions that run code without servers Automatically scale Pay only for the time you use Do not pay idle time! Triggered by events: PUT to S3 Updates to DynamoDB table Call to API endpoint and more….
AWS Lambda Runtimes: Function as a unit of scale Node.js Java Python Function as a unit of scale Function as a unit of deployment Stateless nature Microservice without servers
AWS Lambda Helloworld.js Cmd$: aws lambda create-function --region eu-central-1 \ > --function-name=helloworld \ > --zip-file=fileb://helloworld.zip \ > --role arn:aws:iam::0101010101010:role/executionrole \ > --handler=helloworld.handler \ > --runtime=nodejs
Components of a serverless app
The API Gateway A fully managed service for API’s REST endpoints API Keys DDoS protection and Throttling Usage plans / quotas Staging an versioning Pain free SSL
The API Gateway
AWS API Gateway
Typical Serverless app with AWS
Use cases Thumbnail generation and media encoding Event driven database Queue processing Kinesis streams & SNS Backups and scheduled ops (cron) Mobile backend Full serverless application
TYPO3
Free tier! Pricing model Duration: Pay for running time in 100 ms Requests: $0.20 per 1 million requests Free tier! 1 million requests and 400,000 Gbs of compute capacity every month for FREE
Limitations 100 concurrent functions safety limit (at request this limit can be lifted if you need more) 1536 MB max memory / function 5 minutes max runtime Ephemeral disk capacity “/tmp” : 512 MB Lambda function deployment: package size 50 MB Dependencies in deployment package max 250 MB Total size of all the deployment packages per region: 75 GB
The good No servers to manage Continuous and automatic horizontal scaling Never pay for idle servers Focus on code performance Modularity
The bad Technology in its infancy Lack of tooling Lack of versioning Testing is difficult when functions are chained Debugging is difficult Cold starts (especially with Java) Vendor lock-in
Amazon Flourish Announced late spring 2016 A platform to manage components of serverless applications Versioning of Lambda functions Packaging lambda functions with dependencies Open source (Apache license) Yet to be seen (re:Invent 2016 ?)
Serverless Framework https://github.com/serverless/serverless $3 million funding recently received Other platforms supported as well Framework for working with serverless apps
Conclusions Serverless is no silver bullet Rough edges are still present It can save you time and money developing products Allows decoupling and modularity The future is serverless!
Questions ?
Thank you! Get in touch laci@lacisoft.com https://lacisoft.com/blog https://twitter.com/lacisoft