Javascript on AWS Lambda: How to use Node.js in a serverless architecture
ASIN: B08MWM7SLK
Publication date: November 5, 2020
Language 语言: English
File size: 6559 KB
Print Length 页数: 93 pages
by Tamás Sallai(Author)
Book Description
By finelybook
This books helps you bring what you already know — programming in Javascript with Node.Js — to AWS Lambda.
Developing serverless applications is frustrating at first. Up until the “Hello world” everything is easy, but then a lot of small differences come to the surface. Things like why some requests are way slower than others, how to set the available memory, and why a sensible timeout is important. These are the results of how the Lambda execution environment works, and it is markedly different from running Node.Js on a server.
And it’s not just how the function is run, but also what other services it interacts with. CloudWatch and Logs, IAM, and API Gateway, not to mention a database most functions will use. It’s overwhelming at first.
This book systematically walks you through the configuration options and gives just the right amount of background information so that you’ll know what parts are important. With it, you’ll be able to set up your Lambda functions using best practices and avoid the common problems.
You’ll:
* Understand how the Lambda execution environment works
* Learn how to write Javascript serverless functions
* And walk away with knowledge about debuggers and HTTP APIs
Table of contents
Introduction
Chapter 1: The Lambda execution model
Serverless functions
Limits
The cost model
At-least-once execution
Caching in /tmp
Cold start
Memory
Chapter 2: Setup
Node versions
The Lambda permission model
How to define code
Inline code
File interpolation
Adding packages with npm
Handler argument
Chapter 3: Programming model
Async handler
Async programming patterns
Background tasks
Input and output
The event object
The context object
Output
The AWS SDK
Pagination
Environment variables
Timeout
Cause of timeouts
Mitigating timeouts
AWS SDK timeouts
Promise-based timeout handling
Chapter 4: Debugging
Logging
X-Ray
Custom segments
Chapter 5: Other topics
Storing secrets
Using SSM
Caching
Cache time
HTTP API
OpenAPI backend
Request parameters
Special handlers
Express backend