The page has been translated by Gen AI.

Connecting to a MariaDB (DBaaS) server

Scenario Overview

The MariaDB (DBaaS) server connection scenario involves creating a Bastion host (Virtual Server) and a Database service, and then accessing the DB service through the Bastion host. To connect to MariaDB (DBaaS) reliably in the Samsung Cloud Platform environment, you must create a bastion host and use it to establish a network connection. To maintain a stable and highly secure environment, we recommend configuring the Database service in a private subnet and the bastion host in a restricted public subnet.

This scenario describes the process of creating a Bastion host and a Database service, configuring the network environment for connecting the Bastion host to the Database, and then connecting to the database using a DB client.

Architecture
Figure. MariaDB (DBaaS) server connection architecture

Scenario Components

You can configure the scenario using the following services.

Service group
Service
Detailed Description
NetworkingVPCA service that provides an isolated virtual network in a cloud environment
NetworkingVPC > SubnetA service that allows users to subdivide their network within a VPC according to their specific use case and scale.
NetworkingVPC > Public IPA service that reserves public IP addresses and allocates and releases them to Compute resources
NetworkingVPC > Internet GatewayA service that connects VPC resources to the internet
NetworkingSecurity GroupA virtual firewall that controls server traffic
DatabaseMariaDB (DBaaS)A service for easily creating and managing MariaDB in a web environment
ComputeVirtual ServerVirtual servers optimized for cloud computing
ComputeVirtual Server > KeypairAn encrypted file used to connect to a Virtual Server
Table. List of scenario components
Reference
  • The default policy for a Security Group is Deny All, so you must register only the IPs to allow.
  • The All Open (Any IP, Any Port) policy for In/Outbound traffic can expose cloud resources to external threats.
    • You can enhance security by configuring policies that specify the required IP addresses and ports.

How to Configure Scenarios

Create the services required to build a scenario by following the steps below.

1. Configure the network

This section describes the process of configuring the network environment for connecting to the Bastion Host and Database services.

1-1. Create a VPC

For detailed creation instructions, refer to the Networking > VPC > How-to guides guide.
  1. Click the All Services > Networking > VPC menu. 1. Go to the Service Home page of the VPC.
  2. On the Service Home page, click the Create VPC button. 2. Go to the Create VPC page.
  3. On the Create VPC page, enter the information required to create the service.
    • Enter the IP range as 192.168.x.0/16.
  4. Review the details and estimated billing amount generated in the Summary panel, and then click the Complete button.
    • After creation is complete, verify the created resources on the VPC List page.

1-2. Create a Subnet

For detailed creation instructions, refer to the Networking > VPC > How-to guides > Subnet guide.
  1. Click the All Services > Networking > VPC menu. 1. Go to the Service Home page of the VPC.
  2. On the Service Home page, click the Subnet menu. 2. Go to the Subnet List page.
  3. Click the Create Subnet button. 3. Go to the Create Subnet page.
  4. On the Create Subnet page, enter the information required to create the service.
    • Select General as the subnet type.
    • Select a pre-created VPC.
    • Enter the IP range as 192.168.x.0/24.
  5. Review the details and estimated billing amount generated in the Summary panel, and then click the Complete button.
    • After creation is complete, verify the created resource on the Subnet List page.

1-3. Create an Internet Gateway

For detailed creation instructions, refer to the Networking > VPC > How-to guides > Internet Gateway guide.
  1. Click the All Services > Networking > VPC menu. 1. Go to the Service Home page of the VPC.
  2. On the Service Home page, click the Internet Gateway menu. 2. Go to the Internet Gateway List page.
  3. Click the Create Internet Gateway button. 3. Navigate to the Create Internet Gateway page.
  4. On the Create Internet Gateway page, enter the required information needed to create the service.
    • Select a pre-created VPC.
    • Select Use in the Firewall usage field.
  5. Review the details and estimated billing amount generated in the Summary panel, and then click the Complete button.
    • After creation is complete, verify the created resource on the Internet Gateway List page.

1-4. Create a Public IP

