Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Scale your Node App, Forget the Infrastructure ...

Scale your Node App, Forget the Infrastructure - Next Steps with Lambda

Serverless, and specifically AWS Lambda, is the new hotness. Getting started is pretty easy, but getting past the basics can be a bit rough. This session goes past the getting started stage and continues with real life architectural learnings about how to make amazing applications on Lambda.

Matt Williams

June 01, 2017
Tweet

More Decks by Matt Williams

Other Decks in Technology

Transcript

  1. Scale your Node Application, Forget the Infrastructure Taking the Next

    Step with AWS Lambda Matthew Williams Evangelist @ Datadog mattw@datadoghq.com | @technovangelist DevOpsDays Boston Organizer
  2. The plan § Introduction § Coding § Debugging § Orchestration

    § Lambda Setup § Deployment § Monitoring
  3. Introduction to Lambda • Key Concepts • Serverless • Stateless

    • Trigger-based • What a Lambda Function is • Your executable code (Nodejs 4.3/6.10, C#, Java, Python) • No restrictions • Priced based on execution time and memory
  4. Available Lambda Triggers • S3 • DynamoDB • Kinesis Streams

    • Simple Notification Service • Simple Email Service • Cognito • CloudFormation • CloudWatch Logs • CloudWatch Events • CodeCommit • Scheduled Events (powered by CloudWatch Events) • Echo • Lex • API Gateway • Invoked via the AWS CLI/APIs
  5. Check if data exists Most probably stateless BUT…container could be

    reused Check if data exists in /tmp (500MB) If using a database, look into context.callbackWaitsForEmptyEventLoop
  6. Use Modules with Local Harness • All the logic should

    be in Modules • The Handler should just be a minimal wrapper • Why? • Easier to run tests on the code • Easier to run locally with a local harness
  7. Minimal but Specific Security • Your IAM roles should allow

    the minimum privileges • If you only need to read, don’t also allow write
  8. What are the Lambda Metrics aws.lambda.duration, min, max, sum aws.lambda.errors

    aws.lambda.invocations aws.lambda.iterator_age aws.lambda.throttles aws.lambda.deadlettererrors
  9. Three options for monitoring Lambda 1. Add a custom metric

    to CloudWatch 2. Add metric directly to monitoring application 3. Add a line to the CloudWatch logs
  10. Scale your Node Application, Forget the Infrastructure Taking the Next

    Step with AWS Lambda Matthew Williams Evangelist @ Datadog mattw@datadoghq.com | @technovangelist DevOpsDays Boston Organizer