O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Mastering AWS Lambda

Book Description

Build cost-effective and highly scalable Serverless applications using AWS Lambda.

About This Book

  • Leverage AWS Lambda to significantly lower your infrastructure costs and deploy out massively scalable, event-driven systems and applications
  • Learn how to design and build Lambda functions using real-world examples and implementation scenarios
  • Explore the Serverless ecosystem with a variety of toolsets and AWS services including DynamoDB, API Gateway, and much more!

Who This Book Is For

If you are a Cloud administrator and/or developer who wishes to explore, learn, and leverage AWS Lambda to design, build, and deploy Serverless applications in the cloud, then this is the book for you! The book assumes you have some prior knowledge and hands-on experience with AWS core services such as EC2, IAM, S3, along with the knowledge to work with any popular programming language such as Node.Js, Java, C#, and so on.

What You Will Learn

  • Understand the hype, significance, and business benefits of Serverless computing and applications
  • Plunge into the Serverless world of AWS Lambda and master its core components and how it works
  • Find out how to effectively and efficiently design, develop, and test Lambda functions using Node.js, along with some keen coding insights and best practices
  • Explore best practices to effectively monitor and troubleshoot Serverless applications using AWS CloudWatch and other third-party services in the form of Datadog and Loggly
  • Quickly design and develop Serverless applications by leveraging AWS Lambda, DynamoDB, and API Gateway using the Serverless Application Framework (SAF) and other AWS services such as Step Functions
  • Explore a rich variety of real-world Serverless use cases with Lambda and see how you can apply it to your environments

In Detail

AWS is recognized as one of the biggest market leaders for cloud computing and why not? It has evolved a lot since the time it started out by providing just basic services such as EC2 and S3 and today; they go all the way from IoT to Machine Learning, Image recognition, Chatbot Frameworks, and much more! One of those recent services that is also gaining a lot of traction is AWS Lambda! Although seemingly simple and easy to use, Lambda is a highly effective and scalable compute service that provides developers with a powerful platform to design and develop Serverless event-driven systems and applications.

The book begins with a high-level introduction into the world of Serverless computing and its advantages and use cases, followed by a deep dive into AWS Lambda! You’ll learn what services AWS Lambda provides to developers; how to design, write, and test Lambda functions; as well as monitor and troubleshoot them. The book is designed and accompanied with a vast variety of real-world examples, use cases, and code samples that will enable you to get started on your Serverless applications quickly.

By the end of the book, you will have gained all the skills required to work with AWS Lambda services!

Style and approach

This step-by-step guide will help you build Serverless applications and run Serverless workloads using the AWS Lambda service. You’ll be able to get started with it in a matter of minutes with easy-to-follow code snippets and examples.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Preface
    1. What this book covers
    2. What you need for this book
    3. Who this book is for
    4. Conventions
    5. Reader feedback
    6. Customer support
      1. Downloading the example code
      2. Downloading the color images of this book
      3. Errata
      4. Piracy
      5. Questions
  2. Introducing AWS Lambda
    1. What is serverless computing?
      1. Pros and cons of serverless computing
    2. Introducing AWS Lambda
      1. How it works
    3. Getting started with AWS Lambda
      1. Using the AWS Management Console
      2. Using the CLI
    4. Pricing and limitations
    5. Planning your next steps
    6. Summary
  3. Writing Lambda Functions
    1. The Lambda programming model
      1. Handler
      2. The context object
      3. Logging
      4. Exceptions and error handling
    2. Versioning and aliases
      1. Environment variables
    3. Packaging and deploying
      1. APEX
      2. Claudia.js
    4. Recommendations and best practices
    5. Planning your next steps
    6. Summary
  4. Testing Lambda Functions
    1. The need for testing Lambda function
      1. Manually testing your functions with the AWS Management Console
      2. Testing functions with Mocha and Chai
      3. Testing functions using the npm modules
    2. Testing with a simple serverless test harness
    3. Recommendations and best practices
    4. Planning your next steps
    5. Summary
  5. Event-Driven Model
    1. Introducing event-driven architectures
    2. Understanding events and AWS Lambda
      1. Lambda architecture patterns
    3. Exploring Lambda and event mapping
      1. Mapping Lambda with S3
      2. Mapping Lambda with DynamoDB
      3. Mapping Lambda with SNS
      4. Mapping Lambda with CloudWatch events
      5. Mapping Lambda with Kinesis
        1. Creating the Kinesis Stream
        2. Setting up the log streaming
        3. Packaging and uploading the function
    4. Planning your next steps
    5. Summary
  6. Extending AWS Lambda with External Services
    1. Introducing Webhooks
    2. Integrating GitHub with AWS Lambda
    3. Integrating Slack with AWS Lambda
    4. Invoking Lambda using an external application
    5. Planning your next steps
    6. Recommendations and best practices
    7. Summary
  7. Build and Deploy Serverless Applications with AWS Lambda
    1. Introducing SAM
      1. Writing SAM templates
        1. AWS::Serverless::Function
        2. AWS::Serverless::Api
        3. AWS::Serverless::SimpleTable
      2. Building serverless applications with SAM
    2. Introducing AWS step functions
      1. Under the hood
      2. Getting started with step functions
      3. Building distributed applications with step functions
    3. Planning your next steps
    4. Summary
  8. Monitoring and Troubleshooting AWS Lambda
    1. Monitoring Lambda functions using CloudWatch
    2. Introducing AWS X-Ray
    3. Monitoring Lambda functions using Datadog
    4. Logging your functions with Loggly
    5. Recommendations and best practices
    6. Summary
  9. Introducing the Serverless Application Framework
    1. What is the Serverless Framework?
      1. Getting started with the Serverless Framework
      2. Working with the Serverless Framework
    2. Recommendations and best practices
    3. Summary
  10. AWS Lambda - Use Cases
    1. Infrastructure management
      1. Scheduled startup and shutdown of instances
      2. Periodic snapshots of EBS volumes using Lambda
      3. Enabling governance using EC2 tags and Lambda
    2. Data transformation
    3. Summary
  11. Next Steps with AWS Lambda
    1. Processing content at the edge with Lambda@Edge
    2. Building next generation chatbots with Lambda and Lex
    3. Processing data at the edge with Greengrass and Lambda
    4. Introducing Snowball Edge
    5. Summary