For detailed creation instructions, refer to the Networking > VPC > How-to guides > Public IP guide.
  1. Click the All Services > Networking > VPC menu. 1. Go to the Service Home page of the VPC.
  2. On the Service Home page, click the Public IP menu. 2. Navigates to the Public IP List page.
  3. Click the Reserve Public IP button. 3. Go to the Public IP Reservation page.
  4. On the Public IP Reservation page, enter the required information for the service reservation.
  5. Review the details and estimated billing amount generated in the Summary panel, and then click the Complete button.
    • After creation is complete, verify the created resource on the Public IP List page.

1-5. Create a Security Group

For detailed creation instructions, refer to the Networking > Security Group > How-to guides guide.
  1. Click the All Services > Networking > Security Group menu. 1. Go to the Service Home page of the Security Group.
  2. On the Service Home page, click the Create Security Group button. 2. Navigate to the Create Security Group page.
  3. On the Create Security Group page, enter the required information needed to create the service.
  4. Review the input information and click the Complete button.
    • After creation is complete, verify the created resource on the Security Group List page.

2. Create a Bastion Host

This section describes the process of configuring a Bastion Host on which the database connection client must be installed.

2-1. Create a Server Keypair

For detailed creation instructions, refer to the Compute > Virtual Server > How-to guides > Keypair guide.
  1. Click the All Services > Compute > Virtual Server menu. 1. Go to the Service Home page of the Virtual Server.
  2. On the Service Home page, click the Keypair menu. 2. Go to the Keypair List page.
  3. Click the Create Keypair button. 3. Navigate to the Create Keypair page.
  4. On the Create Keypair page, enter the required information needed to create the service.
  5. Review the generation information and click the Complete button.
    • You can download the key only once. Reissuance is not available.
    • Be sure to store the downloaded key in a secure location.

2-2. Create a Bastion Host

For detailed creation instructions, refer to the Compute > Virtual Server > How-to guides guide.
  1. Click the All Services > Compute > Virtual Server menu. 1. Go to the Service Home page of the Virtual Server.
  2. On the Service Home page, click the Create Virtual Server button. 2. Go to the Create Virtual Server page.
  3. On the Create Virtual Server page, enter the required information to create the service.
  4. Review the details and estimated billing amount generated in the Summary panel, and then click the Complete button.
    • After creation is complete, verify the created resource on the Virtual Server List page.

2-3. Check the Bastion host login ID and password

  1. Click the All Services > Compute > Virtual Server menu. 1. Go to the Service Home page of the Virtual Server.
  2. On the Service Home page, click the Virtual Server menu. 2. Go to the Virtual Server List page.
  3. On the Virtual Server List page, click the resource created in 2-2. Create a Bastion Host. 3. Navigates to the detailed information page for the resource.
  4. On the details page, click the RDP password lookup button in the Keypair name field. 4. The RDP password lookup popup window opens.
  5. In the RDP password lookup popup, attach the keypair file downloaded from 2-1. Create server Keypair.
  6. After attaching, click the Password 확인 button. 6. The ID and password for accessing the resource are displayed.

3. Creating a Database

This section describes the process of creating a Database service.

3-1. Create a MariaDB (DBaaS) Service

For detailed creation instructions, refer to the Database > MariaDB(DBaaS) > How-to guides guide.
  1. Click the All Services > Database > MariaDB(DBaaS) menu. 1. Go to the Service Home page of MariaDB (DBaaS).
  2. On the Service Home page, click the Create MariaDB (DBaaS) button. 2. Go to the Create MariaDB (DBaaS) page.
  3. On the Create MariaDB (DBaaS) page, enter the required information needed to create the service.
    • Select the pre-created VPC and subnets to connect.
    • Enter the Database-related creation information on the required information input screen.
    • Add the Bastion host IP to the IP access control entry.
    • The default database port is 2866, but you can specify a different port.
  4. Review the details and estimated billing amount generated in the Summary panel, and click the Complete button.
    • After creation is complete, verify the created resource on the MariaDB(DBaaS) list page.

4. Configure Rules

This section describes how to configure the rules for connecting to a Bastion host and the rules for connecting to a database from the Bastion host.

