Slide 1

Slide 1 text

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Matt Williams - Evangelist @ Datadog Monitoring, Hold the Infrastructure Getting the Most from AWS Lambda

Slide 2

Slide 2 text

The Plan Learn about the basics of AWS Lambda Add AWS Lambda to your infrastructure Monitoring 101 (the tl;dr version) Monitoring AWS Lambda

Slide 3

Slide 3 text

What is AWS Lambda The next stage in a long progression... physical boxes virtual machines on physical boxes containers lambda AWS instances

Slide 4

Slide 4 text

Important AWS Lambda Concepts TRIGGER BASED

Slide 5

Slide 5 text

Important AWS Lambda Concepts STATELESS STATELESS

Slide 6

Slide 6 text

Important AWS Lambda Concepts SERVERLESS AS FAR AS YOU ARE CONCERNED

Slide 7

Slide 7 text

Important AWS Lambda Concepts Each event will trigger a new Lambda function There is a safety limit per region of 100 (contact support for changes)

Slide 8

Slide 8 text

What is a AWS Lambda Function • Your executable code • No restrictions • Priced based on execution time, quantity, and memory

Slide 9

Slide 9 text

What can trigger AWS Lambda? Files Amazon S3 Database Updates Amazon DynamoDB Streams Amazon Kinesis Messages Amazon SNS, Amazon SES User Data & Authentication Amazon Cognito Infrastructure Changes AWS CloudFormation Logs, Events, Metrics Amazon CloudWatch IoT Echo, Amazon API Gateway

Slide 10

Slide 10 text

Lambda Lambda Lambda Lambda $goad

Slide 11

Slide 11 text

http://benchling.engineering/crispr-aws-lambda/

Slide 12

Slide 12 text

Other Examples Bittorrent Tracker Hugely scalable using S3 https://blog.zappa.io/posts/zappa-bittorrent- tracker Chat Bots Easy to build https://claudiajs.com/claudia-bot-builder.html S3 Data Loading Simpler than the typical Kinesis process https://www.trek10.com/blog/serverless- architectures-s3-data-loading/ Skills for the Amazon Echo Make one today in the hall

Slide 13

Slide 13 text

Best Practices from AWS Write stateless code Local vars Permissions Minimize startup Monitor Delete old functions

Slide 14

Slide 14 text

Adding AWS Lambda to your infrastructure

Slide 15

Slide 15 text

How to Create a AWS Lambda Function 1.Write the code 2.Setup on AWS 3.Debug

Slide 16

Slide 16 text

AWS Lambda Demo

Slide 17

Slide 17 text

Frameworks node-lambda

Slide 18

Slide 18 text

Native Gotchas Lambda runs on an Amazon Linux container …and your dev box probably isn’t Amazon Linux… …so native NPM modules are problematic

Slide 19

Slide 19 text

Native npm 1. Launch an Amazon Linux ec2 2. Use a node version manager 3. Install node 4.3 4. Install the native modules you need 5. Package the modules and dl to your box 6. Deploy

Slide 20

Slide 20 text

Building the demo with node-lambda Four files: • package.json • .env • event.json • index.js

Slide 21

Slide 21 text

Monitoring 101 the tl;dr version

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Collecting data is cheap

Slide 25

Slide 25 text

Collecting data is cheap; Not having it when you need it can be expensive

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

Monitoring AWS Lambda

Slide 34

Slide 34 text

What are the AWS Lambda Metrics aws.lambda.duration, min, max, sum aws.lambda.errors aws.lambda.invocations aws.lambda.throttles

Slide 35

Slide 35 text

Three Options for Monitoring AWS Lambda 1. Add a custom metric to CloudWatch 2. Add metric directly to monitoring application 3. Add a line to the CloudWatch logs

Slide 36

Slide 36 text

How Datadog Does It Add line to CloudWatch logs: MONITORING|unix_epoch_timestamp|value|type| my.metric.name|#tag1:value,tag2

Slide 37

Slide 37 text

Monitoring example

Slide 38

Slide 38 text

Monitoring example

Slide 39

Slide 39 text

Monitoring example

Slide 40

Slide 40 text

Monitoring example

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

Matt Williams Evangelist - Datadog [email protected] @technovangelist Twitter: @list