AWS Lambda
AWS Lambda is a leading FaaS platform provided by AWS. It allows developers to run their code in response to events without having to manage or provision servers. Lambda supports multiple programming languages including Python, Java, Node.js, C#, and Go. It offers seamless integration with other AWS services, enabling developers to build complex and event-driven applications. Lambda functions are triggered by events such as API calls, file uploads, database changes, and messaging system events. Here’s an example of creating an AWS Lambda function using the AWS Management Console:
- Sign in to the AWS Management Console:
Go to the AWS Management Console (https://aws.amazon.com/console/) and sign in with your AWS account. - Create a Lambda function:
I. Click on Services at the top of the page, then select Lambda from the Compute section.
II. Click on the Create function button.
III. Choose the Author from scratch option.
IV. Fill in the required details:
• Function name: Give your Lambda function a name (e.g., MyLambdaFunction).
• Runtime: Choose the runtime environment for your function (e.g., Node.js, Python, Java, etc.).
• In the Permissions section, you can choose an existing execution role or create a new one. Execution roles define the permissions that the Lambda function has when interacting with other AWS services.
V. Click on the Create function button to create your Lambda function. - Write the Lambda function code:
In the function editor, you can write the code for your Lambda function based on the selected runtime.
Here is an example (Node.js):
javascriptexports.handler = async (event, context) => { console.log("Lambda function executed!"); return { statusCode: 200, body: JSON.stringify({ message: "Hello from AWS Lambda!" }), };};
- Test the Lambda function:
You can test your Lambda function using the Test button in the AWS Lambda console. You can create sample test events or use test data to check the function’s behavior. - Configure a trigger (optional):
Lambda functions can be triggered by various events, such as HTTP requests, file uploads, database changes, and so on. You can set up triggers in the Add trigger section of the Lambda function configuration.
For example, to create an HTTP trigger, you can use API Gateway as the trigger. - Deploy the Lambda function:
Once your Lambda function is working as expected, click on the Deploy button to deploy the latest changes. - Test the Lambda function in action:
If you have set up a trigger, test your Lambda function by invoking the trigger event. For example, if it’s an HTTP trigger, use the provided URL to make an HTTP request.
That’s it! You have successfully created an AWS Lambda function and tested it with a trigger (if applicable). Your Lambda function is now ready to be used and will execute whenever the defined trigger conditions are met. The following figure depicts the use of Lambda functions in an AWS environment. It shows how the function interacts with DynamoDB and S3 storage bucket:

Figure 3.2 – Lambda function in an AWS environment