This skill helps to walk you through the Creation of AWS Lambda function by step by step assistance. AWS Lambda is an event-driven, serverless computing platform provided by Amazon as a part of Amazon Web Services. It is a computing service that runs code in response to events and automatically manages the computing resources required by that code. AWS Lambda is a compute service that lets you run code without provisioning or managing servers.
Prerequisites:
- An active AWS account
- Sufficient privileges to create Lambda function
Note:
Login to AWS Management Console beforehand.
-
1.
open AWS Management Console
-
2.
To create a simple Lambda Function to execute “Hello World” program with Python, Click “Services”
-
3.
Click Compute
-
4.
Click Lambda
-
5.
Click Functions
-
6.
Click Create function
-
7.
Type your Lambda Function Name and click Next to continue.
-
8.
Under Runtime, select Python (any 3.x version). # Function Runtime: A runtime is a version of a programming language or framework that you can use to write Lambda functions. Lambda supports runtime versions for Node.js, Python, Ruby, Go, Java, C# (.NET Core), and PowerShell (.NET Core) Click Next to continue.
-
9.
Expand "Change default execution role"
-
10.
Choose "Create a new role with basic Lambda permissions" and click Next to continue.
-
11.
Click on "Create function"
-
12.
Copy the below code and replace the existing code in the BOX at the below right side pane. ``` import json def lambda_handler(event, context): # TODO implement print("Hello, World!") return { 'statusCode': 200, 'body': json.dumps('Hello from Lambda!') } ``` Click Next to continue.
-
13.
Press Next and Click 'File'
-
14.
Click Save
-
15.
Click down arrow beside Test.
-
16.
Click "Configure test event" # Test Event A test event is a JSON object that mocks the structure of requests emitted by AWS services to invoke a Lambda function. Use it to see the function’s invocation result.
-
17.
Give Test Event Name and click Next to continue. Ex. MyEventName
-
18.
Click Save
-
19.
Click Deploy
-
20.
Click Test
-
21.
Check Your Test Result in Execution Results Tab under **Function logs** at the below right pane. Click Close to Finish.