Skip to main content

Command Palette

Search for a command to run...

Day 34: Create a Lambda Function Using CLI

100 Days of Cloud (AWS)

Updated
1 min read
Day 34: Create a Lambda Function Using CLI

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.

100 Days of Cloud (AWS)

Part 17 of 50

In this series you will learn how to configure and manage cloud resources using AWS. My intention is to provide an explanation and share the answers for 100 Days of Cloud (AWS) from KodeKloud.

Up next

Day 33: Create a Lambda Function

100 Days of Cloud (AWS)