Creating An Amazon RDS Instance for MariaDB and Connecting From Alpha Cloud
This document is a walk-through of creating a MariaDB Amazon RDS (Relational Database Service) instance and database that you can use with the Alpha Anywhere development environment and an application deployed on Alpha Cloud.
This guide walks you through the process of creating an Amazon RDS Instance using MariaDB and connecting to the MariaDB instance with an application deployed using Alpha Cloud. This guide covers the following:
In this section we will create an Amazon RDS MariaDB instance and database.
Before we can create the instance, however, we first need to create a parameter group that sets some MariaDB parameters to make working with the database easier from Alpha Anywhere. We will be setting the parameters below as follows:
|Allows you to create functions and stored procedures.
|Makes table names case insensitive and simplifies hand coding queries.
|The value we have chosen (500 million) allows you to save large binary and text columns in the database.
We will create both an instance and a database. You can create additional database on the same instance if you wish.
Sign in your Amazon Account or create a new Amazon Account at http://aws.amazon.com
From the Amazon Web Services page navigate to RDS (Relational Database Service) by clicking on the "Services" icon on the top left of the toolbar, selecting "Database" and then "RDS" in the menus. Please note that this article is based on the Amazon AWS Console user interface that is current as of this writing. The instructions are meant to give you a general sense of the specific settings when creating a database for use with Alpha Anywhere rather than as a replacement for Amazon AWS documentation. The AWS Console web page layout changes relatively frequently and may not match exactly. Consult Amazon Relational Database Service documentation in that event.
Important – Be sure to select the Amazon Region you will be deploying your application in when you create your RDS Instance. You will get better performance on your deployed applications.
Create a Parameter Group for your new MariaDBInstance to make working within Alpha Anywhere easier:
a. On the RDS Dashboard, click on the Parameter Groups menu item on the left of the page.
b. Click the button labeled "Create parameter Group".
c. Select "mariadb 10.0 from the Parameter Group Family dropdown list. Note that you can choose any version of MariaDB on the list, but it should match the database version you intend to create.
d. Enter a group name (Let's use "MariaDBAA"). The name should be unique for parameter groups within your account.
e. Enter a reasonable description for the new group like "MariaDB parameter group for use with Alpha Anywhere".
f. Click the button to the right entitled "Create".
Update the values of three of the parameters in your new parameter group:
From the RDS Dashboard click Parameter Groups, select your parameter group by clicking on the checkbox and click the button at the top entitled "Edit Parameters".
Scroll down to log_bin_trust_function_creators and set the value to 1. A value of 1 will allow you to create functions and stored procedures.
Scroll down to lower_case_table_names and set that value to 1. A value of 1 enables support for case-insensitive table names and simplifies hand coding queries.
Scroll down to max_allowed_packet and set that to 500000000 (500 million). This value can vary. The suggested value of 500000000 allows you to save large binary and text columns in the database.
Scroll to the top of the page and click the button entitled "Save Changes".
Create your Amazon RDS instance and database:
Return to the Amazon RDS Dashboard
If you have no instances click on Get Started Now
If you have existing instances, click on the button labeled "Launch a DB Instance". Note that the button at the top launches an Amazon Aurora DB Instance.
From the options presented, click on the MariaDB icon on the left.
Click the button entitled "Select" on the right.
Click the radio button entitled Dev/Test and MariaDB. Note that you can also choose a Production implementation if you wish. The Dev/Test option creates a smaller instance and can save money while you are learning.
Click the button entitled "Next Step"
From the first page of options entitled "Specify DB Details", choose the following:
- DB Engine Version
10.0.24 is a good choice.
- DBInstance Class
db.t2.micro is sufficient for our purposes but you can choose a larger (and more expensive class if you wish).
- Multi-AZ Deployment
For our example, you can choose No.
For test databases, you don't need Multi-AZ deployment.
For production you will want to choose this option as it causes multiple server instances to be run in multiple physical data centers (called availability zones) and assures better availability and load balancing.
- Allocated Storage
You can work with as little as 20GB. Feel free to use more. Amazon recommends at least 100GB for production performance.
- DB Instance identifier
Name your instance. "MariaDB" works fine if you don't already have one with that name.
- Master Username
Choose a user name for the database owner.
- Master Password
Enter the password you want to use for your database owner. Reenter it in Confirm Password.
Leave all other options at their default values.
Click the button on the bottom right entitled "Next Step"
On the page entitled "Configure Advanced Settings"
a. Leave VPC, Subnet Group, Publicly Available, Availability Zone and VPC Security Group(s) at their default values. Note that a new security group will be created by default. This group will grant access to the IP from which you are logged in.
b. Set the Database name to create a new database. We can use "Test1"
c. Select the DB Parameter Group MariaDBAA (the one we just created).
d. Set Minor Version Upgrade to Yes to take advantage of automatic upgrades.You can also set a Backup Retention Period and Maintenance Window for the upgrades.
e. Leave all other options at their defaults.
f. Click the button at the bottom right entitled "Launch DB Instance".
g. Click the button at the bottom of the next page entitled "View Your New Instances" this will return you to the Instances page of the RDS Dashboard and will show your new database in the "creating" status.
It make take five to ten minutes to create the database. You can continue with some of the other tasks while you wait.
From the RDS Dashboard, click on the menu item entitled "Instances" on the left.
Check the box to the left of the database we just created.
Click on the black arrow between the checkbox and the database Engine column to display more information on the database.
Click on the icon showing a document with a magnifying glass to see the details tab.The Endpoint will say "Not available yet" until your database is created.
Click on the link to the right of the "Security Groups" item to go to the Security Groups page for the security group that was automatically created for us along with our database.
If you select the security group, and click on the tab at the bottom of the page entitled "Inbound", you will see a rule that includes the IP address from which you created the RDS database.
Click the "Edit" button in the Inbound tab page to display the edit dialog for the inbound rules.
Click the button entitled "Add Rule".
Select MySQL/Aurora as the type.
Select "Custom" as the Source.If you had selected 'Anywhere' above, the CIDR address of 0.0.0.0/0 would be set and your database could be accessed from anywhere on the internet. Instead, you want to add specific addresses from which access is allowed. This will prevent anyone not at one of these addresses from accessing your database.
Add a rule for each egress IP address (from which Alpha Cloud will access the database) and one for your local address.The format of the address is the IP address you want to allow followed by "/32". This means that you want the incoming IP address to match all 32 bits of the IP address you are providing.
Click Save to save the new inbound rules.
Return to RDS Instances page:
a. Click on the cube on the upper left corner of the page.
b. Click on the RDS (Relational Database Service) menu item.
c. Click on the Instances option on the left of the RDS Dashboard page.
Once your database status reports as "available" select your new database.
Click on the black arrow to the left of the Engine column with on the row your database is displayed on.
Select the EndPoint value and copy it to the clipboard.
The endpoint will look something like this:
Save this value for later.
Depending on your choice of tool to model the schema of your database, you will have a different dialog, but they will all use the following values:
- Server or Host
This is the front part of the endpoint without the ":3306"
This is the value 3306
The master user name you created
The master user password you created
Some tools will work with the server and let you select the database, others will prompt for the database as part of the connection.
Use the name you created for your database. In the steps above. We used "Test1"
Create a named connection string in the Alpha Anywhere Web Project
a. Open the Web Control Panel
b. Select Tools and then AlphaDAO Connection Strings from the menu.
c. If you have an existing named connection string in use for your project, you can edit it and have it point to your new RDS database.
d. Otherwise, click "New" to create a new connection string.
e. Choose the MySQL client
f. On the Create SQL Connection String dialog enter the following values:
You can click on the button entitled "Refresh" to retrieve a list of databases.
Your saved endpoint without the ":3306"
The master user name you provided when you created your database
The password you provided when you created your database
Enter the name of the database you created with your instance. We used "Test1".
g. Click on Test Connection to confirm that you have connected to your RDS instance successfully.
Give your new named connection a unique name within your web project.
Use this named connection for all of your development.
When you publish to Alpha Cloud, the connection will work from your deployed applications as well.