Programming AWS Lambda: Build and Deploy Serverless Applications with Java

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Serverless revolutionizes the way organizations build and deploy software. With this hands-on guide, Java engineers will learn how to use their experience in the new world of serverless computing. You’ll discover how this cloud computing execution model can drastically decrease the complexity in developing and operating applications while reducing costs and time to market.

Engineering leaders John Chapin and Mike Roberts guide you through the process of developing these applications using AWS Lambda, Amazon’s event-driven, serverless computing platform. You’ll learn how to prepare the development environment, program Lambda functions, and deploy and operate your serverless software. The chapters include exercises to help you through each aspect of the process.

  • Get an introduction to serverless, functions as a service, and AWS Lambda
  • Learn how to deploy working Lambda functions to the cloud
  • Program Lambda functions and learn how the Lambda platform integrates with other AWS services
  • Build and package Java-based Lambda code and dependencies
  • Create serverless applications by building a serverless API and data pipeline
  • Test your serverless applications using automated techniques
  • Apply advanced techniques to build production-ready applications
  • Understand both the gotchas and new opportunities of serverless architecture

Author(s): John Chapin, Mike Roberts
Edition: 1
Publisher: O'Reilly Media
Year: 2020

Language: English
Commentary: Vector PDF
Pages: 278
City: Sebastopol, CA

Copyright
Table of Contents
Foreword
Preface
About This Book
Why We Wrote This Book
Who This Book Is For
Why You Need This Book
Using the End-of-Chapter Exercises
Conventions Used in This Book
Using Code Examples
O’Reilly Online Learning
How to Contact Us
Acknowledgments
Chapter 1. Introduction to Serverless, Amazon Web Services, and AWS Lambda
A Quick History Lesson
The Cloud Grows
Enter Serverless
Backend as a Service
Functions as a Service
Differentiating Serverless
What Is AWS?
Types of Service
Capacity
Who Uses AWS?
How Do You Use AWS?
What Is AWS Lambda?
Functions as a Service
FaaS as Implemented by Lambda
Why Lambda?
What Does a Lambda Application Look Like?
AWS Lambda in the Java World
Summary
Exercises
Chapter 2. Getting Started with AWS Lambda
Quick Guide to the AWS Console
Regions
Identity and Access Management
Lambda Hello World (as Quickly as Possible)
Setting Up Your Development Environment
AWS Command Line Interface
Java Setup
AWS SAM CLI Installation
Lambda Hello World (the Proper Way)
Creating Your First Java Lambda Project
Building Hello World
Creating the Lambda Function
Summary
Exercises
Chapter 3. Programming AWS Lambda Functions
Core Concepts: Runtime Model, Invocation
The Lambda Execution Environment
Invocation Types
Introduction to Logging
Input, Output
Lambda Function Method Signatures
Configuring the Handler Function in the SAM Template
Basic Types
Lists and Maps
POJOs and Ecosystem Types
Streams
Context
Timeout
Memory and CPU
Environment Variables
Summary
Exercises
Chapter 4. Operating AWS Lambda Functions
Build and Package
Uberjars
Assembling a ZIP File
Reproducible Builds
Deploy
Infrastructure as Code
CloudFormation and the Serverless Application Model
Security
The Principle of Least Privilege
Identity and Access Management
Summary
Exercises
Chapter 5. Building Serverless Applications
Lambda Event Sources
Writing Code to Work with Input and Output for Event Sources
Configuring a Lambda Event Source
Understanding Different Event Source Semantics
Example: Building a Serverless API
Behavior
Architecture
Lambda Code
Build and Package Using the AWS SDK BOM
Infrastructure
Deployment
Example: Building a Serverless Data Pipeline
Behavior
Architecture
Lambda Code
Build and Package Using Multiple Modules and Isolated Artifacts
Infrastructure
Deployment
Summary
Exercises
Chapter 6. Testing
The Test Pyramid
Unit Tests
Functional Tests
End-to-End Tests
Refactoring for Testing
Revisiting BulkEventsLambda
Refactoring BulkEventsLambda
Add Constructors
Isolate Side Effects
Split Methods
Testing BulkEventsLambda
Unit Testing
Functional Testing
End-to-End Testing
Local Cloud Testing
Cloud Test Environments
Summary
Exercise
Chapter 7. Logging, Metrics, and Tracing
Logging
CloudWatch Logs
LambdaLogger
Java Logging Frameworks
Structured Logging
Structured Logging in Java
CloudWatch Logs Insights
Metrics
CloudWatch Metrics
Lambda Platform Metrics
Business Metrics
Alarms
Distributed Tracing
Finding Errors
Summary
Exercises
Chapter 8. Advanced AWS Lambda
Error Handling
Classes of Error
The Various Behaviors of Lambda Error Processing
Deep Dive into Asynchronous Event Source Errors
Handling Kinesis and DynamoDB Stream Errors
Tracing Errors with X-Ray
Error Handling Strategies
Scaling
Observing Lambda Scaling
Scaling Limits and Throttling
Thread Safety
Vertical Scaling
Versions and Aliases, Traffic Shifting
Lambda Versions
Lambda Aliases
Traffic Shifting
When (Not) to Use Versions and Aliases
Cold Starts
What Is a Cold Start?
When Does a Cold Start Occur?
Identifying Cold Starts
Impact of Cold Starts
Mitigating Cold Starts
Provisioned Concurrency
Cold Start Summary
State
Persistent Application State
Caching
Lambda and Java Application Frameworks
Virtual Private Clouds
Architectural Concerns of Using Lambda with a VPCs
Configuring Lambda to Use a VPC
Alternatives
Layers and Runtimes
What Are Layers?
When to Use, and Not Use, Layers
Custom Runtimes
Summary
Exercises
Chapter 9. Advanced Serverless Architecture
Serverless Architecture “Gotchas”
At-Least-Once Delivery
Impacts of Lambda Scaling on Downstream Systems
The “Fine Print” of Lambda Event Sources
New Patterns of Architecture Enabled by Serverless Thinking
Published Components with the Serverless Application Repository
Globally Distributed Applications
Summary
Exercises
Chapter 10. Conclusion
Index
About the Authors
Colophon