Amazon Aurora (MySQL)

Objective

Amazon Aurora is MySQL and PostgreSQL-compatible relational database (RDS) built for the cloud. Performance and availability of commercial-grade databases at 1/10th the cost.

This guide will help you to quickly connect to Amazon Aurora and create various methods to pull the data. The purpose is to demonstrate how easy it is to integrate an external database to the VoiceWorx platform.

You can get a brief introduction on Amazon Aurora here.

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

  • At least one Amazon Aurora Instance

If you do not have any Aurora DB instance, you can create one quickly.

On clicking Create database, you will be redirected to following screen. Make sure you select the Amazon Aurora Engine type and also MYSQL compatibility has been turned on by clicking on ‘Amazon Aurora with MySQL Compatibility’.

Fill the Credentials Settings.

The Aurora Instance should support remote connection, which can be done by making it publicly accessible.

Once the instance is saved, The Voiceworx IP should be whitelisted so a connection can be established from the voiceworx platform to the Amazon Aurora RDS instance.

Depending upon your requirement, you have to whitelist the external platform to be able to read/write to that instance. For VoiceWorx, we are setting up for both Reader and Writer instance.

Click on the newly created DB instance and follow the following steps:

Let’s first whitelist VoiceWorx for Writer Instance. Click on the Writer Instance and click on Connectivity and Security tab. Now, follow following steps to modify the inbound rules.

The screenshot below shows the “Connectivity and Security” settings explaining this:

You will be presented with the list of security groups.

Edit the inbound rules for the security group.

When you click on security group (as shown in above screenshot), you will be taken to the security group screen and you should see inbound rules as shown in below screenshot.

To whitelist VoiceWorx IPs, click on Add Rule and fill up following details.

  • A VoiceWorx Account

For steps to create a VoiceWorx account, follow the steps at https://docs.voiceworx.ai/general/voiceworx-create-account

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 are ready to get started using VoiceWorx platform with Amazon Aurora.

Step 1 Connect to Amazon Aurora

Login to the VoiceWorx portal at https://portal.voiceworx.ai

To Configure DynamoDB, browse to: Integration > Connect System > Connect External System in the VoiceWorx platform and select options as shown below.

Once you click on “Connect System” button, you will be redirected to the configuration screen where you need to provide connection information as shown below.

If you do not have this information ready, please refer to the pre-requisites #3

The table below explains each of the inputs shown on this screen.

Fill the required information and click on “Validate and Save Settings” button, this will validate the details and if it is correct, integration will be saved, and you will be redirected to the integrations listing page as shown below.

Step 2 Create an App for Amazon DynamoDB

To create an app, browse to Custom Apps > Manage Apps and click on Create New Custom App button as shown below.

You should see a small popup as shown below.

Click on save, this will create an app and you should see a screen as shown below,

This shows that an app is successfully created, and you have various options like setup data sources. This is explained in next step.

Step 3 Create a Data Source

To follow this step, make sure you have completed above Step 2. If not please go back and do it.

A Data Source connects the app with the DynamoDB integration we did in Step #1. Once you have an app created, you can go o Data Sources by either clicking on “Data Source” button or by clicking on “Data Sources” tab.

Now you should see screen as shown below.

To create a data source, click on ‘Create New Data Source’ button and you should see a popup screen as shown below

Give a name of your choice and make sure you select the DynamoDB integration that you have created in Step 1 and click on Save. Now you should see a Data Source created as shown in below screenshot.

once a data source is created, you are ready to start creating various methods.

Step 4 Create Methods to fetch the data from Amazon DynamoDB

To use this step, make sure you have completed previous step. If not go back and complete it.

Methods allows you to fetch data from the DynamoDB table. To access the methods, click on the “Methods” tab which is next to the “Data Sources” tab.

As of the publication date of this document, the VoiceWorx platform supports following DynamoDB methods,

  1. Get Tables

  2. Get All Items

  3. Get Item

  4. Get Items

  5. Put Item

  6. Post Item

  7. Delete Item

Depending on requirement, you will have to use an appropriate method, this document will explain each of these methods with an example.

Let’s start with a use case.

Scenario/ Use Case (Contact Finder):

You have a DynamoDB table which is used to store all the contacts in your organization. If you are using this for personal use, then consider that table contains contact details of your friends and family members.

You want to find email address of your friend Sam. For this, you can use GetItems method as explained below.

Method: GetItems

This method requires two parameters as explained below.

Parameters:

Other than these two parameters, you need to provide the following standard inputs

Sample Response:

[

{

"id": 2,

"Name": "Mike",

"PhoneNumber": "123-456-1234"

}

]

Method: GetTables

Create new method

Parameters: Not required

Sample Response:

[

{

"TableName": "Contacts"

}

]

Method: GetAllItems

Parameters:

Sample Response:

[

{

"id": "3",

"PhoneNumber": "(785) 241-6200",

"Name": "Andy Young"

},

{

"id": "2",

"PhoneNumber": "(512) 757-6000",

"Name": "Sean"

},

{

"id": "9",

"PhoneNumber": "(512) 757-6000",

"Name": "Rose Gonzalez"

}

]

Method: GetItem

Parameters:

Sample Response:

{

"id": "1",

"PhoneNumber": "(336)222-7000",

"Name": "Jack Rogers"

}

Method: PutItem

Parameters:

Sample Response:

{

"id": "5",

"PhoneNumber": "(503) 421-7800",

"Name": "Josh Davis"

}

Method: PostItem

Parameters:

Sample Response:

{

"id": "5",

"PhoneNumber": "(503) 421-7800",

"Name": "Josh Davis"

}

Method: DeleteItem

Parameters:

Sample Response:

{"response": "Delete Successful"}

From here, you can now proceed to create intents, slots, inputs and then finally publish to VoiceWorx supported publish channels. You can refer to this document for further assistance to build and publish App in VoiceWorx. You can test your app in Alexa developer console and the expected result shall be like this

Congratulations you’ve successfully integrated Amazon DynamoDB to VoiceWorx app.

Last updated