Amazon Lambda Create Lambda Function

Managed Connection - Amazon Lambda

VoiceWorx.ai

[Kiran Suthar]

Table of Contents

Objective 3

Pre-requisites 3

Steps 3

Create Lambda Function 3

Objective

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.

Pre-requisites

  • 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

Steps

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.

Create Lambda Function

  1. Login to your AWS console in https://console.aws.amazon.com using your AWS credentials.

  2. Search for Lambda in the search bar and click on Lambda Service.

  1. You will be directed to the AWS Lambda dashboard.

  1. Click on Create Function. Fill in the following details:

Select Author from Scratch

Function Name: ContactFinder

Runtime: Python 3.8

Architecture: x86_64

Click on Create Function

  1. You will be now directed to the following screen to change the code and configuration of the lambda function.

  1. Now replace the text in the text editor with following value:

  2. 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.

Last updated