0% found this document useful (0 votes)
21 views3 pages

AWS Session 16

aws lectures by sunil

Uploaded by

koustub
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views3 pages

AWS Session 16

aws lectures by sunil

Uploaded by

koustub
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Session - 16

What is VPC
Undesrstanding Subnet
Creating VPC and Subnet
Behaviuor of Public and Private Subnet
Working With Internet Gateways (IGW)
Working with Route Table
Making Subnet Public

Subnets are partitions created inside VPC

We have different types of servers


Web Server
Application Server
Database Server

We can not dump all servers directly.

Web Servers – we want everyone in the world to access web server


Always request will be sent to web server. From the web server, request will be sent to database server

User request will not be sent to database directly.


So, we will be creating 2 subnets, one for web server and one for database server.

For one subnet we will provide range 10.0.1.0/24


for second subnet we will provide range 10.0.2.0/24

Web Server 10.0.1.0/24 256 subnets


DB Server 10.0.2.0/24 256 subnets

By default subnet are private, I want to make one subnet as public ( as we want to make WebSN as Public )

Practical

Select Mumbai region.

Step – 1 Create VPC (10.0.0.0/16)

Services > Network and Content Delivery> VPC

We have some default VPCs , Default subnets and Default Route Tables.

Your VPC -> Create VPC ->


Name Tag -MyVPC
Ipv4 CIDR Block – 10.0.0.0/16
(Note : Our VPC can have maxium 2 to the power 16 machines)

Create -> Close

Step – 2

Inside VPC we are creating 1st subnet.


In Dashboard -> Subnets -> Create Subnet

Name Tag – WebSN


VPC – MyVPC ( Select our subnet)
Availibility Zone – ap-southeast-1a (Select any Availability Zone)
Ipv4 CIDR Block – 10.0.1.0/24
Name Tag – 10.0.1.0/24 - ap-southeast-1a ( Ipv4 – availabilty zone is the naming convention)

Create -> Close

Step – 3

Inside VPC we are creating 2nd subnet.

In Dashboard -> Subnets -> Create Subnet

Name Tag – DbSN


VPC – MyVPC ( Select our subnet)
Availibility Zone – ap-southeast-1a (Select any Availability Zone)
Ipv4 CIDR Block – 10.0.1.0/24
Name Tag – 10.0.1.0/24 - ap-southeast-1a ( Ipv4 – availabilty zone is the naming convention)

Create -> Close

Observe “Available Ipv4” column , it is showing as 251. But we should get 2^8 = 256 That means 5 IP addresses are
missing.
Note : In every subnet 5 Ip address are reserver. Just search in google “Reserver IP address in AWS”. Select VPC and
Subnet sizing. We can see the list of IPs which are reserved. (first 4 and the last IP are reserved)

10.0.0.0 10.0.0.1 10.0.0.2 10.0.0.3 10.0.0.255

Note : Every Subnet will be by default private.

We want to make one subnet as public. To make subnet public , its two step process.

Step 1 – we need to enable public IP

Select the subnet (10.0.1.0/24) -> Actions -> Edit Subnet Settings Modify the Auto Assing IPSettings -> Enable Auto
Assign public Ipv4 Addesss -> Save
(From now, Public Ip will be assigned to the macihnes in the subnet)

Step 2 – Create internet gateway


(we have one default internet gateway, do not disturb this)

Create Internet gateway -> Name tag – MyIGW -> Create -> Close

Observation – Status is “dettached”


Select “MyIGW” -> Actions -> Attach to VPC -> Select out VPC -> Attach

Now we can not Attach internet gateway to subnet. So we create new Route Table.

Select Route Tables.


Observation : we have 2 route tables. One route table attached to default VPC. Another route table attached to our
VPC ( MyVPC )

Creating New Route Table


Create Route Table -> Name Tag – InternetRT -> VPC : MyVPC -> Create -> Close

Now we need to connect Route Table to subnet.


Select Route Table (InternetRT) -> Actions -> Edit Subnet Association -> select webSN -> Save Association
Now another end of Route Table we need to connect to Internet Gateway.
Select Route Table (InternetRT) -> Actions -> Edit Routes -> Add routes -> Target : Internet Gateways (MyIGW) ->
Destination 0.0.0.0/0 (Mendatory) -> Save Changes

Now our subnet is public subnet.

Now, lets launch webserver in public subnet.

Services – EC2 – Launch Instance – step 3 Network : MyVPC , Subnet 10.0.1.0/24

-- Additional Details : User Data

#!/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

You might also like