AWS Session 17
AWS Session 17
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#!/bin/bash
sudo su
yum update -y
yum install httpd -y
cd /var/www/html
echo "Hello Google from MyVPC">index.html
service httpd start
chkconfig httpd on
Next – Next – Name Tag : WebServer – Next – Security Group : WebSG18, Description : WebSG18
ADD RULE
Type Source
SSH Anywhere
HTTP Anywhere
Review and launch – Launch – Download Keypair – (webKP18.pem) Launch – View Instance
Kp17jan2022friday.pem
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Type Source
MYSQL/Aurora Custom 10.0.1.0/24
As the DB server is in the second subnet series, we can see the IP Address (Private Ipv4 address) in will have 2. Series
(10.0.2.xx). So the machine is in the 2nd subnet.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Now, web server can pull the data from the database server.
{Note : this is the first time we are making an EC2 macine in private newwork, (we can see that tha machine has no
public Ipv4 address). They are not exposed to public. (Communication happens using public IP)
ISP (Internet Service Providers) provides th IP address to our machines
So the question is how we(or a DBA) will connect to Db server if they want to do some maintainance activity }
DBA wants to create some files. OR wants to perform maintainance activity. Can he connect ?
As the DB server is not having public IP and it is not having internet connectivity, DBA can not connect
For this we need to create Bastion Server / Jump server in public subnet. It is nothig but normal EC2 machine.
Services – EC2 – Launch – Amazon Linux Select VPC (MyVPC) , select subnet (WebSN)
{Now only we (DBA) can access the Bastion Server, so if we want to give access to someone else also, we can add
add rule and add Ip addredd of the other person as well }
Type Source
SSH Custom 10.0.1.xx/32 (Private IP of Bastion Server)
10.0.1.7
Save.
Now, Lets test if we can connect to DB server.
Open putty
Host name - user@public_ip
provide PPK file -- Connect
sudo su
yum update -y
From bastion server – we need to jump to Db server.
Now, to connect to Db server, we need to enter the details of Db server in bastion server.
Select Db server -- Connect
Copy the entire SSh command.
Note – to connect the, the .pem file need to be present in present working dorectory.
Open WinSCP
we will connect to bastion server using WinSCP
host name : user@ipAddress
Advanced – authentication – private key file – select the ppk file – open – ok – login
In Putty
# ls (we should be able to see the file)