Flexible Engine - Getting Started Guide


Updated on :

Step 7 – Connexion and copy data to the ECS

In this step 7, we will connect to the ECS with ssh and copy two files :

Name of the files config-db.php

(in the appendix)

importMySQL.sql

(in the appendix)

Description Configuration files for the futur phpMyAdmin Files to import in the RDS. This file creates a cloudcoach database with the different products and team members.
To Do Modify Lign 6  : <IP MySQL server> with the RDS’s IP (192.168.100.2 in the example but you can verify on the RDS view) Nothing to change

Before we can copy the files, we must be able to connect to the machine. To do this, we need to use the private key recovered in step 2 and use the Putty suite of programs (www.putty.org ) and the WinSCP program (https://winscp.net/eng/download.php).

First of all, you have to change the format of the private key with the help of the puTTYgen program:

  • Top left: File > Load private key (choose the .pem from step 2)
  • Bottom/middle right: Save private key
  • Choose the location, the new private key will be in ppk format

 

Then you have to launch the pageant program to import the keys. This program allows you to have the keys on your computer and then use them when you connect. Click on Add Key to add the .ppk file you have just created. After the import, you can see the fingerprint of the added key, which corresponds to the fingerprint displayed in the Key Pair view of the Flexible Engine console.

 

It is now possible to connect to our ECS. We will start by copying the files to the ECS with WinSCP. Connect to the server with the following information:
File protocol SFTP
Host name : IP retrieved at the end of step 6 (for this example : 90.84.197.172)
User name : cloud
Password : leave empty, the private key takes care of everything

 

Click on Login (for a 1st connection, you will then have a pop-up to validate the certificate of the remote host)

 

When the connection is established, WinSCP displays a window divided into two parts: the left part allows us to explore our PC, while the right part allows us to explore the remote machine (our ECS). We copy, by drag and drop, our local files (here importMySQL.sql and config-db.php) in the /home/cloud directory of our ECS.

When the copy is finished, you can quit WinSCP, we are now going to connect to our ECS in console using PuTTY.

Launch the Putty software and fill in the connection information:

  • Host Name (or IP address) : 90.84.45.172
  • Port: 22
  • Click on Open
  • (1st connexion) validate the ECS certificate,

 

Enter cloud when the window asks for a login

 

To perform these actions under Linux:

  • Change the permissions on the private key and copy the files to the ECS
 


$ sudo chmod 400 privatekey.pem

$ sudo sftp –i privateKey.pem /path/to/file/importMySQL.sql cloud@90.84.197.172/home/cloud/ -P 22

$ sudo sftp –i privateKey.pem /path/to/file/config-db.php cloud@90.84.197.172/home/cloud/ -P 22

 

 

  • Connect with ssh to the ECS
 


$ ssh –i privateKey.pem cloud@90.84.45.172

 

 

 

Next step