This topic describes how to connect to a Linux host through a bastion host.
Prerequisites
-
The ApsaraDB for MyBase cluster runs on the MySQL or PostgreSQL engine.
-
Your ApsaraDB for MyBase cluster has OS permissions enabled. For more information, see Create a cluster.
-
A host account has been created. For more information, see Create a host account.
Background information
A bastion host provides a secure entry point to your private network. It logs all user activity and prevents direct public access to your database hosts, enhancing security. You can use a single bastion host to log in to and manage multiple database hosts.
Procedure
-
Log on to the ApsaraDB for MyBase console.
-
In the upper-left corner of the page, select a region.
-
Find the target cluster and click Details in the Actions column.
-
In the left-side navigation pane, click Bastion Hosts. Find the target bastion host and click Associate with Bastion Host in the Actions column.
-
Select the target host and click Next.
-
Create a bastion host account.
-
Click Create Bastion Host Account. In the Create Bastion Host Account dialog box, configure the following parameters.
Parameter
Description
username
The username for the bastion host account. The username must meet the following requirements:
-
Must not exceed 50 characters.
-
Must include characters from at least three of the following categories: uppercase letters, lowercase letters, digits, and special characters.
-
The supported special characters are
_-.%.
password
The password for the bastion host account. The password must meet the following requirements:
-
Must be 8 to 64 characters in length.
-
Must contain uppercase letters, lowercase letters, digits, and special characters.
-
Examples of special characters include
@,#,$.
confirm password
Re-enter the password to confirm.
name
The user's name. The name cannot exceed 100 characters.
email address
Optional. The user's email address.
phone number
Optional. The user's phone number.
-
-
Click Create.
-
-
Authorize a host.
-
Find the target bastion host account and click Authorize Host in the Actions column. This action redirects you to the Bastionhost console.
-
On the Users page, find the target bastion host account and click Authorize Host in the Actions column.
-
On the Authorized Hosts tab, click Authorize Host.
-
In the Authorize Host panel, select the target host and click OK.
NoteAfter the authorization is complete, return to the Authorize Host wizard. In the Authorized Hosts column, click View Authorized Hosts to view the authorized hosts.
-
-
Log on to the host.
-
Log on to the bastion host by using terminal SSH with the following command:
ssh <username>@<public_endpoint> -p<port>Note-
<username>: The username of the bastion host account. -
<public_endpoint>: The public endpoint of the bastion host. You can find this address on the Bastion Hosts page. -
<port>: The port of the bastion host. The default port is 60022.
Example
ssh test@wdd*****-public.bastionhost.aliyuncs.com -p60022 -
-
Enter the password for the bastion host account.
-
Use the arrow keys to select the target host and press Enter.
-