AWS lambda documentation change
Summary
Restructured and rephrased core Lambda concepts documentation. Changes include renaming sections (e.g., 'Triggers and event source mappings' to 'Events and triggers'), emphasizing function handlers, consolidating permissions/roles content, and removing redundant explanations about event objects.
Security assessment
The changes are primarily editorial improvements and content reorganization. While permissions/roles are security-adjacent, there's no evidence of addressing specific vulnerabilities or adding new security features. The mention of 'security updates and patches' in runtimes was already present in previous documentation.
Diff
diff --git a/lambda/latest/dg/concepts-basics.md b/lambda/latest/dg/concepts-basics.md index 835739b3b..c56ec9ebb 100644 --- a//lambda/latest/dg/concepts-basics.md +++ b//lambda/latest/dg/concepts-basics.md @@ -5 +5 @@ -Lambda functionsLambda execution environment and runtimesTriggers and event source mappingsThe event objectLambda permissions +Lambda functions and function handlersLambda execution environment and runtimesEvents and triggersLambda permissions and roles @@ -7 +7 @@ Lambda functionsLambda execution environment and runtimesTriggers and event sour -# Understanding basic Lambda concepts +# How Lambda works @@ -9 +9 @@ Lambda functionsLambda execution environment and runtimesTriggers and event sour -Because Lambda is a serverless, event-driven compute service, it uses a different programming paradigm to traditional web applications. If you’re new to Lambda or serverless development, the following sections describe some key foundational concepts that will help you get started on your learning path. As well as an explanation of each concept, the sections also contain links to tutorials, detailed documentation, and other resources you can use to broaden your understanding on each topic. +Lambda functions are the basic building blocks you use to build Lambda applications. To write functions, it's essential to understand the core concepts and components that make up the Lambda programming model. This section will guide you through the fundamental elements you need to know to start building serverless applications with Lambda. @@ -11 +11 @@ Because Lambda is a serverless, event-driven compute service, it uses a differen -On this page, you'll learn about the following: + * **Lambda functions and function handlers** \- A Lambda function is a small block of code that runs in response to events. functions are the basic building blocks you use to build applications. Function handlers are the entry point for event objects that your Lambda function code processes. @@ -13 +13 @@ On this page, you'll learn about the following: - * **Lambda functions** \- the basic building blocks of Lambda you use to build applications + * **Lambda execution environment and runtimes** \- Lambda execution environments manage the resources required to run your function. Run times are the language-specific environments your functions run in. @@ -15 +15 @@ On this page, you'll learn about the following: - * **Lambda runtimes** \- the language-specific environments that your functions run in + * **Events and triggers** \- how other AWS services invoke your functions in response to specific events. @@ -17,5 +17 @@ On this page, you'll learn about the following: - * **Triggers and event source mappings** \- ways for other AWS services to invoke your functions in response to specific events - - * **The event object** \- a JSON object containing event data for your function to process - - * **Lambda permissions** \- the way you control which other AWS services your functions can interact with and who can access your functions + * **Lambda permissions and roles** \- how you control who can access your functions and what other AWS services your functions can interact with. @@ -30 +26,3 @@ If you want to start by understanding serverless development more generally, see -## Lambda functions +## Lambda functions and function handlers + +In Lambda, **functions** are the fundamental building blocks you use to create applications. A Lambda function is a piece of code that runs in response to events, such as a user clicking a button on a website or a file being uploaded to an Amazon Simple Storage Service (Amazon S3) bucket. You can think of a function as a kind of self-contained program with the following properties. A Lambda **function handler** is the method in your function code that processes events. When a function runs in response to an event, Lambda runs the function handler. Data about the event that caused the function to run is passed directly to the handler. While the code in a Lambda function can contain more than one method or function, Lambda functions can only have one handler. @@ -32 +30 @@ If you want to start by understanding serverless development more generally, see -In Lambda, _functions_ are the fundamental building blocks you use to create applications. A Lambda function is a piece of code that runs in response to events, such as a user clicking a button on a website or a file being uploaded to an Amazon Simple Storage Service (Amazon S3) bucket. You can think of a function as a kind of self-contained program with the following properties. +To create a Lambda function, you bundle your function code and its dependencies in a deployment package. Lambda supports two types of deployment package, [.zip file archives](./configuration-function-zip.html) and [container images](./images-create.html). @@ -43,6 +40,0 @@ In Lambda, _functions_ are the fundamental building blocks you use to create app -When a function runs in response to an event, Lambda runs the function’s _handler_ function. Data about the event that caused the function to run is passed directly to the handler. While the code in a Lambda function can contain more than one method or function, Lambda functions can only have one handler. - -To create a Lambda function, you bundle your function code and its dependencies in a _deployment package_. Lambda supports two types of deployment package, [.zip file archives](./configuration-function-zip.html) and [container images](./images-create.html). - -To get a better understanding of Lambda functions, we recommend you start by completing the [Create your first Lambda function](./getting-started.html) tutorial, if you haven’t done so already. This tutorial provides more detail about the handler function and how to pass data in and out of your function. It also provides an introduction to creating function logs. - @@ -57,9 +49 @@ For managed runtimes, Lambda automatically applies security updates and patches -## Triggers and event source mappings - -Although you can invoke a Lambda function manually using the AWS Command Line Interface (AWS CLI) or by using the Lambda API, it's more usual in a production application for your function to be invoked by another AWS service in response to a particular event. For example, you might want a function to run whenever an item is added to an Amazon DynamoDB table. - -To configure a function to run in response to a specific event, you add a _trigger_. When you create a trigger, other AWS services can invoke your function directly by pushing an _event object_ to Lambda whenever a particular event occurs. A function can have multiple triggers, each of which invokes your function independently. - -Some types of stream and queue service, such as Amazon Kinesis or Amazon Simple Queue Service (Amazon SQS), can't directly invoke Lambda using a trigger. For these services, you need to create an _[event source mapping](./invocation-eventsourcemapping.html)_ instead. Event source mappings are a special type of Lambda resource that continuously polls a stream or queue to check for new events. For example, an event source mapping might poll an Amazon SQS queue to check whether new messages have been added. Lambda batches new messages into a single payload until a limit that you configure is reached, and then invokes your function with a single event object containing all the records in the batch. - -The easiest way to create a trigger or event source mapping is by using the Lambda console. Although the underlying resources that Lambda creates and the way that your function is invoked are different, the process for creating a trigger or event source mapping in the console uses the same method. +## Events and triggers @@ -67 +51 @@ The easiest way to create a trigger or event source mapping is by using the Lamb -To see an example of a trigger in action, start by carrying out the [Using an Amazon S3 trigger to invoke a Lambda function](./with-s3-example.html) tutorial, or for a general overview of using triggers and instructions on creating a trigger using the Lambda console, see [Invoking Lambda with events from other AWS services](./lambda-services.html). +You can also invoke a Lambda function directly by using the Lambda console, [AWS CLI](https://aws.amazon.com/cli/), or one of the [AWS Software Development Kits (SDKs)](https://aws.amazon.com/developer/tools/). It's more usual in a production application for your function to be invoked by another AWS service in response to a particular event. For example, you might want a function to run whenever an item is added to an Amazon DynamoDB table. @@ -69,7 +53 @@ To see an example of a trigger in action, start by carrying out the [Using an Am -## The event object - -Lambda is an event-driven compute service. This means that your code runs in response to events generated by external producers. Event data is passed to your function as a JSON-formatted document, which the runtime converts to an object for your code to process. For example, in Python, the runtime converts a JSON object to a Python dictionary and passes this to the function as the `event` input argument. - -When the event is generated by another AWS service, the format of the event depends on the service that generates it. For example, an event Amazon S3 includes the name of the bucket that triggered your function and information about objects in that bucket. To learn more about the format of the events generated by different AWS services, refer to the relevant chapters in [Invoking Lambda with events from other AWS services](./lambda-services.html). - -You can also invoke a Lambda function directly by using the Lambda console, [AWS CLI](https://aws.amazon.com/cli/), or one of the [AWS Software Development Kits (SDKs)](https://aws.amazon.com/developer/tools/). When you invoke a function directly, you determine the format and contents of the JSON event. For example, suppose you have a Lambda function that writes weather data to a database. You might define the following JSON format for your event. As with events generated by other AWS services, the Lambda runtime converts this JSON to an object before passing it to your function's handler. +To make your function respond to events, you set up a **trigger**. A trigger connects your function to an event source, and your function can have multiple triggers. When an event occurs, Lambda receives event data as a JSON document and converts it into an object that your code can process. You might define the following JSON format for your event and the Lambda runtime converts this JSON to an object before passing it to your function's handler. @@ -94,11 +72 @@ You can also invoke a Lambda function directly by using the Lambda console, [AWS -Because the Lambda runtime converts the event to an object, you can easily assign values in the event to variables without having to deserialize the JSON. The following example code snippets show how to assign the minimum temperature value from the previous example event to a variable `MinTemp` using the Python and Node.js runtimes. In both cases, the event object is passed to your function's handler function as an argument named `event`. - -###### Example Python code snippet - - - MinTemp = event['WeatherData']['TemperaturesF']['MinTempF'] - -###### Example Node.js code snippet - - - let MinTemp = event.WeatherData.TemperaturesF.MinTempF; +Stream and queue services like Amazon Kinesis or Amazon SQS, Lambda uses an **event source mapping** instead of a standard trigger. Event source mappings poll the source for new data, batch records together, and then invoke your function with the batched events. @@ -106 +74 @@ Because the Lambda runtime converts the event to an object, you can easily assig -For an example of invoking a Lambda function with a custom event, see [Create your first Lambda function](./getting-started.html). +To understand how a trigger works, start by completing the [Use an Amazon S3 trigger](./with-s3-example.html) tutorial, or for a general overview of using triggers and instructions on creating a trigger using the Lambda console, see [Integrating other services](./lambda-services.html). @@ -108 +76 @@ For an example of invoking a Lambda function with a custom event, see [Create yo -## Lambda permissions +## Lambda permissions and roles @@ -151 +119 @@ To use the Amazon Web Services Documentation, Javascript must be enabled. Please -Key Lambda concepts +What is AWS Lambda? @@ -153 +121 @@ Key Lambda concepts -Programming model +Running code