Amazon Virtual Private Cloud, shortly known as Amazon VC or simply VPC, is a virtual network dedicated to your AWS account, that enables you to launch AWS resources to a virtual network you defined. It is the networking layer of your Amazon EC2. In this article, I will be sharing a walkthrough on how to carry out VPC peering in Amazon Web Services (AWS).
A VPC peering connection is a one to one relationship between two VPCs. It is a networking connection between two VPCs that allows you to route traffic between them privately. You can create a peering connection between two of your VPCs, or with a VPC of another AWS account.
For this article we will be peering an RDS database and an Amazon workspace, each having different VPCs.
Here is what you’ll need:
1)A running RDS database on AWS. I am using Microsoft SQL.
2) Amazon workspace.
1. Log in to AWS console (https://console.aws.amazon.com/console/home)
2. Select “RDS” from the Database menu to launch it.
3. Select the database you want to peer with the AWS workspace by clicking on it.
4. From the page displayed afterward, Copy the VPC security group to your clipboard.
We now have the VPC of the RDS database. The next thing to do is to get the VPC of the Amazon workspace.
5. Search for “workspace” using the search tab on your console’s interface.
6. Select the AWS workspace whose VPC you want to peer. You can reach out to your AWS admin to get the VPC of the Workspace.
The next thing to do is to carry out the VPC peering in AWS.
Search for VPC and click on it.
7. Click on Your VPC, as indicated by the yellow arrow in the image above, to see the VPCs running on your AWS console.
8. to establish peering, click on Peering Connections as indicated by the green arrow in the image above.
9. Select “Create Peering” and fill in the parameters as shown in the image below:
- Peering Connection name (indicated with the blue arrow): Put your desire peering name/tag
- VPC (Requester) (indicated with the orange arrow): Input the VPC of the AWS cloud service that wants to connect to another. In this scenario, the VPC of the RDS database.
- Select another VPC to peer with (indicated with the green arrow): Select the account and region where the other VPC is. In this scenario, we will choose “My account” and “This region”. This is because the two AWS services (RDS and workspace) were created with my account and are in the same region. Choose the second option if otherwise.
- VPC (Accepter) (indicated with the yellow arrow): The VPC of the AWS cloud service that wants to accept the connection. In this scenario, the VPC of the AWS workspace.
10. Select “Create Peering Connection” to establish a VPC peering connection. After the peering connection has been established, you should something like the picture below:
VPC peering in Amazon Web Services has quite a few limitations and restrictions. You can check them out here.