Introduction to Azure Functions and Amazon Lambda
Guido García · @palmerabollo · 2016
no idle infrastructure
– Homer Simpson
single responsibility
software that fits in your head
Amazon Lambda
Azure Functions (preview)
Google Cloud Functions (alpha)
IBM OpenWhisk
Hook.io
Iron.io
module.exports = (context, req) => {
context.done(null, "Hello World");
};
grouped in app
console
def lambda_handler(event, context):
return "Hello World"
# raise Exception('Something went wrong')
exports.handler = (event, context, callback) => {
callback(null, 'Hello World');
// callback(new Error('Something went wrong'));
};
python
nodejs
webapp: static + dynamic
object storage processing
(transcoding, ocr, image processing...)
aka storlets
use a management tool (DDIY)
heartbeat = keep it warm
more memory = increase CPU allocation
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
MySimpleFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs4.3
CodeUri: s3://<bucket>/MyCode.zip
MemorySize: 1024
Timeout: 15
Events:
MyUploadEvent:
Type: S3
Properties:
Id: !Ref Bucket
Events: Create
Bucket:
Type: AWS::S3::Bucket
AWS SAM Example