Site to Site VPN
S2S VPN is a dedicated tunnel-based VPN service that securely and directly connects on-premises networks and AWS VPCs using IPsec. It can securely connect customer IDCs, internal data centers, branch networks, etc., with the AWS cloud as if they were a single network.
Components #
Customer Gateway (CGW): The VPN endpoint on the on-premises side; the device type can be one of the following:
- Physical firewall/router (Cisco, Juniper, Fortigate, Palo Alto, etc.)
- Virtual router
- Software-based VPN device
This device establishes a secure tunnel with AWS using IPSec IKEv1/v2.
Virtual Private Gateway (VGW) or Transit Gateway (TGW)
This is the AWS-side VPN endpoint.
- VGW is primarily used for a single VPC target.
- TGW is used for multiple VPCs, multi-region connections, and hub-and-spoke architectures.
Two IPSec Tunnels
AWS automatically provides two tunnels for redundancy purposes for the same VPN connection.
- Tunnel 1, Tunnel 2
- The on-premises device sends traffic through one of them and automatically fails over if one goes down.
Operational Structure #
- IPsec-based Encryption
- Phase 1 (IKE Phase 1): Mutual authentication and SA (Security Association) creation.
- Phase 2 (IKE Phase 2): Creation of the actual data encryption tunnel.
- Data is encrypted and transmitted using the ESP protocol.
- Routing via BGP (Optional)
- Static routing is also possible.
- However, most use BGP Peering for automatic route exchange.
- BGP offers excellent health check and failover performance.
Purpose of Use #
The purpose is secure communication between on-premises data centers and AWS, and
integration with AWS DBs or AI calls, ERP, and business systems from DBAs, internal servers, and internal systems.
Used as a backup link in case of Direct Connect failure.
Establishing internal routing hubs between AWS for global enterprises, etc.
Limitations #
Bandwidth is limited. While it's approximately 1.25 Gbps per tunnel, it's typically considered to be around 500-700 Mbps in practice. If high performance is needed, Direct Connect (DX) is used in conjunction.
Being internet-based, it traverses physical internet paths, leading to latency fluctuations and potential packet loss.
There's also an MTU issue; due to IPsec encapsulation, the effective MTU is reduced, which may require adjustment. Typically around 1436?
Configuration Example Flow #
- On-premises firewall has a public IP.
- Create an S2S VPN in AWS.
- Automatically:
- Tunnel 1, 2 endpoint IPs
- IKE settings
- Pre-Shared Key
- Routing information, etc., are generated.
- Apply these settings to the on-premises device.
- Tunnel is up.
- BGP Peering is established, and routing tables are automatically synchronized.
- Communication between both networks is possible.

