Skip to main content

Day 34: Create a Lambda Function Using CLI

100 Days of Cloud (AWS)

Published 1 min readMarkdown
Part of series100 Days of Cloud (AWS)
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.

About the author

  • I'm Zin Lin Htet. Who love to learn and share about Linux, Cloud, Docker and K8s. Currently working as a DevOps Engineer at one of the famous Fintech Company in Myanmar.

No comments yet. Be the first to comment.

100 Days of Cloud (AWS)

Part 34 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 nextDay 35: Deploying and Managing Applications on AWS100 Days of Cloud (AWS)

More from this blog