In this lesson, we walk through a complete demonstration of working with AWS Lambda. You will learn how to create a Lambda function from scratch, test it, review its configuration and permissions, and finally clean up by deleting the function. This guide is ideal for developers looking to get started with serverless computing on AWS.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
Creating a Lambda Function
Begin by logging into the AWS Management Console and searching for “Lambda.” Click on the Create Function button to start. AWS Lambda provides several options for authoring your function:- Author from scratch – Create a simple “hello world” example.
- Use a blueprint – Leverage sample code and pre-configurations.
- Use a container image – Deploy your containerized application as a Lambda function.


Function Code Overview
Once the function is created, you will be presented with an overview screen displaying its configuration and triggers (for example, API Gateway or load balancer events). In the code editor section, you will typically find a default file (such asindex.js for Node.js projects).
Below is an example of a simple handler function:
event parameter contains details about the invoking trigger, which can include payloads, query parameters, or path parameters.
When invoking your Lambda function from various sources, always inspect the event object to understand the source and details of the invocation.
Testing Your Lambda Function
AWS Lambda allows you to easily test your function directly from the console without setting up the actual trigger. To test your function:- Click the Test button.
- Create a new test event by assigning a name (e.g., “API Gateway Test”) and select an event template. AWS provides pre-defined templates that mimic events from various sources like API Gateway, SNS, or SQS.
Reviewing Configuration and Monitoring
General Configuration
Under the Configuration tab, you can review and adjust various settings including:- Memory allocation: e.g., 128 MB
- Ephemeral storage size
- Timeout settings: defaults are 3 seconds (maximum 15 minutes)
- Execution IAM role details

Monitoring and CloudWatch Logs
AWS Lambda automatically collects CloudWatch metrics such as invocation counts, execution duration, and error rates. To access the logs:- Click View CloudWatch logs from the Lambda console.
- This action will redirect you to the corresponding log group in CloudWatch, where you can explore individual log streams.

console.log. For instance, after adding a log statement:



Reviewing Permissions
Within the Configuration tab, examine the IAM role associated with your Lambda function. By default, AWS creates an IAM role with permissions to write logs to CloudWatch. An example of such a policy is:
Deleting the Lambda Function
After testing or if you need to free up resources, deleting your Lambda function is straightforward. From the Lambda console:- Click on Actions.
- Select Delete function.
- Confirm the deletion when prompted.

This demonstration has provided you with the fundamentals of creating, testing, monitoring, and managing an AWS Lambda function. With these skills, you can further explore advanced integrations and configurations to scale your serverless applications. For additional resources and detailed guides on AWS Lambda, consider visiting the AWS Lambda Documentation.