Get Public IP address of EC2 instance
Use MobaXterm to SSH into the instance via port 22.
Select Session
Select SSH
Remote host, enter the newly obtained Public IPv4 address of the instance
Specify username, enter ec2-user
Check port 22
Select Advanced SSH settings
Select Use private key and select the keypair of the instance.
Select OK
SSH successful
Because we use git to clone the source code. First, install git with the following command:
sudo yum install git
Install MySQL command-line client
sudo dnf install mariadb105
Check git installation
mysql --version
Connect MySQL command-line client (unencrypted)
mysql -h fcj-management-db-instance.cfc4i6gyseay.ap-southeast-1.rds.amazonaws.com -P 3306 -u admin -p
Check the databases in the instance with the following command, which will print out a list of all databases.
show databases;
Select the database to make changes to using USE, use the initial database when you created RDS.
USE "database name";
``` Create a table in the awsuser database using the **CREATE TABLE** command.
```bash CREATE TABLE `awsfcjuser`.`user` ( `id` INT NOT NULL AUTO_INCREMENT , `first_name` VARCHAR(45) NOT NULL , `last_name` VARCHAR(45) NOT NULL , `email` VARCHAR(45) NOT NULL , `phone` VARCHAR(45) NOT NULL , `comments` TEXT NOT NULL , `status` VARCHAR(1 0) NOT NULL DEFAULT 'active' , PRIMARY KEY (`id`)) ENGINE = InnoDB;
Insert information into the data table using the INSERT INTO command
INSERT INTO `user`
(`id`, `first_name`, `last_name`, `email`, `phone`, `comments`, `status`) VALUES
(NULL, 'Amanda', 'Nunes', 'anunes@ufc.com', '012345 678910', '', 'active'),
(NULL, 'Alexander', 'Volkanovski', 'avolkanovski@ufc.com', '012345 678910', '', 'active'),
(NULL, 'Khabib', 'Nurmagomedov', 'knurmagomedov@ufc.com', '012345 678910', '', 'active'), (NULL, 'Kamaru', 'Usman', 'kusman@ufc.com', '012345 678910', '', 'active'), (NULL, 'Israel', 'Adesanya', 'iadesanya@ufc.com', '012345 678910', '', 'active'), (NULL, 'Henry', 'Cejudo', 'hcejudo@ufc.com ', '012345 678910', '', 'active'), (NULL, 'Valentina', 'Shevchenko', 'vshevchenko@ufc.com', '012345 678910', '', 'active'), (NULL, 'Tyron', 'Woodley', 'twoodley@ufc.com', '012345 678910', '', 'active'), (NULL, 'Rose', 'Namajunas ', 'rnamajunas@ufc.com', '012345 678910', '', 'active'), (NULL, 'Tony', 'Ferguson ', 'tferguson@ufc.com', '012345 678910', '', 'active'), (NULL, 'Jorge' , 'Masvidal ', 'jmasvidal@ufc.com', '012345 678910', '', 'active'), (NULL, 'Nate', 'Diaz ', 'ndiaz@ufc.com', '012345 678910', '', 'active'), (NULL, 'Conor', 'McGregor ', 'cmcGregor@ufc.com', '012345 678910', '', 'active'), (NULL, 'Cris', 'Cyborg ', 'ccyborg@ufc.com', '012345 678910', '', 'active'), (NULL, 'Tecia', 'Torres ', 'ttorres@ufc.com', '012345 678910', '', 'active'), (NULL , 'Ronda', 'Rousey ', 'rrousey@ufc.com', '012345 678910', '', 'active'), (NULL, 'Holly', 'Holm ', 'hholm@ufc.com', '012345 678910', '', 'active'), (NULL, 'Joanna', 'Jedrzejczyk ', 'jjedrzejczyk@ufc.com', '012345 678910', '', 'active');
Display the tables:
SELECT * FROM "table name";
Use exit to leave. If you cannot disconnect from the DB instance