AWS SitetoSite VPN (original) (raw)

AWS Site-to-Site VPN

Last Updated : 4 Feb, 2026

AWS Site-to-Site VPN provides a secure, encrypted connection between on-premises networks and Amazon VPCs over the internet, enabling reliable communication and resource sharing across locations.

subnet

Site-to-Site VPN Connection

Setting up AWS Site-to-Site VPN Connection

The following are the steps that guides you on how to do AWS Site-to-Site VPN Connection:

**Step 1: Log in to your AWS account > Choose a region (Here I have chosen the Mumbai region) >In the console page search for as follows,

 Configuring VPC Settings

**Step 2: Create a Private subnet under it-

For that search, subnet > Click on create subnet > Fill in the details (Choose above created VPC, give a Name, Availability zone, CIDR range-10.100.0.0/24) > Click on create a subnet.

Configuring Subnets

**Step 3: Go to _route table > Click on create route > Fill in the details(Give it name and choose VPC created on step-1) > Click on create.

**Step 4: Associate route table with the _subnet- Select Route table > Subnet Associations > Edit Subnet Associations > Select above created Subnet > Save.

Configuring Subnet Associations

**Step 5: Now launch a _EC2 instance > Go to EC2 instance > Click on Launch an instance > Fill in the details( Type: t2.micro, Storage: Default, Tags – Name: give a name, Security: Give it according to your requirement, Keypair: your existing key pair or create new if you don’t have an existing keypair > Launch instance. The above steps form the AWS side network

**Step 6: Go to other regions (different from the previous one) > Then create a VPC as mentioned in Step-1(Give it CIDR -10.200.0.0/16)

Configuring VPC Settings

**Step 7: Create a Public subnet under it- For that search, _subnet > Click on create subnet > Fill in the details (Choose above created VPC, give a Name, Availability zone, CIDR range-10.200.0.0/24) > Click on create a subnet.

Defining Subnet configuration

**Step 8: Since it is a public subnet it will have access to the internet so we need an Internet gateway.

Configuring Internet Gateway Settings

Attaching VPC to IGW

**Step 9: Go to _route table > Click on create route > Fill in the details(Give it name and choose VPC created on step-6) > Click on create.

**Step 10: Add a route entry for _Internet gateway- Select Route table > Go to Routes > Click Edit Routes > Add Route(give the internet gateway created) > Save.

_Associate route table with the subnet- Select Route table > Subnet Associations > Edit Subnet Associations > Select above created Subnet > Save.

**Step 11: Now launch a _EC2 instance >Go to EC2 instance > Click on Launch an instance >Fill in the details(Type: t2.micro, Storage: Default, Tags – Name: give a name, Security: Allow port 22 for your own IP and All _TCP _and ICMP-IPv4 from sources, Keypair: your existing key pair or create new if you don’t have an existing keypair>Launch instance.

**Step 12: Now to _create Virtual Private Gateway > Search virtual private gateway > Click on create VPG > (Give it a name).

Creating Virtual Private Gateway

**Step 13: Now _go to actions > Attach VPC > Choose VPC-aws(VPC with private subnet).

Attaching VPC to IGW

**Step 14: Go to _route table>Click on edit route propagation>Enable On your Virtual private gateway on all created route tables for both the vpc.

Configuring Route Table propagation

**Step 15: Now to create _Customer Gateway > Go to Customer Gateway > Click on create CGW > Give name, give _IP address _as Public IP of Instance you launched with public subnet > Select routing as static-Keep all other things as it is > click on create.

Detailing IGW details

**Step 16: To create Site-To-Site connection: Go to _site-to-site VPN connections > Click on create VPN(Give a name, Target gateway-Virtual Private gateway(Give the VPG created above), Customer gateway-Existing(Give the CG you created above), Routing option-static) keep all others as it is and creates.

Creating VPN Connection

Customizing existing gateway

**Step 17: Download the configuration(select vendor as Openswan).

Download Configuration

**Step 18: Now SSH into your instance created with a public subnet:

sudo su

Install openswan: $ yum install openswan –y

net.ipv4.ip_forward = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0

/etc/sysctl.conf file

Configuring aws.conf file

****(IMPORTANT- Remove auth=esp line, Replace leftsubnet=Customer end VPC CIDR range and rightsubnet=AWS side VPC CIDR)**

Now to you need to ping the private Instance from the open swan instance. Give the command: ping “the-private-IP –of-Instance” –If you get a response, the setup was successful.

activating service

Use Cases of AWS Site-to-Site VPN Connection

Benefits of AWS Site-to-Site VPN Connection

Pricing of AWS Site-to-Site VPN Connection

When you set up an AWS Site-to-Site VPN connection to your Amazon VPC, you'll be billed for every hour the VPN connection is active and available. If the connection is used for even part of an hour, it will still count as a full hour of usage. Furthermore, any data that is transmitted through the VPN connection will incur standard AWS data transfer charges.

Best Practices of AWS Site-to-Site Connection

The following are the best practices of AWS Site-to-Site Connection:

Troubleshooting of AWS Site-to-Site Connection

The following are the some of the troubleshooting of AWS Site-to-Site Connection:

Features of AWS Client VPN and AWS Site-to-Site VPN

1. Features of AWS Client VPN

2. Features of AWS Site-to-Site VPN