DevOps for Serverless Applications

Book description

Set up complete CI and CD pipelines for your serverless applications using DevOps principles

Key Features

  • Understand various services for designing serverless architecture
  • Build CD pipelines using various cloud providers for your serverless applications
  • Implement DevOps best practices when building serverless applications

Book Description

Serverless applications are becoming very popular among developers and are generating a buzz in the tech market. Many organizations struggle with the effective implementation of DevOps with serverless applications. DevOps for Serverless Applications takes you through different DevOps-related scenarios to give you a solid foundation in serverless deployment.

You will start by understanding the concepts of serverless architecture and development, and why they are important. Then, you will get to grips with the DevOps ideology and gain an understanding of how it fits into the Serverless Framework. You'll cover deployment framework building and deployment with CI and CD pipelines for serverless applications. You will also explore log management and issue reporting in the serverless environment. In the concluding chapters, you will learn important security tips and best practices for secure pipeline management.

By the end of this book, you will be in a position to effectively build a complete CI and CD delivery pipeline with log management for serverless applications.

What you will learn

  • Explore serverless fundamentals and effectively combine them with DevOps
  • Set up CI and CD with AWS Lambda and other popular Serverless service providers with the help of the Serverless Framework
  • Perform monitoring and logging with serverless applications
  • Set up a dynamic dashboard for different service providers
  • Discover best practices for applying DevOps to serverless architecture
  • Understand use cases for different serverless architectures

Who this book is for

