VPC to VNET connection between AWS and Azure - Site-to-Site VPN
Tags: aws, azure, vpn, transitgateway
Published: 2023-07-16 16:38:00


![vnet to vpc connection](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ksalny0sdaxy199f82u.png)

##Overview
In this blog we will be going throgh how we can configure a site2site vpn connection between AWS and Azure to make a private communication between them. The above figure is the architecture we will be implementing.

##Implementation
First we will configure the Azure part and we will move to AWS 
###Create An Azure Virtual Network (VNET)
In azure first create a resource group and create VNET with CIDR range 172.10.0.0/16 and one subnet with CIDR range 172.10.1.0/24

![Vnet in Azure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gs6kbt3gn4jiew06dlut.png)

###Create Gateway Subnet 
Create Gateway Subnet with CIDR range 172.10.5.0/27. Gateway subnet in the VNet is needed to configure an Azure VPN Gateway. 


![Gateway subnet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wq9z7wsfnxovms4c9v2y.png)

###Create Azure Virtual Network Gateway
Now we can create a virtual network gateway. This may take some time to create.

![Network Gateway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rzbjcmxmllmr3ba0k46k.png)

We have setup Azure configuration now moving towards AWS part
###Create An AWS Virtual Private Network (VPC)
Now come to AWS side and create a VPC with CIDR range 192.16.0.0/16


![AWS VPC](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ggp0c2j0rapy23miar3h.png)

create subnet with CIDR range 192.16.1.0/24. Associate the subnet by going to the route table.


![Subnet creation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8t43by5i0ew98iz3tmth.png)

###Create Customer Gateway
Goto customer gateway section in the console and click on it, and in IP address place, give the Public IP  Azure Virtual Network Gateway.


![Customer Gateway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2zcysfrrn6hwg4jexedo.png)

###Create AWS Virtual Private Gateway



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g39vuci9x8dvjs2ccdob.png)

###Create a Site-to-Site VPN
create a VPN connection by clicking on VPN connection from the panel. Select Routing Option is Static and add Azure VPC CIDR range.

![Site to site vpn](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mmdvch1pyjocr981bktl.png)

After, VPN is successfully created, download the configuration for the vpn and you need to select the vendor as Generic. With this configuration file will setup Local Network Gateway in Azure.

![VPN creation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kbnhpu8ngsen19vubm8n.png)


We now again continue to the Azure part of configuration

###Create Azure Local Network Gateway
Now create 2 local network gateways for high availability.


![Local Network Gateway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aa557rbcxg2xkr413yzo.png)

From configuration select the public ip address and give aws vpn that public ip.

###Create a Connection  
Add new connection by selecting Local network gateway , shared keys and configuration as required.

![Connection creation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/glotbhoa103p52l7sua3.png)

##configure routes
###Create route table in Azure .

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ikcixugyl19bqjeha98.png)

Add a new route to a CIDR range of AWS VPC and pointing to the Virtual Network Gateway.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7fmyfm5oydkfd2jqdf1f.png)

###Create route table in aws
Follow the same procedure as above and add a route to the CIDR of azure vpc pointing to the virtual private gateway.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tne96szzyd9h3ukaos0f.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rs9jwxcxc5az4wtnd6p1.png)


##Conclusion
After following the above pocedures your sitetosite vpn . To check if there is network communication between the two vpc and vnet deploy instances without public ip in both subnets and check for connection using, rdp telnet and so on.