Step 1: Prepare your AWS Account
- Ensure you have an AWS account and necessary permissions to create and manage VPC resources.
Step 2: Create VPCs
1.In the AWS Management Console, navigate to the VPC Dashboard in
the Mumbai region (ap-south-1).
- Create a VPC in the Mumbai region with a CIDR block of your choice. Note down the VPC ID.
- Repeat the same process to create a VPC in the Northern Virginia region (us-east-1) and note down its VPC ID.
Step 3: Create Subnets
In the Mumbai region, go to the VPC Dashboard and select "Subnets" from the sidebar.
- - Create a public subnet within the Mumbai VPC, specifying a CIDR block that falls within the VPC's CIDR range. Note down the subnet ID.
- - Repeat the same process to create a database subnet withi the Mumbai VPC.
Step 4: Create Security Groups
In the Mumbai region, go to the EC2 Dashboard and select "Security Groups" from the sidebar.
- - Create a security group for the public server, allowing inbound connections on the desired ports (e.g., HTTP, SSH).
- - Create another security group for the database server, allowing inbound connections only from the public server's security group.
Step 5: Launch Instances
- - In the Mumbai region, launch an EC2 instance for the public server, placing it in the public subnet. Assign the appropriate security group.
- - Launch another EC2 instance for the database server, placing it in the database subnet. Assign the appropriate security group.
Step 6: Create a VPC Peering Connection
In the Mumbai region, go to the VPC Dashboard and select "Peering Connections" from the sidebar.
- - Click "Create Peering Connection" and specify the VPC ID of the Mumbai VPC.
- - Repeat the same process in the Northern Virginia region, specifying the VPC ID of the Northern Virginia VPC.
- - Once both peering connections are created, note down their peering connection IDs.
Step 7: Accept Peering Connection Requests
- - In the Mumbai region, select the peering connection created in the Northern Virginia region.
- - Click "Actions" and choose "Accept Request" to accept the peering connection.
- - Repeat the same process in the Northern Virginia region, accepting the peering connection request from the Mumbai region.
Step 8: Update Route Tables
- - In the Mumbai region, go to the VPC Dashboard and select "Route Tables" from the sidebar.
- - Choose the route table associated with the Mumbai VPC and click "Edit Routes."
- - Add a route to the Northern Virginia VPC's CIDR block via the peering connection ID.
4.- In the Northern Virginia region, repeat the process to update the route table associated with the Northern Virginia
VPC.
Step 9: Test Connectivity
- - Connect to the public server in the Northern Virginia region via SSH or RDP.
Use the private IP address of the database server in the Mumbai region to establish a connection and perform any required database operations.
That's it! You have successfully set up a peering connection manually between the Mumbai and Northern Virginia regions in AWS. Remember to clean up any resources you no longer need to avoid unnecessary costs.
Top comments (0)