Amazon Aurora (MySQL)
Last updated
Last updated
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.
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.
Login to AWS Management Console at https://console.aws.amazon.com/
Go to Services > RDS > Create database.
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
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.
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.
Input
Information
Service Instance Name
You can give any value of your choice.
Consumer Key
This is your AWS Access key ID
Consumer Secret
This is your AWS Secret access key
Region
AWS Region Name. Your DynamoDB table should be in this region.
Example: us-east-1, us-east-2, us-west-1, us-west-2
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.
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.
Input
Information
Name
You can give any value of your choice.
Custom Skill Type
Select Search
Category
Default.
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.
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.
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,
Get Tables
Get All Items
Get Item
Get Items
Put Item
Post Item
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.
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.
This method requires two parameters as explained below.
Parameter
Sample Value
Info
TableName
Contact
(Select from the drop-down list, you do not have to remember it)
DynamoDB table name. (Case Sensitive)
QueryParameters
Example: 1 {"name":"John"}
Example: 2 {"name":"Smith"}
Key Value pair in a valid json format.
Other than these two parameters, you need to provide the following standard inputs
Parameter
Info
Method Name
You can give any name. This name will be displayed in the methods list.
Request Type
GetItems
This is the method that you are using
Parameters
As explained in the previous table
Result Type
ListOfRecords (Auto Selected)
It indicates that the method can return one or more records
Record Limit
Numeric value (e.g. 10)
If Method is returning larger number of records, then you can limit this result by providing this value.
Record JsonPath
Each method returns data in json format and to pick any specific information from the json, we need to specify the Record JsonPath so Voice Worx platform will pick that data in consideration while displaying results.
Example: $.[*]
This selects all the records that is returned.
Record Template
Let’s assume that the following json represents one record.
{
"Id": "1",
"Name": "kiran",
"PhoneNumber": "123-456-1234"
}
Now, you want to select name, then you can provide Record Template as
Phone number of {{Name}} is {{ PhoneNumber}}
Note:
Anything written in between {{ }} is represented as a json field and it’s case-sensitive.
Result Template
This indicates how method results should be represented.
Here you go, {{Records}}
Here, {{Records}} represents one or more records separated by a separator.
[
{
"id": 2,
"Name": "Mike",
"PhoneNumber": "123-456-1234"
}
]
Create new method
Parameter
Info
Method Name
GetTables
Request Type
GetTables
This is the method that you are using
Parameters
As explained in the previous table
Result Type
ListOfRecords (Auto Selected)
It indicates that the method can return one or more records
Record Limit
Numeric value (e.g. 10)
If Method is returning larger number of records, then you can limit this result by providing this value.
Record JsonPath
Each method returns data in json format and to pick any specific information from the json, we need to specify the Record JsonPath so Voice Worx platform will pick that data in consideration while displaying results.
Example: $.[*]
This selects all the records that is returned.
Record Template
{{TableName}}
Note:
Anything written in between {{ }} is represented as a json field and it’s case-sensitive.
Result Template
Here are the tables. {{Records}} How else can I help you?
Here, {{Records}} represents one or more records separated by a separator.
[
{
"TableName": "Contacts"
}
]
Parameter
Sample Value
Info
TableName
Contact
DynamoDB table name.
Parameter
Info
Method Name
GetAllItems
Request Type
GetAllItems
This is the method that you are using
Parameters
TableName: Contacts
Result Type
ListOfRecords (Auto Selected)
It indicates that the method can return one or more records
Record Limit
Numeric value (e.g. 10)
If Method is returning larger number of records, then you can limit this result by providing this value.
Record JsonPath
Each method returns data in json format and to pick any specific information from the json, we need to specify the Record JsonPath so Voice Worx platform will pick that data in consideration while displaying results.
Example: $.[*]
This selects all the records that is returned.
Record Template
Name:{{Name}}, PhoneNumber: {{PhoneNumber}}
Note:
Anything written in between {{ }} is represented as a json field and it’s case-sensitive.
Result Template
Here are the contacts available, {{Records}} How else can I help you?
Here, {{Records}} represents one or more records separated by a separator.
[
{
"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"
}
]
Parameter
Sample Value
Info
TableName
Contact
DynamoDB table name. (Case Sensitive)
PartitionKeyName
id
Name of the Partition Key for the provided table(Case Sensitive)
PartitionKeyValue
1
Value for the Partition Key
{
"id": "1",
"PhoneNumber": "(336)222-7000",
"Name": "Jack Rogers"
}
Parameter
Sample Value
Info
TableName
Contact
DynamoDB table name. (Case Sensitive)
PartitionKeyName
id
Name of the Partition Key (Case Sensitive)
PartitionKeyValue
5
Value for the Partition Key
ItemData
{"PhoneNumber": "(503) 421-7800","Name": "Josh Davis"}
Item data in json format For example
{
"id": "5",
"PhoneNumber": "(503) 421-7800",
"Name": "Josh Davis"
}
Parameter
Sample Value
Info
TableName
Contact
DynamoDB table name. (Case Sensitive)
PartitionKeyName
id
Name of the Partition Key (Case Sensitive)
PartitionKeyValue
5
Value for the Partition Key
ItemData
{"PhoneNumber": "(503) 421-7800","Name": "Josh Davis"}
Item data in json format For example
{
"id": "5",
"PhoneNumber": "(503) 421-7800",
"Name": "Josh Davis"
}
Parameter
Sample Value
Info
TableName
Contact
DynamoDB table name. (Case Sensitive)
PartitionKeyName
id
Name of the Partition Key (Case Sensitive)
PartitionKeyValue
5
Value for the Partition Key
{"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.
Fill the above details and click on Create Database. For Amazon Aurora RDS, you get two instances, one Writer Instance and another Reader Instance.
Custom IP for VoiceWorx: 52.73.180.211