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