Hands-on AWS content is highly valuable for practical learning.
As part of AWS Hands-on Topics covering all major AWS services, today will start with ā¦
AWS Lambda: Build & Deploy Your First Function.
Step 1: Prerequisites
Before starting, ensure to have:
ā
An AWS Free Tier account
ā
AWS CLI installed and configured (aws configure)
ā
IAM user with Lambda permissions
ā
Node.js or Python installed (for function development)
Step 2: Create an IAM Role for Lambda
AWS Lambda needs execution permissions.
1ļøā£ Go to IAM ā Roles ā Create Role
2ļøā£ Select AWS service ā Lambda ā Click "Next"

3ļøā£ Attach the following permissions:
AWSLambdaBasicExecutionRole
AWSLambdaVPCAccessExecutionRole (if using VPC)

4ļøā£ Name the role (e.g., LambdaExecutionRole) and create it.
Step 3: Create an AWS Lambda Function (Console)
1ļøā£ Open AWS Lambda in the AWS Management Console
2ļøā£ Click Create Function
3ļøā£ Select Author from Scratch
4ļøā£ Function Name: hello-world-lambda
5ļøā£ Runtime: Choose Python 3.13
6ļøā£ Execution Role: Select the IAM Role created earlier
7ļøā£ Click Create Function

Step 4: Write Your First Lambda Function
If using Python:
Replace the default code with:
import json
def lambda_handler(event, context):
return {
"statusCode": 200,
"body": json.dumps("Hello from AWS Lambda!")
}

Click Deploy
Step 5: Test Your Lambda Function
1ļøā£ Click on Test

2ļøā£ Configure a new test event with { "key": "value" }
3ļøā£ Click Test again
ā
You should see "Hello from AWS Lambda!" in the response
Step 6: Clean Up Resources
To avoid unnecessary AWS charges: delete lambda function
CLI command:
aws lambda delete-function --function-name hello-world-lambda
š¾šš£šš§šš©šš”šš©šš¤ššØ! šš¤š ššŖšš© ššššš© & ššš„šš¤ššš šš¤šš§ ššš§šš© š¼š¾š ššš¢ššš ššŖšššššš£!
Other things, we can do with AWS Lambda
ā Invoke Lambda Function via AWS CLI
Run the following command:
aws lambda invoke --function-name hello-world-lambda output.json
Check output.json to see the response.
ā Trigger Lambda with API Gateway
To invoke Lambda via HTTP:
1ļøā£ Go to AWS API Gateway
2ļøā£ Create a REST API
3ļøā£ Create a new resource & method (GET)
4ļøā£ Integrate it with Lambda Function
5ļøā£ Deploy the API ā Get the Invoke URL
6ļøā£ Test via browser or Postman