# \[ Part 1 ] Preparing the environment

## **Steps to be implemented:**

* Start the Cloud-Shell
* Generate ssh keys
* Clone the MdsReplication repository
* Add the corresponding variables to file variables.tf

### **\[ 1 ] Start the Cloud-Shell**

Next to your region, in the upper right corner,  there is a square that indicates a terminal (as marked with orange).&#x20;

Click on it, and wait for a couple of minutes until the Cloud-Shell is prepared.

![](https://4059461994-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MYZtT66GrlnDmIG2g4R%2F-MYa5xwMjdjn-aaeY3l3%2F-MYa6V5xskccsAwaos75%2F1111.png?alt=media\&token=1f362a69-2d88-4869-b1c7-c0c6aedbedbb)

### \[ 2 ] Generate SSH keys

**Generate the default files of ssh keys (**\~/.ssh/id\_rsa and \~/.ssh/id\_rsa.pub) under user's home directory with the help of  command:

```
zack@cloudshell:~ (eu-frankfurt-1)$  ssh-keygen
```

Choose the default option, by **pressing Enter** to each requirement.

*Practice example:*

```
zack@cloudshell:~ (eu-frankfurt-1)$ pwd 
/home/zack
zack@cloudshell:ExampleMySqlDbAndInstance (eu-frankfurt-1)$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/zack/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/zack/.ssh/id_rsa
Your public key has been saved in home/zack/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:
The key's randomart image is:
+---[RSA 3072]----+
|..oo..o o. .o    |
|oo o.  + ..o.E   |
|* . .   .o..  .  |
|o. . . . .o .    |
|. o o o S  .     |
|   o = . .       |
|  o . = . .      |
|.=.+o+.. o o .   |
|.+Oo.+o.. . o    |
+----[SHA256]-----+

```

Check if the ssh keys have been generated under your home directory:

```
zack@cloudshell:~ (eu-frankfurt-1)$ ls ~/.ssh/id_*
/home/zack/.ssh/id_rsa  /home/zack/.ssh/id_rsa.pub
```

### \[ 3 ] Clone the Github repository

Clone the Github repository with the usual "git clone" command:

```
git clone  https://github.com/isaac-kami/MdsReplication.git
```

Access the directory MdsReplication:

```
zack@cloudshell:~ (eu-frankfurt-1)$ cd MdsReplication/
zack@cloudshell:MdsReplication (eu-frankfurt-1)$ 
```

### **\[ 4 ] Test the variables**

At this step, you will need to run the script **test\_env\_variables.sh** , that will generate a set of variables as output.

Make it executable and run it (you will need to wait for about 40 seconds):

```
zack@cloudshell:~ (eu-frankfurt-1)$ chmod +x test_env_variables.sh
zack@cloudshell:~ (eu-frankfurt-1)$ ./test_env_variables.sh
```

You will need to be very careful with the **instance\_image** variable. If you get an output as follow:

```
variable "instance_image" {
   default = ""
}

```

... then, **check page** [Troubleshooting image OS](https://isaac-exe.gitbook.io/mds-presentation/structure/part-1-preparing-the-environment/troubleshooting-image-os)

Your output should be something of this kind (output per Dubai region):

```
zack@cloudshell:~ (me-dubai-1)$ ./test_env_variables.sh 
### variables added with generate_variables.sh script

variable "compartment_ocid" {
     default = "ocid1.tenancy.oc1..aaaaaaaa2efnorqencqozgznvr4ifnull4rfe52jbotludfu64cc3p6lrfea"
}


variable "ssh_public_key_path" {
   default = "/home/artforward/.ssh/id_rsa.pub"
}


variable "ssh_private_key_path" {
   default = "/home/artforward/.ssh/id_rsa"
}


variable "bucket_namespace" {
   default = "axx705ls0mwn"
}


variable "mysql_db_system_availability_domain" {
   default = "gvJq:ME-DUBAI-1-AD-1"
}


variable "instance_image" {
   default = "ocid1.image.oc1.me-dubai-1.aaaaaaaakymk4j6nkwer37kw2gsrzsbhoosqnckz6hmsmdpzr42ie5hlitga"
}

```

### **\[ 5 ]** Add the corresponding variables to file variables.tf

This step is implemented with the help of Bash script generate\_variables.sh

```
zack@cloudshell:MdsReplication (eu-frankfurt-1)$ ls generate_variables*
generate_variables.sh
```

Make the script executable, and run it:

```
MdsReplication (eu-frankfurt-1)$ chmod +x generate_variables.sh  
MdsReplication (eu-frankfurt-1)$ ./generate_variables.sh
```

&#x20;***You will have to wait for an average of  45 seconds until all variables are generated and appended to the variables.tf file***

Check the "variables.tf", and following lines should be appended - the user is changed accordingly to your environment and profile.

*Possible output (according to your user, AD & OS Ubuntu 20.04 version per your region)*

```
zack@cloudshell:MdsReplication (eu-frankfurt-1)$ tail -32 variables.tf

### variables added with generate_variables.sh script

variable "compartment_ocid" {
     default = "ocid1.tenancy.oc1..some0cidHere"
}


variable "ssh_public_key_path" {
   default = "/home/zack/.ssh/id_rsa.pub"
}


variable "ssh_private_key_path" {
   default = "/home/zack/.ssh/id_rsa"
}


variable "bucket_namespace" {
   default = "s0medatah3re"
}

variable "mysql_db_system_availability_domain" {
   default = "Aodz:EU-FRANKFURT-1-AD-2"
}


variable "instance_image" {
   default = "ocid1.image.oc1.eu-frankfurt-1.aaaaaaaa2fbceq23oofnxf4v23urfnfzui6n6det6ianoyvtmsbo5nzv2efq"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://isaac-exe.gitbook.io/mds-presentation/structure/part-1-preparing-the-environment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
