What you will accomplish
In this tutorial, you will:
- Create a MariaDB database instance
- Connect to the database
- Delete the database instance
Before starting this tutorial, you will need:
- An AWS account: If you don't already have an account, follow the Setting Up Your AWS Environment tutorial for a quick overview.
Time to complete
Cost to complete
*Accounts that have been created within the last 24 hours might not yet have access to the resources required for this tutorial.
February 10, 2023
Step 1: Enter the Amazon RDS console
In a new browser window, open the AWS Management Console, so you can keep this step-by-step guide open. In the console, enter RDS in the search bar and select RDS under Services to open the Amazon RDS console.
Step 2: Create a MariaDB instance
In this step, we will use Amazon RDS to create a MariaDB instance with a db.t3.micro DB instance class, 20 GB of storage, and automated backups enabled with a retention period of one day. As a reminder, all of this is Free Tier eligible.
a. In the top right corner of the Amazon RDS console, select the Region in which you want to create the DB instance.
Note: AWS Cloud resources are housed in highly available data center facilities in different areas of the world. You have the ability to choose which Region to host your Amazon RDS activity in.
b. In the Create database section, choose Create database.
c. You now have to select the database engine type, engine version, and the template. For this tutorial, choose the Standard create method and MariaDB as the Engine type. Select the default DB engine version, and Free Tier as the template.
d. You will now configure your DB instance.
The list below shows the example settings that you can use for this tutorial:
DB instance identifier: Type a name for the DB instance that is unique for your account in the Region you selected. For this tutorial, enter myrdstest.
Master username: Type a username that you will use to log in to your DB instance. We will use admin in this example.
Master password: Enter a password that contains from 8 to 41 printable ASCII characters, excluding / (slash), '(single quote), "(double quote), and @ (at sign), for your master password.
Confirm password: Re-enter your password.
DB instance class: Select the default, db.t3.micro - 2 vCPUs, 1 GiB RAM. This Free Tier eligible instance class hosts 1 GB memory and 2 vCPUs. To see a list of supported instance classes, see Amazon RDS Instance Types.
Storage type: Select General Purpose SSD (gp2). For more information about storage, see Amazon RDS DB instance storage.
Allocated storage: Set the allocated storage to 20 GiB for your database. You can scale up to a maximum of 64 TB with Amazon RDS for MariaDB.
Enable storage autoscaling: If your workload is unpredictable, you can enable storage autoscaling to enable Amazon RDS to automatically scale up your storage when needed. This option does not apply to this tutorial.
Multi-AZ deployment: This option does not apply to this tutorial. Using a Multi-AZ deployment will automatically provision and maintain a synchronous standby replica in a different Availability Zone. Note that you will have to pay for Multi-AZ deployment. For more information, see Multi-AZ deployments for high availability.
e. You are now in the Connectivity section where you provide additional information that Amazon RDS needs to launch your MariaDB database instance. The list below shows settings for our example database instance.
Compute resource: You can set up connectivity between your EC2 instance if you already have one created, such as Bastion host or application server, using this option. This option does not apply to this tutorial. See Configure automatic network connectivity with an EC2 instance for more details.
Network type: Amazon RDS supports use of IPv6 and IPv4. Keep the default IPv4 selected for this tutorial.
Virtual private cloud (VPC): Select Default VPC. For more information about VPC, see Amazon VPC VPCs and Amazon RDS.
DB Subnet group: Choose the default subnet group. For more information about subnet groups, see Working with DB subnet groups.
Public access: Choose Yes. This will allocate a public IP address for your database instance so you can directly connect to the database from your own device.
VPC security group (firewall): Select Create new VPC security group and provide a name in the New VPC Security group name field. In this tutorial, we will use rds-sg. This will create a security group that will allow connection from the IP address of the device that you are currently using to the database created.
Availability Zone: Choose No preference. See Regions, Availability Zones, and Local Zones for more details.
Database port: Leave the default value of 3306.
Database authentication options: MariaDB offers Password authentication and Password and IAM database authentication. Keep the default Password authentication selected. See IAM database authentication for more details.
Keep the default Enable Enhanced monitoring unchecked for this tutorial. See Overview of Enhanced Monitoring for more details about monitoring.
In the Additional configuration section:
Initial database name: Enter a database name that is 1 to 64 alphanumeric characters. If you do not provide a name, Amazon RDS will not automatically create a database on the RDS instance you are creating.
DB parameter group: Leave the default value. For more information, see Working with parameter groups.
Option group: Leave the default value. Amazon RDS uses option groups to enable and configure additional features. For more information, see Working with option groups.
Enable automated backups: Check this option to enable automatic backups. See Working with backups for more details.
Backup retention period: You can choose the number of days to retain the backup you take. For this tutorial, set this value to 1 day.
Backup window: Use the default of No preference.
Copy tags to snapshots: Keep the default option to enable tags for snapshots.
Enable encryption: Keep the default option of Enable encryption checked and keep the default AWS KMS key. For more information, see Encrypting Amazon RDS resources.
Log exports: Using Amazon RDS, you can export your logfiles to Amazon CloudWatch logs for longer retention and advanced monitoring. For this tutorial, keep them all unchecked.
Enable auto minor version upgrade: Select Enable auto minor version upgrade to receive automatic updates when they become available.
Maintenance window: Select No preference.
Enable deletion protection: Deactivate Enable deletion protection for this tutorial. When this option is enabled, you can't delete the database.
Choose Create database.
Note: It can take several minutes for the new DB instance to become available. Feel free to move on to the next step as you wait.
Step 3: Download a SQL client
a. Go to DBeaver Community to download and install DBeaver.
Note: Remember to use DBeaver from the same device from which you created the DB instance. The security group your database is placed in is configured to allow connection only from the device from which you created the DB instance.
Step 4: Connect to the MariaDB Instance
In this step, you will connect to the database that you created using DBeaver.
a. Launch the DBeaver application and go to Database > New Database Connection from the menu bar.
Enter Maria in the search bar, select MariaDB, and choose Next.
b. A dialog box appears. Enter the following:
Server Host: You can find your hostname on the Amazon RDS console. Choose the RDS instance that you created in the console and look for the hostname under Connectivity & security. Copy and paste the hostname of the DB instance running the MariaDB database engine. For example, the hostname would be in the following format: myrdstest.cplzbmbcrxt1.ap-southeast-2.rds.amazonaws.com.
Port: The default value should be 3306.
Username: Enter the username you created for the Amazon RDS database. Our example was admin.
Password: Enter the password that you used when creating the Amazon RDS database and select Save password locally if you wish to store the password.
Choose Test Connection in the lower left. Once the connection is successful, choose Finish.
Note: If DBeaver prompts you to upgrade some files during the test connection, download and upgrade the files.
Step 5: Delete the DB instance
You can easily delete the MariaDB database instance from the Amazon RDS console. It is a best practice to delete instances that you are no longer using so that you don’t keep getting charged for them.
a. Go back to the Amazon RDS console. Select Databases, choose the instance that you want to delete, and then select Delete from the Actions dropdown menu.
b. You are asked to create a final snapshot and to confirm the deletion. For our example, do not create a final snapshot, acknowledge that you want to delete the instance, enter delete me in the text field and then choose Delete.
Note: Deleting your DB instance may take a few minutes.
You have created, connected to, and deleted a MariaDB database instance with Amazon RDS. Amazon RDS makes it easy to set up, operate, and scale a relational database in the cloud. It provides cost-efficient and resizable capacity while managing time-consuming database administration tasks, freeing you up to focus on your applications and business.
To learn more about MariaDB database instances on Amazon RDS, explore the following resources.