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

Hands-On Serverless Computing

Book Description

Deploy functions efficiently using different cloud-based serverless offerings

Key Features

  • Understand the concept of Function-as-a-Service
  • Implement Serverless solutions using AWS Lambda, Azure Functions and Google Cloud Functions
  • Practical approach towards choosing the best tool for your serverless environment

Book Description

Serverless applications and architectures are gaining momentum and are increasingly being used by companies of all sizes. Serverless software takes care of many problems that developers face when running systems and servers, such as fault tolerance, centralized logging, horizontal scalability, and deployments.

You will learn how to harness serverless technology to rapidly reduce production time and minimize your costs, while still having the freedom to customize your code, without hindering functionality. Upon finishing the book, you will have the knowledge and resources to build your own serverless application hosted in AWS, Microsoft Azure, or Google Cloud Platform, and will have experienced the benefits of event-driven technology for yourself.

This hands-on guide dives into the basis of serverless architectures and how to build them using Node.js as a programming language, Visual Studio Code for code editing, and Postman for quickly and securely developing applications without the hassle of configuring and maintaining infrastructure on three public cloud platforms.

What you will learn

  • Understand the benefts of serverless computing and know when to use it
  • Develop serverless applications on AWS, Azure, and Google Cloud
  • Get to grips with Function as a Service (FaaS)
  • Apply triggers to serverless functions
  • Build event-driven apps using serverless frameworks
  • Use the Node.js programming language to build serverless apps
  • Use code editors, such as Visual Studio Code, as development environments
  • Master the best development practices for creating scalable and practical solutions

Who this book is for

This book is targeted towards developers, system administrators or any stakeholder working in the Serverless environment and want to understand how functions work.

