Building Serverless Architectures

Book description

Build scalable, reliable, and cost-effective applications with a serverless architecture

About This Book

  • Design a real-world serverless application from scratch
  • Learn about AWS Lambda function and how to use Lambda functions to glue other AWS Services
  • Use the Java programming language and well-known design patterns. Although Java is used for the examples in this book, the concept is applicable across all languages
  • Learn to migrate your JAX-RS application to AWS Lambda and API Gateway

Who This Book Is For

This book is for developers and software architects who are interested in designing on the back end. Since the book uses Java to teach concepts, knowledge of Java is required.

What You Will Learn

  • Learn to form microservices from bigger Softwares
  • Orchestrate and scale microservices
  • Design and set up the data flow between cloud services and custom business logic
  • Get to grips with cloud provider's APIs, limitations, and known issues
  • Migrate existing Java applications to a serverless architecture
  • Acquire deployment strategies
  • Build a highly available and scalable data persistence layer
  • Unravel cost optimization techniques

In Detail

Over the past years, all kind of companies from start-ups to giant enterprises started their move to public cloud providers in order to save their costs and reduce the operation effort needed to keep their shops open. Now it is even possible to craft a complex software system consisting of many independent micro-functions that will run only when they are needed without needing to maintain individual servers.

The focus of this book is to design serverless architectures, and weigh the advantages and disadvantages of this approach, along with decision factors to consider. You will learn how to design a serverless application, get to know that key points of services that serverless applications are based on, and known issues and solutions.

The book addresses key challenges such as how to slice out the core functionality of the software to be distributed in different cloud services and cloud functions. It covers basic and advanced usage of these services, testing and securing the serverless software, automating deployment, and more.

By the end of the book, you will be equipped with knowledge of new tools and techniques to keep up with this evolution in the IT industry.

Style and approach

The book takes a pragmatic approach, showing you all the examples you need to build efficient serverless applications.

Publisher resources

Download Example Code

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. Errata
      3. Piracy
      4. Questions
  2. Getting Started with Serverless
    1. Preparing the environment
      1. Installing AWS CLI
        1. Prerequisites
    2. Gradle
      1. Creating the project
      2. Implementing the Lambda Dependency
      3. Hello Lambda!
      4. Deploying to the Cloud
    3. Summary
    4. Bibliography
  3. Infrastructure as a Code
    1. Uploading the artifacts to Cloud
    2. Infrastructure as Code with CloudFormation
    3. Deploying our first Lambda with CloudFormation
    4. Summary
  4. Hello Internet
    1. Setting up API Gateway
      1. Creating the API
      2. Creating the resource
      3. Creating the method
      4. Configuring Lambda permissions
      5. Deploying the API
    2. Setting up the CloudFront CDN distribution
      1. Setting up the custom domain
      2. Creating an SSL certificate
      3. Authenticating API calls
      4. Implementing basic authorization
    3. Summary
  5. Applying Enterprise Patterns
    1. Creating User Service
    2. Configuring Guice
    3. Writing the Lambda Handler class with injected dependency
    4. Adding logging
    5. Service dependencies
    6. Summary
  6. Persisting Data
    1. Introduction to DynamoDB
    2. Creating the first table
      1. Creating the second table for access tokens
      2. Configuring the DynamoDB data mapper
      3. Configuring environment variables for Lambda
      4. User registration
      5. Creating user registration Lambda
      6. Creating the Lambda and API Gateway for User Registration
    3. Summary
  7. Building Supporting Services
    1. Writing the foundation of a Lambda function
    2. Letting users upload to S3
      1. Modifying the Lambda function to respond to an S3 event
      2. Configuring CloudFront to serve resized images
      3. Excercise
    3. Sending emails via SES
      1. Configuring SES
      2. Firing an SNS notification upon user registration
    4. Consuming the SNS message and sending emails
      1. Integrating a messaging queue
    5. Summary
  8. Searching Data
    1. Creating the search domain
    2. Uploading test data
    3. Creating the suggester
    4. Creating the API endpoint for suggestions
    5. Lambda function for updating search data
      1. Modifying the welcome mail sender Lambda
      2. Creating the Lambda function to update CloudSearch
      3. Creating and configuring the Lambda function with CloudFormation
    6. Summary
  9. Monitoring, Logging, and Security
    1. Setting up a Route53 health check
      1. Starting off with the setup
      2. Configuring health checks for email notifications
      3. Enabling SMS notifications for health checks
      4. Bringing health check to healthy mode
      5. Mastering CloudWatch alarms
      6. Configuring advanced CloudWatch alarms
    2. Wrapping everything up in CloudFormation
    3. Creating CloudWatch metrics from application logs
    4. Running Lambda functions in VPC
      1. Creating a VPC
      2. Adding private subnets
      3. Handling inbound and outbound traffic
      4. Creating a Security Group
    5. Summary
  10. Lambda Framework
    1. Getting to know Lambda Framework
    2. Summary

Product information

  • Title: Building Serverless Architectures
  • Author(s): Cagatay Gurturk
  • Release date: July 2017
  • Publisher(s): Packt Publishing
  • ISBN: 9781787129191