4-1. Add Security Group Rules

For detailed creation instructions, refer to the Networking > Security Group > How-to guides guide.
  1. Click the All Services > Networking > Security Group menu. 1. Go to the Service Home page of the Security Group.
  2. On the Service Home page, click the Security Group menu. 2. Go to the Security Group List page.
  3. **1-5. 3. Select the Security Group resource created in Create a Security Group. 3. Navigates to the detailed information page for the resource.
  4. On the details page, click the Rules tab. 4. Go to the Rules tab.
  5. Click the Add Rule button in the Rules tab. 5. Navigates to the Add Rule popup window.
  6. In the Add Rule popup, enter the rule below and click the OK button.
    DirectionRemoteTarget AddressProtocolPortDescription
    InboundCIDRUser PC IPTCP3389 (RDP)PC connected to Bastion → Bastion host
    OutboundCIDRDB IPTCPDatabase Port (Direct Input)Bastion host → Database
    Table. Security Group security rules that must be added

4-2. Add an IGW Firewall Rule

For detailed creation instructions, refer to the Networking > Firewall > How-to guides guide.
  1. Click the All Services > Networking > Firewall menu. 1. Go to the Service Home page of the Firewall.
  2. On the Service Home page, click the Firewall menu. 2. Go to the Firewall List page.
  3. On the Firewall List page, select the Internet Gateway resource name that you created in 1-3. Create an Internet Gateway. 3. Navigates to the detailed information page for the resource.
  4. On the details page, click the Rules tab. 4. Go to the Rules tab.
  5. Click the Add Rule button in the Rules tab. 5. Navigates to the Add Rule popup window.
  6. In the Add Rule popup, enter the rule below and click the OK button.
    Origin addressDestination addressProtocolPortOperationDirectionDescription
    IP address of the PC connected to BastionBastion host IPTCP3389(RDP)AllowInboundUser PC → Bastion host
    Table. Internet Gateway Firewall rules that must be added

5. Connecting to the Database

This section describes the process of connecting to a database using a DB client program.

This guide explains how to connect using MySQL Workbench. Database client programs and CLI utilities vary, so you can install and use the tool that best suits your needs.

5-1. Connecting to a Bastion Host

  1. In the Windows environment of the PC you want to use to connect to the Bastion host, run Remote Desktop Connection, enter the Bastion Host’s NAT IP, and click the Connect button.
  2. If the remote desktop connection succeeds, the user credentials input window opens. 2. Enter the ID and Password that you verified in 2-3. Check the bastion host login ID and password, and then click the OK button.

5-2. Installing a DB client program (MySQL Workbench) on a bastion host

  1. Go to the official MySQL page and download the MySQL Workbench program.
  2. Connect the hard drive of your user PC to the bastion host to upload the file.
  3. In the Local Resources tab of Remote Desktop Connection, click the Details button for the local device and resource items.
  4. Select the local disk where you downloaded the file from the drive, and click the OK button.
  5. Copy the downloaded file and upload it to the Bastion Host, then click the MySQL Workbench installation file to install it.

5-3. Connecting to a Database Using a DB Client Program (MySQL Workbench)

  1. Run MySQL Workbench and click Database > Manage connections. 1. The Manage Server Connection popup appears.
  2. In the Manage Server Connection popup, click the New button in the lower-left corner, enter the database server information created in 3-1. Creating a MariaDB (DBaaS) Service, and then click Test Connection. 2. A Password popup window appears.
    Required input element itemsInput
    Connection NameCustom (e.g., service name)
    Host nameDatabase server IP
    PortDatabase Port
    UsernameDatabase username
    Table. Database client program input fields
  3. In the Password popup, enter the password configured in 3-1. Create a MariaDB (DBaaS) service and click the OK button. 3. After the success is complete, click the OK button in the Manage Server Connection popup.
  4. Click Database > Connect to Database. 4. The Connect to Database popup window appears.
  5. Select a Connection Name registered in Stored Connection to connect to the database. 5. After connecting, you can run simple queries.
Configure Read Replica
Release Note