Basic idea of serverless architecture can be an added advantage

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 files e-mailed directly to you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Hands-On Serverless Computing
  3. Dedication
  4. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  5. Foreword
  6. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  7. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  8. What is Serverless Computing?
    1. What is serverless computing?
      1. Serverless and event-driven collision
    2. What is FaaS?
      1. State
      2. Execution duration
      3. Understanding cold start 
      4. API gateway
    3. The benefits of serverless computing
      1. Reduced operational cost
      2. Rapid development
      3. Scaling costs
      4. Easier operational management
      5. Easier packaging and deployment
      6. Time to market
    4. What serverless computing is not
      1. Comparison with PaaS
      2. Comparison with containers
      3. #NoOps
    5. Limits to serverless computing
      1. Infrastructure control
      2. Long running application
      3. Vendor lock-in
      4. Cold start
      5. Shared infrastructure
      6. Server optimization is a thing of the past
      7. Security concerns
      8. Deployment of multiple functions
      9. Limited number of testing tools
    6. Summary
  9. Development Environment, Tools, and SDKs
    1. Development environment and tools
    2. Visual Studio Code
      1. Setting up Visual Studio Code
        1. Hardware
        2. Platforms
        3. Additional Windows requirements
        4. Additional Linux requirements
      2. Installing on macOS
      3. Launching VS Code from the Command Line
      4. Manually adding Visual Studio Code to your path
        1. Touch Bar support
      5. Installing on Linux
        1. Debian and Ubuntu-based distributions
        2. RHEL, Fedora, and CentOS-based distributions
        3. openSUSE and SLE-based distributions
        4. AUR package for Arch Linux
        5. Nix package for NixOS (or any Linux distribution using Nix package manager)
        6. Installing the .rpm package manually
      6. Installing on Windows
        1. Icons are missing
          1. Why are some icons not appearing in the workbench and editor?
      7. Visual Studio Code User Interface
        1. Basic layout
        2. Side-by-side editing
          1. Explorer window
          2. Keyboard shortcuts
    3. Node.js
      1. Node Package Manager
        1. Node.js installation
          1. Installation steps
        2. Node.js tutorial in VS Code
        3. Running Hello Readers
        4. Integrated Terminal
    4. Postman
      1. Installation
      2. Installing on macOS
      3. Installing on Windows
      4. Linux installation
        1. Updating Postman – native app (macOS, Windows, and Linux)
        2. Postman Echo
      5. Sending the first request using Postman
        1. How does this work in Postman?
    5. SDKs
      1. AWS Node.js SDK
      2. Installation
      3. Configuration
      4. Microsoft Azure Node.js SDK
        1. Installation
        2. Configuration/Authentication
      5. Google Cloud Node.js SDK
        1. Installation
      6. Configuration/authentication
    6. Summary
  10. Getting Started with AWS Lambda
    1. What is AWS Lambda?
      1. How does AWS Lambda work?
      2. Use cases
        1. Web apps
        2. IOT and mobile backends
        3. Extract, Transform, Load (ETL)
        4. Data processing
        5. Real-time processing
      3. Execution environment
        1. Environment variables
        2. Execution context
    2. AWS Lambda Function–Hello World
      1. Function code – configuration
      2. Publishing and testing your changes
    3. Configuring options for AWS Lambda
      1. Memory configuration
      2. Execution time configuration
      3. Network configuration
      4. Function versioning and aliases
      5. Traffic Shifting using aliases
      6. Environment variables
    4. Securing AWS Lambda using IAM
      1. Authenticating
      2. Access control
      3. Identity-based policies (IAM policies)
      4. Resource-based policies (Lambda function policies)
      5. AWS Lambda permissions model
    5. Summary
  11. Triggers and Events for AWS Lambda
    1. Triggers for AWS Lambda
      1. API Gateway Trigger
      2. AWS IoT Trigger
        1. IoT Button
        2. IoT rule
      3. Alexa trigger
      4. CloudFront trigger
      5. CloudWatch trigger
        1. CloudWatch Events
        2. CloudWatch Logs
      6. CodeCommit Trigger
      7. Cognito Trigger
      8. Scheduled Events Trigger
      9. AWS Config Trigger
      10. DynamoDB Trigger
      11. Kinesis Trigger
        1. Amazon Kinesis Data Streams
        2. Amazon Kinesis Data Firehose
      12. S3 Trigger
      13. SNS Trigger
    2. Summary
  12. Your First Serverless Application on AWS
    1. Technical requirements
    2. Your first serverless app (using the AWS Console)
      1. Creating a function
      2. Testing the function
      3. Updating the function
      4. Publishing a new version
      5. Creating an alias for a Lambda function
    3. Your first serverless app (using the AWS SAM)
      1. Creating a function
      2. AWS SAM
      3. Creating a SAM template for your serverless app
      4. Testing a serverless app locally
      5. Publishing a serverless app
        1. Packaging a serverless app
        2. Deploying a serverless app
    4. Summary
  13. Serverless Orchestration on AWS
    1. What is AWS Step Functions?
      1. How does AWS Step Functions work?
        1. App using sequential steps
        2. App using branching steps
        3. App using parallel steps
        4. Operational visibility
      2. Creating your first state machine 
      3. State machine using Lambdas
    2. Summary
  14. Getting Started with Azure Functions
    1. An introduction to Azure Functions
      1. Azure serverless platform
        1. Compute
        2. Database
        3. Storage
        4. Messaging
        5. Security
        6. Orchestration
        7. API Management
        8. Azure Function Proxies
        9. Analytics
    2. Azure portal 
      1. Dashboards
      2. Azure Cloud Shell
      3. Azure Functions console
    3. Configuring Azure Functions
      1. Function app settings
        1. Runtime
        2. Deployment slots
        3. Hosting plan
        4. Consumption plan
        5. App Service plan
        6. Authorization keys
        7. Platform features
          1. Application settings
          2. SSH
          3. Kudu – Advanced tools
          4. API Definition
    4. Summary
  15. Triggers and Bindings for Azure Functions
    1. Azure Function triggers and bindings
      1. Example binding and trigger
    2. Azure services–triggers and bindings
      1. Azure Blob storage
        1. Trigger
        2. Bindings
    3. Azure Cosmos DB
      1. Trigger
    4. Azure Event Grid
    5. HTTP and webhook bindings
      1. HTTP trigger
      2. Webhook trigger
    6. Timer trigger
    7. Summary
  16. Your First Serverless Application on Azure
    1. Technical requirements
    2. Your first serverless app (using the Azure portal)
      1. Creating an HTTP trigger-based function
      2. Testing Azure Functions
      3. Managing Azure Functions
        1. Triggers and bindings
        2. Authorization level
        3. Function and host keys
        4. Monitoring your Azure Function
        5. Function proxies
      4. Generating automation script
    3. Your first Serverless app (using Azure Functions Core Tools)
      1. Azure Functions Core Tools
        1. macOS
        2. Windows
        3. Visual Studio Code
      2. Create a local Azure Function app
      3. Create a local Azure Function
      4. Publishing the local Azure Function app
    4. Summary
  17. Getting Started with Google Cloud Functions
    1. Google Cloud Serverless Platform
      1. Application development
        1. Google App Engine
        2. Google Cloud Functions
      2. Analytics and Machine Learning
      3. An Introduction to Google Cloud Functions
    2. Google Cloud Console
      1. Creating a Google Cloud project
      2. Google Cloud Project Dashboard
      3. Google Cloud Shell
      4. Google Cloud Functions Console
      5. Access Control using IAM
        1. Cloud Functions runtime service account
        2. Cloud Functions Service account
        3. Creating a Google Cloud Functions user
    3. Configuring Google Cloud Functions
      1. Types of Google Cloud Functions
      2. Configuration options
    4. Summary
  18. Triggers and Events for Google Cloud Functions
    1. Technical requirements
    2. Events
      1. Event parameter
    3. Triggers
      1. Google Cloud Storage
      2. Google Cloud Pub/Sub
      3. HTTP triggers
        1. Handing different HTTP methods
    4. Summary
  19. Your First Serverless Application on Google Cloud
    1. Technical requirements
    2. Your first serverless app (using the Google Cloud Console)
      1. Creating a Google Cloud Function
      2. Testing a Google Cloud Function
        1. Testing using Postman
      3. Viewing logs for Google Cloud Functions
    3. Your first serverless app (on a local workstation)
      1. gcloud CLI
        1. What is gcloud?
        2. Installing gcloud
          1. macOS
          2. Windows
        3. gcloud beta commands
        4. Initializing the gcloud CLI
      2. Creating a Google Cloud Function
      3. Deploying a Google Cloud Function
    4. Summary
  20. Reference Architecture for a Web App
    1. Technical requirements
    2. Reference architecture
      1. Friendly domain name
      2. SSL/TLS certificate
      3. Amazon API Gateway + AWS Lambda
      4. Amazon DynamoDB
    3. Hotel search
      1. Lambda Function + API Gateway
      2. Amazon DynamoDB
    4. Add to cart
      1. Lambda Function + API Gateway
      2. Amazon DynamoDB
    5. Summary
  21. Reference Architecture for a Real-time File Processing
    1. Technical requirements
    2. Reference architecture
      1. S3 bucket
      2. Amazon Simple Notification Service
      3. AWS Lambda
    3. Photo processing application
      1. Three Lambda functions
      2. S3 Bucket + Amazon SNS
    4. Summary
  22. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think