Serverless Deployment with AWS

Andrew Lombardi / @kinabalu

Mystic Coders, LLC

About Me

About Me

About Me

18 Years in Business

10 Years @ Java2Days

Published Author

Software Consultants

Invented the Internet


To our success!

WebSocket Book

Incomplete History of Deployment

Rack Servers

Traditional IT


Serverless / FaaS

What is Serverless?

  • No server / instance management
  • Auto Scaling Provision based on load
  • Costs measured on usage
  • High availability

Service Models

Backend as a Service (BaaS)

Function as a Service (FaaS)


Event driven

Runs user functions

Auto scaled and provisioned

Precise costs


FaaS vs PaaS

In a PaaS environment, scaling is still your problem, with FaaS it's handled.

Supported Languages / Platforms

  • Node.js
  • Python (3.6, 3.7, 2.7)
  • Java 8
  • C# (.NET Core)
  • Go

Events / Triggers

S3 DynamoDB Kinesis Data Streams SNS
SES SQS Cognito CloudFormation
CloudWatch Logs CloudWatch Events CodeCommit Scheduled Events
AWS Config Alexa Lex API Gateway
AWS IoT Button CloudFront Kinesis Data Firehose Invoke Lambda Function On Demand

Lambda Behind the Scenes

  • $ per GB/sec, 100ms increments
  • Containers on EC2
  • Created on demand
  • Reaped when idle, old or obsolete

Structure of Lambda

event – event data passed to handler

context – runtime information to your handler. Type is LambdaContext

Handler can return a value, depends on invocation type

Stocks App

Implementation using standard Python

Lambda Function Python

import json

def handler(event, context):

Convert to Lambda

API Gateway


aws lambda update-function-code --function-name getStocks --zip-file fileb://

Lambda Versioning

  • Creates new version
  • $LATEST is current version
  • Previous versions immutable
  • Publish via AWS Console, CLI, or SDK


Testing Function

Lambda is just plain function call, so nosetests with asserts would work fine.

Using python-lambda-local

python-lambda-local is a library for running a lambda locally

python-lambda-local -f handler -t 5 event.json	


Localstack Services

API Gateway, Kinesis, DynamoDB, DynamoDB Streams, Elasticsearch, S3, Firehose, Lambda, SNS, SQS, Redshift, ES (Elasticsearch Service), SES, Route53, CloudFormation, CloudWatch, SSM, SecretsManager


Extension to CloudFormation, makes it easier to deploy without having to understand CF templates

Lambda Frameworks

Apex -- offers support for Clojure and Rust




Q & A

Andrew Lombardi / @kinabalu

Mystic Coders, LLC