Day 34: Create a Lambda Function Using CLI
100 Days of Cloud (AWS)

Welcome from Day 34. Today we will learn how to create a lambda function using cli. In this lab you just need to create a Lambda function using cli not from AWS management console.








vi lambda_function.py
def lambda_handler(event, context):
return {
"statusCode": 200,
"body": "Welcome to KKE AWS Labs!"
}
zip function.zip lambda_function.py
aws iam get-role --role-name lambda_execution_role
aws lambda create-function --function-name xfusion-lambda-cli --runtime python3.9 --role arn:aws:iam::123456789012:role/lambda_execution_role --handler lambda_function.lambda_handler --zip-file fileb://function.zip
aws lambda invoke --function-name xfusion-lambda-cli response.json
Congratulations you did it. It looks good. This lab was successfully completed without any errors. See you in day 35. If you have any issues please let me know I will be happy to assist you. Stay tuned and learn together. If you find my article useful, please kindly like and share it.




