Amazon Lambda: Create Lambda Function
Last updated
Last updated
This guide will help you to quickly connect to Amazon Lambda and create a sample Lambda functions as a prerequisite to integrate Amazon Lambda to VoiceWorx.
An active AWS Account
You should have an active AWS Account. If you do not have it, you can create an AWS account at https://portal.aws.amazon.com/billing/signup#/start
AWS Accounts Include 12 Months of Free Tier Access
To proceed with these steps, you should have all the pre-requisites satisfied. If you are missing something, please go back and make sure you satisfy all of them.
Once done, you can now proceed with the following process.
Login to your AWS console in https://console.aws.amazon.com using your AWS credentials.
Search for Lambda in the search bar and click on Lambda Service.
You will be directed to the AWS Lambda dashboard.
Click on Create Function. Fill in the following details:
You will be now directed to the following screen to change the code and configuration of the lambda function.
Now replace the text in the text editor with following value:
The resulting screen will be something like this.
import json
def lambda_handler(event, context):
# TODO implement
if(event["name"] == "kiran"):
return {
'name': 'Kiran',
'phone': '9429020115',
'country': 'India'
}
if(event["name"] == "rose"):
return {
'name': 'Rose',
'phone': '(512) 757-6001',
'country': 'USA'
}
if(event["name"] == "sean"):
return {
'name': 'Sean',
'phone': '(512) 757-6002',
'country': 'UK'
}
if(event["name"] == "Jack"):
return {
'name': 'Jack',
'phone': '(512) 757-7001',
'country': 'Ca'
}
return "Not found"
{ "name": "rose" }
10. Now Click on Deploy and then Test. The sample response is also shown in below:
11. Now that you have successfully created AWS Lambda function, you can use this with VoiceWorx integration to build custom Apps. Follow this document to integrate Amazon Lambda with VoiceWorx.
8. To ensure that the function is working. Click on Test. Provide a test name and provide following sample value in the test. Click on Create.
Select Author from Scratch
Function Name: ContactFinder
Runtime: Python 3.8
Architecture: x86_64
Click on Create Function