Programming AWS Lambda: Build and Deploy Serverless Applications with Java [1 ed.] 149204105X, 9781492041054

Serverless revolutionizes the way organizations build and deploy software. With this hands-on guide, Java engineers will

343 28 12MB

English Pages 278 Year 2020

Report DMCA / Copyright

DOWNLOAD PDF FILE

Table of contents :
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

Programming AWS Lambda: Build and Deploy Serverless Applications with Java [1 ed.]
 149204105X, 9781492041054

  • Commentary
  • Vector PDF
  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Recommend Papers