Serverless

A insight into serverless architecture and the Serverless Framework

What does 'serverless' architecture mean?

  • Single purpose functions that run on ephemeral containers, generally on IaaS platforms

  • Technically, no static or dynamic server to worry about

  • AWS Lambda, Azure Cloud Functions, Google Cloud Functions

How is it different?

  • Why worry about infrastructure detail?

  • Why worry about API's?

  • Why spend money when you don't have to?

  • Why write big monolithic, tightly coupled and bound applications when you don't know what could change tomorrow, making it hard to abstract?

Use cases

Technically anything!

But more specifically, what are we using it for today:

  • Image resize - listen to S3 bucket event, pick up object, resize object

  • File download - scheduled lambda task to download file via SFTP to an S3 bucket/EC2 instance

Implementation

Costs?

  • First 1 million requests per month are free

  • $0.20 per 1 million requests thereafter ($0.0000002 per request)

1,000,000 requests) = $0 (free tier)
0.0000002 * 5,000,000 requests = $1
---
6,000,000 requests = $1

Are there issues?

  • New paradigm shift

  • Could be misinterpreted as not needing knowledge of infrastructure

  • Cold starts - new/inactive functions can take up to 10 seconds to spin up, worse with Java on AWS, for example, as it needs to start virtual machine on empty EC2. Have not experienced with JavaScript yet.

  • Offline development may be difficult to get into a nice state

Serverless Framework

  • An open-source framework that let's you easily build an army of lambdas

  • Automates the additional components needed such as CloudFormation, API Gateway, DynamoDB etc.

Capabilities

  • Many languages + frameworks supported:
    Java, Scala, Python, R, ES6, TypeScript

  • Psuedo Cloud-Formation template to empower your stack through multiple environments

Simple CRUD Example

Questions?

References

Serverless

By Matt Rowles

Serverless

A insight into Serverless architectures and the Serverless Framework.

  • 55