Chapter 3. Programming AWS Lambda Functions

This chapter is about digging into what it means to build Lambda functions—what do they look like, how do you configure how they run, and how do you specify your own environmental configuration. You’ll learn about these topics by examining core concepts for Lambda execution environments, input and output, timeout, memory and CPU, and finally, how Lambda uses environment variables for application configuration.

To start, let’s take a look at how Lambda functions are executed. Grab your hiking boots—it’s time to explore.

Core Concepts: Runtime Model, Invocation

In Chapter 2, you created a Java class, uploaded it to the Lambda service somewhere in the nebulous “cloud,” and magically were able to execute that code. You didn’t have to consider operating systems, containers, startup scripts, deployment of the code to an actual host, or JVM settings. Nor did you think about any of those pesky “servers.” So how did your code execute?

To understand this, you need to first understand the basics of the Lambda execution environment, as shown in Figure 3-1.

images/ch03_image01.png
Figure 3-1. The Lambda execution environment

The Lambda Execution Environment

As we mentioned in Chapter 2 (see “Installing the AWS CLI”), both AWS management and function operations (often referred to as the control plane and data plane, respectively) make extensive use of APIs. Lambda is ...

Get Programming AWS Lambda now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.