Showing posts with label OCI. Show all posts
Showing posts with label OCI. Show all posts

Friday 2 July 2021

OCI - Configuring connection to the instance from Putty session

Oracle Cloud Infrastructure -  Configuring connection to the instance from Putty session 

  • Putty release 0.75



[root@srv3 apptierkey]# ll
total 8
-rwxr-x--- 1 root root  399 Jun 28 13:07 Public_ssh-key-2021-06-28.key.pub
-rw------- 1 root root 1679 Jun 28 13:07 ssh-key-2021-06-28.key
[root@srv3 apptierkey]# pwd
/u01/apptierkey

  • Convert the generated private key from Pem format to rsa format

[root@srv3 apptierkey]# openssl rsa -in /u01/apptierkey/ssh-key-2021-06-28.key -out /u01/apptierkey/ssh-key-appvm-converted.key
writing RSA key
  • Copy of the produced file to linux server 


[root@srv3 apptierkey]# cp ssh-key-appvm-converted.key /media/sf_vitual_machine/
cp: cannot create regular file `/media/sf_vitual_machine/ssh-key-appvm-converted.key': Read-only file system
[root@srv3 apptierkey]# cd /media/sf_vitual_machine/
  • Puttygen ( Convert the produced key file ssh-key-appvm-converted.key to PPK format ) 




  • Select he conversions menu , select the key  and  Import Key   file 

  • Saved key status  for reference 




  • Save private key in .ppk format 



  • Open putty  and mention public ip address in console 








  • Select connection and data menu  and mention auto login username opc 


  • Connection >> authentication  and select the ppk key format 



  • Save setting and connect instance using putty





























Tuesday 29 June 2021

OCI - Connection from AppTier ( Public Subnet ) to DBTier (Private Subnet)

  •   Connection from AppTier ( Public Subnet ) to DBTier (Private Subnet)



  • Select the any of the bucket in OCI


  • Upload key to Objects bucket



  • Upload key to the Objects


  • Select Pre Authenticated Request 


  • Create Pre -Authenticated Request 


  • Copy Pre authenticated request URL 



  • Login to app tier instance public subnet

[opc@appvm ~]$ mkdir dbtier1_key
[opc@appvm ~]$ cd dbtier1_key
[opc@appvm dbtier1_key]$ pwd
/home/opc/dbtier1_key
[opc@appvm dbtier1_key]$

  • Download the private key file into the keys subdirectory /home/opc/dbtier1_key
[opc@appvm dbtier1_key]$ wget https://objectstorage.ap-mumbai-1.oraclecloud.com/p/DK-PWGjxeY9XthOioCZIRO7ijKkT3ANVDkc9SsdpCs7fn4YOBuN7olL6TCME4i0/n/bmdsoh48o0kf/b/bucket-20210415-1806/o/dbtier_private_keydb_ssh-key-2021-06-28.key.key


--2021-06-28 13:07:08--  https://objectstorage.ap-mumbai-1.oraclecloud.com/p/DK-PWGjxeY9XthOioCZIRO7i-jKkT3ANVDkc9SsdpCs7fn4YOBuN7olL6TCME4i0/n/bmdsoh48o0kf/b/bucket-20210415-1806/o/dbtier_private_keydb_ssh-key-2021-06-28.key.key
Resolving objectstorage.ap-mumbai-1.oraclecloud.com (objectstorage.ap-mumbai-1.oraclecloud.com)... 134.70.76.3
Connecting to objectstorage.ap-mumbai-1.oraclecloud.com (objectstorage.ap-mumbai-1.oraclecloud.com)|134.70.76.3|:443... connected.
HTTP request sent, awaiting response... 200 OK

Length: 1679 (1.6K) [application/octet-stream]
Saving to: ‘dbtier_private_keydb_ssh-key-2021-06-28.key.key’

100%[=============================================================================================================================>] 1,679       --.-K/s   in 0s

2021-06-28 13:07:08 (270 MB/s) - ‘dbtier_private_keydb_ssh-key-2021-06-28.key.key’ saved [1679/1679]

[opc@appvm dbtier1_key]$ ll
total 4
-rw-rw-r--. 1 opc opc 1679 Jun 28 13:01 dbtier_private_keydb_ssh-key-2021-06-28.key.key
[opc@appvm dbtier1_key]$

  • Change key  permission to chmod 600

[opc@appvm dbtier1_key]$ chmod 600 dbtier_private_keydb_ssh-key-2021-06-28.key.key
[opc@appvm dbtier1_key]$ ll
total 4
-rw-------. 1 opc opc 1679 Jun 28 13:01 dbtier_private_keydb_ssh-key-2021-06-28.key.key
[opc@appvm dbtier1_key]$


[opc@appvm dbtier1_key]$ hostname
appvm

  • Login dbtier instance private subnet from public subnet using downloaded key
[opc@appvm dbtier1_key]$ ssh -i dbtier_private_keydb_ssh-key-2021-06-28.key.key opc@10.0.2.118
Last login: Mon Jun 28 13:01:53 2021
Welcome to Autonomous Linux
Effective kernel version is 5.4.17-2102.201.3.el7uek.x86_64

Please add OCI notification service topic OCID with
$ sudo al-config -T [topic OCID]

[opc@dbvm1 ~]$ hostname
dbvm1
[opc@dbvm1 ~]$

[opc@dbvm1 ~]$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.0.2.118 dbvm1.dbtier1.varunvcn.oraclevcn.com dbvm1
[opc@dbvm1 ~]$


OCI - Create Instance and connect on linux machine

 Configuring connection to the vm from a Linux shell session

  • Create Compute Instance 




  • Select Image and shape 



  • Networking : Select subnet 







  • Save private Key and public key  and create instance 








  • Login to any linux server that we wanted to connect and create directory  copy private and public key to linux directory so we can get connect to apptier instance 

[root@srv3 app]# mkdir -p /u01/apptierkey
[root@srv3 app]# cp ssh-key-2021-06-28.key Public_ssh-key-2021-06-28.key.pub /u01/apptierkey
[root@srv3 app]# cd /u01/apptierkey
[root@srv3 apptierkey]# ll
total 8
-rwxr-x--- 1 root root  399 Jun 28 13:07 Public_ssh-key-2021-06-28.key.pub
-rwxr-x--- 1 root root 1679 Jun 28 13:07 ssh-key-2021-06-28.key

  • Provide chmod 600 permission to private key 
[root@srv3 apptierkey]# chmod 600 ssh-key-2021-06-28.key
[root@srv3 apptierkey]#



  • Copy public IP address




[root@srv3 apptierkey]# ll
total 8
-rwxr-x--- 1 root root  399 Jun 28 13:07 Public_ssh-key-2021-06-28.key.pub
-rw------- 1 root root 1679 Jun 28 13:07 ssh-key-2021-06-28.key


[root@srv3 apptierkey]# ssh -i /u01/apptierkey/ssh-key-2021-06-28.key opc@140.238.242.52
The authenticity of host '140.238.242.52 (140.238.242.52)' can't be established.
RSA key fingerprint is f3:2a:55:5b:b4:c3:43:b4:80:82:cd:20:85:dd:d5:6e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '140.238.242.52' (RSA) to the list of known hosts.


[opc@appvm ~]$ id
uid=1000(opc) gid=1000(opc) groups=1000(opc),4(adm),10(wheel),190(systemd-journal) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[opc@appvm ~]$ hostname
appvm


OCI - Create Virtual Cloud Network

 Oracle Cloud Infrastructure - Create Virtual Cloud Network  

Login oracle cloud and select dashboard 

  • Select Virtual Cloud Network


  • Create VCN 



  • Create Public Subnet 

Mention name , subnet type , CIDR Block, ROUTE TABLE COMPARTMENT , Security Lists

Subnet Access : Public Subnet / Private  Subnet 

 DNS Label 

DNS DOMAIN NAME

DHCP OPTIONS COMPARTMENT

Security Lists





















  • Create PUBLIC SUBNET 










  • Create Private Subnet  named as DBTier1 

  • Select Private Subnet options 










  • Subnet Created 







  • Create INTERNET GATEWAY for public and private subnet access 










  • Create Route Table






  • Set the Destination to 0.0.0.0/0, which typically means any host