In this article, I will show you the steps to create a VPC peering connection same region in AWS environment in same region.
AWS VPC Peering Connection Same Region
How to Create VPC
1- Login to your AWS account and go to the AWS Services tab and then select VPC under Networking & Content Delivery.
![aws resource manager services](https://xpertstec.com/wp-content/uploads/2020/10/aws-resource-manager-services.webp)
1st VPC
2- Under Virtual Private Cloud select Your VPCs
Click on Create VPC.
![aws create vpc](https://xpertstec.com/wp-content/uploads/2020/10/aws-create-vpc.webp)
3- Create VPC wizard,
Name tag – VPC1.
IPv4 CIDR block – 10.0.0.0/16.
Tenancy – default
Click Create
![aws create vpc-](https://xpertstec.com/wp-content/uploads/2020/10/aws-create-vpc-.webp)
4- Click close.
![the following vpc was created](https://xpertstec.com/wp-content/uploads/2020/10/the-following-vpc-was-created.webp)
Create 2nd VPC
1- Click create VPC
![aws create vpc](https://xpertstec.com/wp-content/uploads/2020/10/aws-create-vpc-1.webp)
2- Name tag – VPC2.
IPv4 CIDR block – 192.168.0.0/16.
Tenancy – default
Click Create
![aws create vpc-](https://xpertstec.com/wp-content/uploads/2020/10/aws-create-vpc-1-1.webp)
3- Click close
![the following vpc was created](https://xpertstec.com/wp-content/uploads/2020/10/the-following-vpc-was-created-1.webp)
4- Now you can see two VPC created.
![aws your VPCs](https://xpertstec.com/wp-content/uploads/2020/10/aws-your-VPCs.webp)
Create Subnet in AWS
1- Select Subnets and then choose Create Subnet.
![subnets aws](https://xpertstec.com/wp-content/uploads/2020/10/subnets-aws.webp)
2- Name tag – VPC1-Subnet.
VPC – choose VPC that we have created earlier.
Availability Zone – Select one zone.
IPv4 CIDR block – type a valid CIDR. (For example – 10.0.0.0/24)
Click Create.
![create subnet aws](https://xpertstec.com/wp-content/uploads/2020/10/create-subnet-aws.webp)
3- Click close
![following subnets successfully created](https://xpertstec.com/wp-content/uploads/2020/10/following-subnets-successfully-created.webp)
2nd Subnet
1- Choose to create a subnet.
![subnet amazon management console](https://xpertstec.com/wp-content/uploads/2020/10/subnet-amazon-management-console.webp)
2- Name tag – VPC2-Subnet.
VPC – choose the VPC that we have created earlier.
Availability Zone – Select one zone.
IPv4 CIDR block – type a valid CIDR. (For example – 192.168.0.0/24)
Click Create.
![create subnet aws](https://xpertstec.com/wp-content/uploads/2020/10/create-subnet-aws-1.webp)
3- Click close
![following subnets successfully created](https://xpertstec.com/wp-content/uploads/2020/10/following-subnets-successfully-created-1.webp)
4- Subnets successfully created.
![subnet amazon management console](https://xpertstec.com/wp-content/uploads/2020/10/subnet-amazon-management-console-1.webp)
Create Internet Gateway
1- Choose Internet Gateways new option and then click on Create Internet Gateway.
![aws create internet gateway](https://xpertstec.com/wp-content/uploads/2020/10/aws-create-internet-gateway.webp)
2- Enter a name (VPC-IGW) in the Name tag text box and then click Create an Internet Gateway.
![aws create internet gateway name](https://xpertstec.com/wp-content/uploads/2020/10/aws-create-internet-gateway-name.webp)
3- The internet gateway has been created is in a detached state. Now we want to attach it to our VPC.
In the action menu select Attach to VPC.
![aws internet gateway detached](https://xpertstec.com/wp-content/uploads/2020/10/aws-internet-gateway-detached.webp)
4- Select your VPC1 from the drop-down list and then click Attach internet gateway.
![attach internet gateway](https://xpertstec.com/wp-content/uploads/2020/10/attach-internet-gateway.webp)
5- The internet gateway changes to the attached state.
![internet gateway status attached](https://xpertstec.com/wp-content/uploads/2020/10/internet-gateway-status-attached.webp)
2nd Internet gateway
1- Click Create Internet Gateway.
![aws create internet gateway](https://xpertstec.com/wp-content/uploads/2020/10/aws-create-internet-gateway-1.webp)
2- Enter a name (VPC2-IGW) in the Name tag text box and then click Create an Internet Gateway.
![aws create internet gateway name](https://xpertstec.com/wp-content/uploads/2020/10/aws-create-internet-gateway-name-1.webp)
3- The internet gateway has been created is in a detached state. Now we want to attach it to your VPC.
Select Attach to VPC.
![aws internet gateway detached](https://xpertstec.com/wp-content/uploads/2020/10/aws-internet-gateway-detached-1.webp)
4- Select your VPC2 from the drop-down list and then click Attach Internet gateway.
![attach internet gateway](https://xpertstec.com/wp-content/uploads/2020/10/attach-internet-gateway-1.webp)
5- The internet gateway changes to the attached state.
![internet gateway status attached](https://xpertstec.com/wp-content/uploads/2020/10/internet-gateway-status-attached-1.webp)
Create Route Table
1st Route Table
1- Select Route Tables.
Click on Create route table.
![create route table](https://xpertstec.com/wp-content/uploads/2020/10/create-route-table.webp)
2- Name tag – Type a name for your route table (VPC1-Route).
VPC – Select your VPC1, and then select Create.
![create route table name](https://xpertstec.com/wp-content/uploads/2020/10/create-route-table-name.webp)
3- Click Close
![route table was created](https://xpertstec.com/wp-content/uploads/2020/10/route-table-was-created.webp)
2nd Route Table
1- Click Create Route Table.
![create route table](https://xpertstec.com/wp-content/uploads/2020/10/create-route-table-1.webp)
2- Name tag – Type a name for your route table (VPC2-Route).
VPC – Select your VPC2, and then select Create.
![create route table name](https://xpertstec.com/wp-content/uploads/2020/10/create-route-table-name-1.webp)
3- Click Close
![route table was created](https://xpertstec.com/wp-content/uploads/2020/10/route-table-was-created-1.webp)
4- Two routes were successfully created.
![create route table](https://xpertstec.com/wp-content/uploads/2020/10/create-route-table-2.webp)
CREATING VPC PEERING CONNECTION
1- Under the virtual private cloud, click on peering connections.
![create route table](https://xpertstec.com/wp-content/uploads/2020/10/create-route-table-3.webp)
2- Click on the Create Peering Connection button.
![create peering connection aws](https://xpertstec.com/wp-content/uploads/2020/10/create-peering-connection-aws.webp)
3- Type a name for the peering connection
VPC (Requester) select the VPC1 from the drop-down list.
![create peering connection requester](https://xpertstec.com/wp-content/uploads/2020/10/create-peering-connection-requester.webp)
4- We have created the two VPC’s under the same AWS region.
Select another VPN to peer with VPC2
![create peering connection accepter](https://xpertstec.com/wp-content/uploads/2020/10/create-peering-connection-accepter.webp)
5- After selecting VPC (Requester) and VPC (Accepter) click create peering connection.
![create peering connection aws](https://xpertstec.com/wp-content/uploads/2020/10/create-peering-connection-aws-1.webp)
6- Click OK.
![create peering connection success](https://xpertstec.com/wp-content/uploads/2020/10/create-peering-connection-success.webp)
7- Now, the peering connection is created and in pending status.
![create peering connection pending](https://xpertstec.com/wp-content/uploads/2020/10/create-peering-connection-pending.webp)
Accepting Connection
8- Click on the Action menu and then click Accept Request.
![create peering connection accept](https://xpertstec.com/wp-content/uploads/2020/10/create-peering-connection-accept.webp)
9- Click on the Yes, Accept button.
![accept vpc peering connection](https://xpertstec.com/wp-content/uploads/2020/10/accept-vpc-peering-connection.webp)
10- VPC peering connection has been established successfully.
![accept vpc peering connection request](https://xpertstec.com/wp-content/uploads/2020/10/accept-vpc-peering-connection-request.webp)
11- Now peering connection is in active status.
![create peering connection active aws](https://xpertstec.com/wp-content/uploads/2020/10/create-peering-connection-active-aws.webp)
Routing of public subnets
Now you need to configure the routing for our subnets. Enable traffic from the subnets to Internet via the internet gateway attached to the VPC.
1- Select VPC1-Route, Select Routes tab and then click Edit routes.
![edit routes aws](https://xpertstec.com/wp-content/uploads/2020/10/edit-routes-aws.webp)
2- Click Add route.
![edit routes target aws](https://xpertstec.com/wp-content/uploads/2020/10/edit-routes-target-aws.webp)
3- Click on the Add rules button for the destination, enter 0.0.0.0/0 (all packets for the internet), and then for targets, select the Internet Gateway.
![edit routes target](https://xpertstec.com/wp-content/uploads/2020/10/edit-routes-target.webp)
4- Select (VPC1-IGW) have created as in the earliest.
![edit routes target aws](https://xpertstec.com/wp-content/uploads/2020/10/edit-routes-target-aws-1.webp)
5- Click on the Add button again, type 192.168.0.0/24.
Under Target, select peering connection
![edit routes target aws](https://xpertstec.com/wp-content/uploads/2020/10/edit-routes-target-aws-2.webp)
6- Select peering VPC1-VPC2 and then click save routes.
![edit routes target aws](https://xpertstec.com/wp-content/uploads/2020/10/edit-routes-target-aws-3.webp)
7- Click close.
![routes successfully edited aws](https://xpertstec.com/wp-content/uploads/2020/10/routes-successfully-edited-aws.webp)
8- Successfully route edited.
![create route table aws](https://xpertstec.com/wp-content/uploads/2020/10/create-route-table-aws.webp)
9- Choose Subnet Associations and then choose Edit Subnet Associations.
![edit subnet associations](https://xpertstec.com/wp-content/uploads/2020/10/edit-subnet-associations.webp)
10- Select your subnet (VPC1-Subnet) and then click Save.
![edit subnet associations save](https://xpertstec.com/wp-content/uploads/2020/10/edit-subnet-associations-save.webp)
11- Select VPC2-Routes, select the Route tab and then click Edit routes.
![edit routes aws](https://xpertstec.com/wp-content/uploads/2020/10/edit-routes-aws-1.webp)
12- Click Add route.
![edit routes table aws](https://xpertstec.com/wp-content/uploads/2020/10/edit-routes-table-aws.webp)
13- Click on the Add rules button for destination type 0.0.0.0/0 (all packets for the internet), and for targets, select the Internet Gateway.
![edit routes target aws](https://xpertstec.com/wp-content/uploads/2020/10/edit-routes-target-aws-4.webp)
14- Select (VPC2-IGW) have been created as soon as possible.
![edit routes target aws](https://xpertstec.com/wp-content/uploads/2020/10/edit-routes-target-aws-5.webp)
15- Click on the Add button again and type 10.0.0.0/24.
Under Target, select peering connection
![edit routes target aws](https://xpertstec.com/wp-content/uploads/2020/10/edit-routes-target-aws-6.webp)
16- Select peering VPC1-VPC2 and then click save routes.
![edit routes target aws](https://xpertstec.com/wp-content/uploads/2020/10/edit-routes-target-aws-7.webp)
17- Click close
![route successfully edited](https://xpertstec.com/wp-content/uploads/2020/10/route-successfully-edited.webp)
Successfully route edited
18- Select VPC2-Route, select Subnet Associations, and click Edit Subnet Associations.
![edit subnet associations-](https://xpertstec.com/wp-content/uploads/2020/10/edit-subnet-associations-.webp)
19- Select your first subnet (VPC2-Subnet) and then click Save.
![edit subnet associations save](https://xpertstec.com/wp-content/uploads/2020/10/edit-subnet-associations-save-1.webp)
Create Instance
1- Choose service tab, click on EC2 under compute.
![aws management console](https://xpertstec.com/wp-content/uploads/2020/10/aws-management-console.webp)
2- Choose instance tab and then click on Launch Instance button.
![aws launch instance](https://xpertstec.com/wp-content/uploads/2020/10/aws-launch-instance.webp)
3- Select Microsoft Windows Server 2019.
![aws instance choose ami](https://xpertstec.com/wp-content/uploads/2020/10/aws-instance-choose-ami.webp)
4- Select General purpose t2 micro
Click Next : Configure Instance details
![aws choose instance type](https://xpertstec.com/wp-content/uploads/2020/10/aws-choose-instance-type.webp)
5- Network – select VPC (VPC1).
Subnets – select VPC1-Subnet.
Auto Assign Public IP – select Enable.
Click on Next : Add Storage.
![aws configure instance details](https://xpertstec.com/wp-content/uploads/2020/10/aws-configure-instance-details.webp)
6- Click Next : Add Tags.
![aws add storage](https://xpertstec.com/wp-content/uploads/2020/10/aws-add-storage.webp)
7- Here we have tagged the instance (VPC-Server1)
Click on Next : Configure Security Groups
![aws add tags](https://xpertstec.com/wp-content/uploads/2020/10/aws-add-tags.webp)
8- Create a new Security Group.
Security group name – VPC-Security
Select Protocols RDP, ALL ICMP – Ipv4, Select Source Anywhere
Click on Review and Launch
![aws configure security group](https://xpertstec.com/wp-content/uploads/2020/10/aws-configure-security-group.webp)
9- Review details and parameters and then click launch.
![aws review instance launch](https://xpertstec.com/wp-content/uploads/2020/10/aws-review-instance-launch.webp)
10- Select Create a new key pair
Type a name to your key (VPC Peering key)
Click on download key pair and then save it in your secured folder
![aws key pair name](https://xpertstec.com/wp-content/uploads/2020/10/aws-key-pair-name.webp)
11- After downloading and saving your key, click launch instance.
![aws key pair name](https://xpertstec.com/wp-content/uploads/2020/10/aws-key-pair-name-1.webp)
Now we need to create a second EC2 instance
Network – VPC2
Subnet – VPC2-Subnet
Auto-assign Public IP – Enable
![second vm](https://xpertstec.com/wp-content/uploads/2020/10/11-second-vm.webp)
Add Tag
Name – VPC-Server2
![12 second vpc](https://xpertstec.com/wp-content/uploads/2020/10/12-second-vpc.webp)
Testing VPC Peering Connection Same Regions
1- Choose VPC-Server1 and then choose connect.
![aws instance connect](https://xpertstec.com/wp-content/uploads/2020/10/aws-instance-connect.webp)
2- Choose Get Password
![get password aws](https://xpertstec.com/wp-content/uploads/2020/10/get-password-aws.webp)
3- Click on choose file, select your key pair and then click decrypt password.
![key pair choose file aws](https://xpertstec.com/wp-content/uploads/2020/10/key-pair-choose-file-aws.webp)
4- Copy the password and then click on download the remote desktop file.
And login to VPC1-Server.
![get password aws](https://xpertstec.com/wp-content/uploads/2020/10/get-password-aws-1.webp)
5- Search Firewall & network Protection and open it.
![windows server search bar](https://xpertstec.com/wp-content/uploads/2020/10/windows-server-search-bar.webp)
6- Disable firewall and network protection.
![firewall network protection](https://xpertstec.com/wp-content/uploads/2020/10/firewall-network-protection.webp)
7- VPC-Server1 desktop.
Run the command prompt and then ping the VPC-Server2 IP address.
![ec2 instance desktop](https://xpertstec.com/wp-content/uploads/2020/10/ec2-instance-desktop.webp)
8- VPC-Server2 desktop.
Run the command prompt and then ping the VPC-Server IP address.
![ec2 instance desktop](https://xpertstec.com/wp-content/uploads/2020/10/ec2-instance-desktop-1.webp)