DevOps for Serverless Applications is for DevOps engineers, architects, or anyone interested in understanding the DevOps ideology in the serverless world. You will learn to use DevOps with serverless and apply continuous integration, continuous delivery, testing, logging, and monitoring with serverless.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. DevOps for Serverless Applications
  3. Dedication
  4. Packt Upsell
    1. Why subscribe?
    2. packt.com
  5. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  6. 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
  7. Introducing Serverless
    1. Introduction to serverless
    2. Core concept
      1. Backend as a Service
      2. Function as a Service
      3. AWS Lambda
      4. Azure Functions
      5. Google Functions
      6. OpenWhisk
        1. Other serverless architectures
      7. Serverless benefits
        1. Faster time to market
        2. Highly scalable
        3. Low cost
        4. Latency and geolocation improvement
      8. Serverless drawbacks
        1. Increased complexity
        2. Lack of tooling
        3. Complexity with architecture
        4. Drawback in implementation
      9. DevOps with serverless
    3. Summary
  8. Understanding Serverless Frameworks
    1. ClaudiaJS
      1. Command-line library
      2. API builder library 
      3. Bot builder library
    2. Apex
    3. Zappa
    4. Serverless Framework
      1. Framework features 
        1. Services and deployment
        2. Functions and events
        3. Variables and plugins
        4. Resources
      2. Setting up AWS access keys 
      3. Installation of Serverless Framework
      4. Lambda service and function deployment
      5. Invoking locally
      6. Deploying and invoking locally 
    5. Summary
  9. Applying DevOps to AWS Lambda Applications
    1. Manual deployment of a Lambda function
    2. AWS Lambda with DevOps
      1. Serverless frameworks with AWS CodePipeline
      2. Continuous integration and continuous deployment with Lambda
      3. Setting up Jenkins for a serverless application
        1. Automated testing for Lambda functions
          1. Unit testing a deployed application
      4. AWS Lambda pipeline
        1. Prerequisites
      5. Deployment methods
        1. Canary deployment
          1. Setting up a simple environment 
          2. Setting up canary deployment 
          3. Making sure the deployment works fine
          4. Deploying CodeDeploy hooks 
        2. Blue-green deployment
      6. Integration of CloudWatch with ELK
    3. Summary
  10. DevOps with Azure Functions
    1. Building a simple Azure function
    2. Implementing continuous integration and continuous delivery with Azure Functions
      1. Continuous integration with Azure Functions
        1. Prerequisites
    3. Setting up environment variables
    4. Continuous deployment to Azure Functions
      1. Setting up a continuous deployment Azure deployment tool
    5. Blue-green deployment in Azure Functions
    6. The deployment dashboard
    7. Monitoring and logging
      1. Accessing logs through Kudu
      2. Logging information via table storage
      3. Monitoring the Azure Function
    8. Integrating with New Relic
    9. Best practice
      1. Source code management
        1. Folder structure
        2. Testing and static code analysis
        3. Deployment and release
    10. Summary
  11. Integrating DevOps with IBM OpenWhisk
    1. OpenWhisk
      1. OpenWhisk setup and configuration
        1. Triggers
        2. Actions
        3. Rules
        4. Sequences
      2. Building an OpenWhisk application
        1. Creating a hello world OpenWhisk action
        2. OpenWhisk with Serverless Framework
          1. A simple OpenWhisk application
      3. Continuous integration and continuous delivery with OpenWhisk
        1. Setting up the toolchain and repository integration
        2. Configuring the deployment
        3. Continuous integration and continuous delivery with Serverless Framework
      4. Continuous delivery pipeline to OpenWhisk
      5. Deployment patterns with OpenWhisk
        1. Canary deployment
        2. Blue–green deployment
      6. Dynamic dashboard
        1. Activity Summary
        2. Activity Timeline
        3. Activity Log
      7. OpenWhisk action logging management
        1. Setting up ELK
        2. OpenWhisk actions
        3. OpenWhisk log forwarder
    2. Summary
  12. DevOps with Google Functions
    1. CI and CD pipelines with Google Functions
      1. Prerequisites for Cloud Functions
      2. Cloud Functions through the GCP console
      3. Cloud Function using a gcloud command line
      4. Building and testing locally
      5. CI and CD with testing
        1. Source code management
        2. Continuous integration and testing
        3. Continuous delivery with Google Functions
        4. Google environments
    2. Monitoring and logging
    3. Best practice
    4. Summary
  13. Adding DevOps Flavor to Kubeless
    1. What is Kubeless?
      1. Kubeless architecture
    2. How to set up Kubeless
      1. Setting up continuous integration and deployment
        1. Creation of the service
        2. Deploying the function
        3. Invoking the function
        4. Serverless logs
      2. Continuous integration with Jenkins
      3. Monitoring Kubeless
      4. Kubeless pros and cons
    3. Summary 
  14. Best Practices and the Future of DevOps with Serverless
    1. Important aspects of DevOps
      1. Collaboration and tools strategy
      2. Agile development
      3. Version control everything
      4. Capture every request 
      5. Automate test and source code analysis
      6. Continuous feedback
      7. Time to market and the cycle time
      8. Log metrics
    2. Best practices for Serverless
      1. One function, one task
      2. Functions call other functions
      3. Minimize libraries
      4. With HTTP –  one function per route
      5. Database connection to RDBMS
      6. Use messages and queues
      7. Data in motion
      8. Measure the scale
    3. DevOps best practices and troubleshooting for AWS Lambda
      1. Source code versioning
      2. Build
      3. Test
        1. Unit testing
        2. Integration testing 
        3. Performance testing
        4. Monitoring
        5. Deployment
        6. Logging
        7. Security 
          1. An IAM role per function
          2. No long-lived credentials
          3. Do not persist secrets
          4. Lambda in VPC
      4. AWS Lambda best practices
        1. Keep the handler independent of business logic 
        2. Keep warm containers alive 
        3. Dependency control
        4. Shorter timeout for dependencies
        5. Exception handling
        6. Recursive coding
        7. High availability
        8. Runtime language
        9. Code for cold and warm containers
        10. Cost optimizing 
      5. Best practices for Azure functions
        1. Avoid large and long-running functions
        2. Cross-function communication
        3. functions should be be stateless
        4. functions is defensive
        5. The same function app should not have code for test and production
        6. Use asynchronous code, but avoid blocking calls
        7. Configure host behaviors to better handle concurrency
      6. Best practices for Google Functions
        1. Code idempotent functions
        2. Signal the completion of function calls
        3. Do not start background activities
        4. Always delete temporary files
        5. Local development
        6. Error reporting
        7. Use SendGrid to send emails
        8. Use dependencies wisely
        9. Use global variables to reuse objects in future invocations
        10. Do lazy initialization of global variables
    4. Summary
  15. Use Cases and Add-Ons
    1. AWS Lambda use cases and add-ons
      1. AWS Lambda use cases
        1. Serverless website
        2. Video and image processing
        3. Logs Processing and notification
        4. Controlling the IoT
        5. Backup and daily tasks
        6. Continuous integration and continuous deployment
        7. Monitoring
      2. Static website
      3. Warm-up
    2. Azure Functions add-ons
    3. Google Functions add-ons
    4. Summary
  16. DevOps Trends with Serverless Functions
    1. The impact of Serverless on Ops
    2. The direction of DevOps with serverless
    3. Summary
  17. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: DevOps for Serverless Applications
  • Author(s): Shashikant Bangera
  • Release date: September 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781788623445