DEV Community

Cover image for AMAZON VPC - PEERING & ROUTE 53.
Surya Shankar
Surya Shankar

Posted on • Updated on

AMAZON VPC - PEERING & ROUTE 53.

VPC PEERING

  • A VPC peering connection is a network connection between two VPCs that allows you to direct traffic between them using private IPv4 or IPv6 addresses.

  • Instances in any VPC can communicate with each other as if they were on the same network.

  • You can create a pairing connection between your own VPCs or with a VPC from another AWS account.

  • VPCs can be in different regions (also known as cross-region VPC pairing connection).

  • A VPC pairing connection helps you make data transfer easier. For example, if there is more than one AWS account, you can pair the VPCs between those accounts to create a file sharing network. You can also use a VPC pairing connection to allow other VPCs to access the features you have in one of your VPCs.

Lets Create this setup

Image description

LAB WORK

Lets create a VPC in Mumbai region.
VPC name :- VPC-1
Ipv4 CIDR :- 10.0.0.0/16

Image description

Create a public subnet inside that VPC
Subnet name :- Public-subnet
AZ :- ap-south-1a
Ipv4 CIDR :- 10.0.1.0/24

Create a private subnet inside that VPC
Subnet name :- private-subnet
AZ :- ap-south-1b
Ipv4 CIDR :- 10.0.2.0/24

Image description

Create an Internet Gateway and attach it with VPC

Image description

Create Route tables for public and private subnet with subnet association and attach internet gateway routes to public subnet.

Image description

Launch a public instance inside a public subnet and private instance inside a private subnet.[Disable public IP of that private instance]

Image description

_

You are not able to ssh inside this private server [Due to no internet & no public ip].
You can only ssh it only when you are inside any public server present in the same network area.
_

Create a target group and attach it with load balancer.

Image description

Image description

Host a simple website inside that public server for testing purpose.

Image description

You can't SSH into the private instance because there is no internet.

Create a VPC inside N.Virginia.
Lets create a VPC in Mumbai region.
VPC name :- VPC-B
Ipv4 CIDR :- 11.0.0.0/16

Image description

Create a public subnet inside that VPC
Subnet name :- Public-subnet-B
AZ :- ap-south-1a
Ipv4 CIDR :- 11.0.1.0/24

Image description

Create an Internet Gateway and attach it with VPC

Image description

Create Route tables for public subnet with subnet association and attach internet gateway routes to public subnet.

Image description

Launch a public instance inside that public subnet.

Image description

Create a target group and attach it with load balancer.

Image description

Image description

Host a simple website inside that server for testing purpose.

Image description
[Make sure that load balancer dns also showing this website as it is attached to this instance]

Now Lets create VPC Peering
Go to Mumbai region
Click on peering connection
Name:-mumbai-peering
Select your local VPC
Copy the VPC id of N.v and paste in another region place.
create connection
Image description

Accepct the request in another region

Image description

Now Go to routes and inside Mumbai region routes paste the N.v VPC id and vice versa.

Image description
Image description
Image description
Image description
Image description
Image description

VPC Peering setup completed...now You can access mumbai server through N.v server.

Image description

ROUTE 53

  • Amazon Route 53 is a highly available and scalable Domain Name System (DNS) web service. You can use Route 53 to perform three main functions in any combination: domain registration, DNS routing, and health check. If you choose to use Route 53 for all three functions, perform the steps in this order:

1. Domain Registration & Domain Hosting
Your site needs a name, such as example.com. Route 53 allows you to register a name for your website or web application, known as a domain name.

2. Route Internet traffic to your domain resources

When a user opens a web browser and informs their domain name (example.com) or subdomain name (acme.example.com) in the address bar, Route 53 helps connect the browser to the website or web application.

3. Check the health of your resources (Health Checks)

Route 53 sends automatic requests over the Internet to a resource, such as a web server, to verify that it is accessible, available, and functional. You can also choose to receive notifications when a feature becomes unavailable and choose to divert Internet traffic from unhealthy resources.

Now the Question is if there is any problem/issue inside that mumbai server then how to routes all traffic to another region,so that we will never face any down time in future.

  • We can route the traffic using failover routing policy.

Lab Work
Go to freenom or any domain registration site and purchase a domain.
Put that domain name inside the hosted zones of rout53.

Image description

Copy and paste the name servers.

Image description

Create Two Health check

Image description

Then click on create records
Go for failover routing policies.
Put mumbai region as primary and N.v as secondary.

Image description
Image description

Image description

Now type systemctl stop httpd inside your Mumbai public server, it will route traffic to N.v server.

Image description
[In case if there will be any problem in Mumbai server then it will route the traffic to N.V server. ]

Image description

It will automatically routes the traffic to Mumbai server when it will be healthy.

Discussion (0)