Serverless Architecture

A Love Story!

Linda Nichols

@lynnaloo

Work @ Microsoft

Linda Nichols

@lynnaloo

Norfolk.js

norfolkjs.org

@lynnaloo

Today you're going to fall in love with Serverless Architecture...

But first, you have to break-up with your servers.

@lynnaloo
@lynnaloo

This story has all of the pieces of a typical romance:

  • Break-ups and decoupling

  • Commitment (and no-commitment)

  • Highly cohesive relationships

  • High availability and dedication

  • Support and growth 

But first, what is "serverless"* architecture?

@lynnaloo

* "Serverless" is just a catchy, made-up, marketing term.

(Kind of like, "Cloud")

@lynnaloo

Serverless Architecture?

It isn't about a platform or compute product...

@lynnaloo

Serverless Architecture?

It's about the events!

Serverless Architecture?

Serverless Architecture is an event-driven system that uses remote services (and likely a FaaS product) without concern for the operations of the environment where the code is executed.

@lynnaloo
@lynnaloo

Functions-as-a-Service (Faas)

Stateless functions running in execution environments managed by a service provider (not you!).

@lynnaloo

Functions-as-a-Service

FaaS is the heart of Serverless Architecture.

Functions-as-a-Service (FaaS)

  • Fully-managed

  • Stateless and ephemeral

  • No worries about infrastructure

  • Focus on the code

  • Only pay when (if) you use

@lynnaloo
@lynnaloo

Your code could be completely free...

@lynnaloo

Functions-as-a-Service (FaaS)

@lynnaloo

AWS Lambda

Most popular kid in school

@lynnaloo

AWS Lambda

  • First on the market

  • Focus on performance and scale

  • Runtime Layers

  • Custom Runtimes

  • Step Functions

@lynnaloo

Azure Functions

The Developer's Favorite

@lynnaloo

Azure Functions

  • Open-source Runtimes

  • Developer Tools/Plugins

  • Offline Development

  • Premier Tier

  • Logic Apps and Event Grid

@lynnaloo

IBM Cloud Functions

They do really mean open

@lynnaloo

IBM Cloud Functions

  • Backed by OpenWhisk

  • Official runtimes for php and Swift

  • Truly open, which helps with licensing issues

  • Support for On-prem

@lynnaloo

Google Cloud Functions

Finally in GA!

@lynnaloo

Google Cloud Functions

  • As of last summer, GA with Node.js and Python (Beta)

  • Custom runtimes in the form of Cloud Run (new from Google Next)

  • Great developer experience and quick out-of-the-box apps

Serverless Architecture

  • Storage

  • IoT

  • Database Actions

  • API Gateways

  • Queues

  • Logging

@lynnaloo

Functions can be triggered by other cloud services

Functions are Microservices

  • One function, one function

  • Lightweight and fast

  • Reusable

  • Independent deployments

  • Work together to power applications

@lynnaloo
@lynnaloo

Did someone say decoupling?

@lynnaloo

Serverless Architecture

@lynnaloo

Your perfect match!

Serverless Architecture

  • Dedicated

  • Flexible

  • Supportive

  • Resilient

  • Growth potential

  • Speaks many languages!

What if I'm scared of commitment?

@lynnaloo
@lynnaloo

The cloud platforms do have analogous services...

Relationship Counseling

@lynnaloo

Embrace tools and frameworks!

Serverless Framework

  • Open-source

  • Supports various languages

  • Abstracts provider-specific tasks

  • Multi-provider plugin system

  • Scaffold and deploy using CLI

@lynnaloo

What it looks like

# Install serverless cli
$ npm install serverless -g

# Create Azure Service
$ serverless create --template azure-nodejs --path cat-name-service

# Change into the service directory
$ cd cat-name-service

# Deploy to cloud provider
$ serverless deploy -v
cat-name-service/
  package.json
  serverless.yml
  handler.js 
dog-name-service/
  package.json
  serverless.yml
  handler.js
@lynnaloo

Azure Functions Handler

'use strict';

const catNames = require('cat-names');

function getCatName(context, req) {
    
    context.log('Getting a random cat name.');
    context.done(null, { body: `Your cat name is ${catNames.random()}.` });
}

module.exports = getCatName;

(then package and/or deploy it!)

@lynnaloo
@lynnaloo

But what about the events?

@lynnaloo
@lynnaloo

Cloud Events

a specification for describing event data in a common way

Demo Time

@lynnaloo

Audience Participation!

@lynnaloo
Mention @thesecatstweet in a tweet with the hashtag #valentinebot

Valentine-Bot

@lynnaloo
  • Twitter API for Node.js

  • Scheduler service

  • Storage

  • FaaS Service

  • Framework or Toolset

Azure Logic Apps

@lynnaloo

Thank You!

@lynnaloo

Made with Slides.com