Create and Connect to a MariaDB Database with Amazon RDS

·

4 min read

Step 1: Access the Amazon RDS Console

  • Open a fresh browser window and go to the AWS Management Console. You can keep this guide open for reference.

  • Once in the console, locate the search bar and type "RDS."

  • From the search results, select "RDS" under Services to open the Amazon RDS console

Step 2: Setting Up Your MariaDB Instance

  • a. Choose Your Region: Navigate to the top right corner of the Amazon RDS console and select the Region where you want to create your DB instance. Regions are different geographical locations housing AWS Cloud resources. Note: You have the flexibility to choose the Region that best suits your needs.

  • b. Start Database Creation: In the "Create database" section, click on "Create database

  • c. Configure MariaDB Instance: Follow the steps below to configure your MariaDB instance based on Free Tier eligibility and the specifications mentioned in this tutorial:

  • Settings: DB instance identifier: Enter a unique name for your DB instance in the selected Region (e.g.,database-1).

  • Master username: Choose a login username (e.g., admin).

  • Master password: Set a password with 8 to 41 printable ASCII characters, excluding certain symbols.

  • Confirm password: Re-enter your password.

  • Instance specifications:

    DB instance class: Select the default - db.t3.micro (Free Tier eligible)

  • Storage type: Choose General Purpose SSD (gp2)

  • Allocated storage: Set to 20 GiB.

  • Enable storage autoscaling:

  • Multi-AZ deployment:

  • e.Connectivity:

  • Compute resource:Network type: Choose the default IPv4.

  • Virtual private cloud (VPC): Select Default VPC.

  • DB Subnet group: Choose the default subnet group

VPC (seperate network): Create a new vpc (e.g.,vpc-database) for device connection

  • Availability Zone: Choose No preference.

  • Public access: Choose Yes to allocate a public IP address.

  • Additional Configuration: Database port: Leave the default value of 3306.

  • Database authentication: Database authentication options: Choose Password authentication.

  • Monitoring: Enable Enhanced monitoring: Uncheck

  • Database options:

  • Initial database name: Enter a name (1 to 64 alphanumeric characters) or leave it blank.

  • DB parameter group: Leave the default value.

  • Option group: Leave the default value.

  • Backup:

    Enable automated backups: Check this option.

    Backup retention period: Set to 1 day.

    Backup window: Use the default of No preference.

  • Encryption:

    Enable encryption: Keep the default option checked.

  • Log exports:

    Log exports: Keep all options unchecked.

  • Maintenance:

    Enable auto minor version upgrade: Check this option.

  • Maintenance window: Select No preference.

  • f. Create Database: Click on "Create database."

  • g. Monitor Status: Wait for the status to change from "Creating" to "Available." This process may take a few minutes

Step 3: Get a SQL Client

a. Download DBeaver: Once your DB instance is available, you can connect to its database using a SQL client. We recommend using DBeaver, a free and versatile database tool. Visit the DBeaver Community to download and install DBeaver. Note: Ensure you use DBeaver from the same device where you created the DB instance. The security group of your database only allows connections from the device used for DB instance creation

Step 4: Connect to Your MariaDB Instance Using DBeaver

a. Launch DBeaver and Create a New Database Connection: Open DBeaver and navigate to Database > New Database Connection in the menu bar.

Enter "Maria" in the search bar, select "MariaDB," and click on Next.

b. Fill in the Connection Details: In the dialog box, enter the following details

Server Host: Find the hostname on the Amazon RDS console under Connectivity & Security. Copy and paste the hostname of your MariaDB DB instance, for example: [myrdstest.cplzbmbcrxt1.ap-southeast-2.rds.amazonaws.com.]

Port: The default value is 3306

.

Username: Enter the username created for the Amazon RDS database (e.g., admin). Password: Enter the password used during the creation of the Amazon RDS database. Optionally, select "Save password locally" if you want to store the password.

Click on "Test Connection" in the lower-left corner. Once the connection is successful, click on "Finish."

Note: If DBeaver prompts you to upgrade files during the test connection, download and upgrade the files.

c. Database Connection Successful:

Congratulations! You are now connected to the database. In DBeaver, you'll see various objects available in the database. Now, you can start creating tables, inserting data, and running queries.

Step 5: Deleting the MariaDB Instance

a. Navigate to Amazon RDS Console: Return to the Amazon RDS console. Click on "Databases," select the instance you wish to delete, and then choose "Delete" from the Actions dropdown menu.

b. Confirm Deletion: You'll be prompted to create a final snapshot and confirm the deletion. For this example, choose not to create a final snapshot. Acknowledge that you want to delete the instance, enter "delete me" in the text field, and then click on "Delete."

Conclusion: Congratulations! You've successfully navigated the process of creating, connecting to, and deleting a MariaDB database instance with Amazon RDS. Amazon RDS simplifies the setup, operation, and scaling of relational databases in the cloud. It offers cost-efficient and scalable capacity, handling complex database administration tasks, allowing you to concentrate on your applications and business priorities.