1
---
2
name: hybrid-cloud-networking
3
description: Configure secure, high-performance connectivity between on-premises infrastructure and cloud platforms using VPN and dedicated connections. Use when building hybrid cloud architectures, connecting data centers to cloud, or implementing secure cross-premises networking.
4
---
5
6
# Hybrid Cloud Networking
7
8
Configure secure, high-performance connectivity between on-premises and cloud environments using VPN, Direct Connect, ExpressRoute, Interconnect, and FastConnect.
9
10
## Purpose
11
12
Establish secure, reliable network connectivity between on-premises data centers and cloud providers (AWS, Azure, GCP, OCI).
13
14
## When to Use
15
16
- Connect on-premises to cloud
17
- Extend datacenter to cloud
18
- Implement hybrid active-active setups
19
- Meet compliance requirements
20
- Migrate to cloud gradually
21
22
## Connection Options
23
24
### AWS Connectivity
25
26
#### 1. Site-to-Site VPN
27
28
- IPSec VPN over internet
29
- Up to 1.25 Gbps per tunnel
30
- Cost-effective for moderate bandwidth
31
- Higher latency, internet-dependent
32
33
```hcl
34
resource "aws_vpn_gateway" "main" {
35
vpc_id = aws_vpc.main.id
36
tags = {
37
Name = "main-vpn-gateway"
38
}
39
}
40
41
resource "aws_customer_gateway" "main" {
42
bgp_asn = 65000
43
ip_address = "203.0.113.1"
44
type = "ipsec.1"
45
}
46
47
resource "aws_vpn_connection" "main" {
48
vpn_gateway_id = aws_vpn_gateway.main.id
49
customer_gateway_id = aws_customer_gateway.main.id
50
type = "ipsec.1"
51
static_routes_only = false
52
}
53
```
54
55
#### 2. AWS Direct Connect
56
57
- Dedicated network connection
58
- 1 Gbps to 100 Gbps
59
- Lower latency, consistent bandwidth
60
- More expensive, setup time required
61
62
**Reference:** See `references/direct-connect.md`
63
64
### Azure Connectivity
65
66
#### 1. Site-to-Site VPN
67
68
```hcl
69
resource "azurerm_virtual_network_gateway" "vpn" {
70
name = "vpn-gateway"
71
location = azurerm_resource_group.main.location
72
resource_group_name = azurerm_resource_group.main.name
73
74
type = "Vpn"
75
vpn_type = "RouteBased"
76
sku = "VpnGw1"
77
78
ip_configuration {
79
name = "vnetGatewayConfig"
80
public_ip_address_id = azurerm_public_ip.vpn.id
81
private_ip_address_allocation = "Dynamic"
82
subnet_id = azurerm_subnet.gateway.id
83
}
84
}
85
```
86
87
#### 2. Azure ExpressRoute
88
89
- Private connection via connectivity provider
90
- Up to 100 Gbps
91
- Low latency, high reliability
92
- Premium for global connectivity
93
94
### GCP Connectivity
95
96
#### 1. Cloud VPN
97
98
- IPSec VPN (Classic or HA VPN)
99
- HA VPN: 99.99% SLA
100
- Up to 3 Gbps per tunnel
101
102
#### 2. Cloud Interconnect
103
104
- Dedicated (10 Gbps, 100 Gbps)
105
- Partner (50 Mbps to 50 Gbps)
106
- Lower latency than VPN
107
108
### OCI Connectivity
109
110
#### 1. IPSec VPN Connect
111
112
- IPSec VPN with redundant tunnels
113
- Dynamic routing through DRG
114
- Good fit for branch offices and migration phases
115
116
#### 2. OCI FastConnect
117
118
- Private dedicated connectivity through Oracle or partner edge
119
- Suitable for predictable throughput and lower-latency hybrid traffic
120
- Commonly paired with DRG for hub-and-spoke designs
121
122
## Hybrid Network Patterns
123
124
### Pattern 1: Hub-and-Spoke
125
126
```
127
On-Premises Datacenter
128
↓
129
VPN/Direct Connect
130
↓
131
Transit Gateway (AWS) / vWAN (Azure)
132
↓
133
├─ Production VPC/VNet
134
├─ Staging VPC/VNet
135
└─ Development VPC/VNet
136
```
137
138
### Pattern 2: Multi-Region Hybrid
139
140
```
141
On-Premises
142
├─ Direct Connect → us-east-1
143
└─ Direct Connect → us-west-2
144
↓
145
Cross-Region Peering
146
```
147
148
### Pattern 3: Multi-Cloud Hybrid
149
150
```
151
On-Premises Datacenter
152
├─ Direct Connect → AWS
153
├─ ExpressRoute → Azure
154
├─ Interconnect → GCP
155
└─ FastConnect → OCI
156
```
157
158
## Routing Configuration
159
160
### BGP Configuration
161
162
```
163
On-Premises Router:
164
- AS Number: 65000
165
- Advertise: 10.0.0.0/8
166
167
Cloud Router:
168
- AS Number: 64512 (AWS), 65515 (Azure), provider-assigned for GCP/OCI
169
- Advertise: Cloud VPC/VNet CIDRs
170
```
171
172
### Route Propagation
173
174
- Enable route propagation on route tables
175
- Use BGP for dynamic routing
176
- Implement route filtering
177
- Monitor route advertisements
178
179
## Security Best Practices
180
181
1. **Use private connectivity** (Direct Connect/ExpressRoute/Interconnect/FastConnect)
182
2. **Implement encryption** for VPN tunnels
183
3. **Use VPC endpoints** to avoid internet routing
184
4. **Configure network ACLs** and security groups
185
5. **Enable VPC Flow Logs** for monitoring
186
6. **Implement DDoS protection**
187
7. **Use PrivateLink/Private Endpoints**
188
8. **Monitor connections** with CloudWatch/Azure Monitor/Cloud Monitoring/OCI Monitoring
189
9. **Implement redundancy** (dual tunnels)
190
10. **Regular security audits**
191
192
## High Availability
193
194
### Dual VPN Tunnels
195
196
```hcl
197
resource "aws_vpn_connection" "primary" {
198
vpn_gateway_id = aws_vpn_gateway.main.id
199
customer_gateway_id = aws_customer_gateway.primary.id
200
type = "ipsec.1"
201
}
202
203
resource "aws_vpn_connection" "secondary" {
204
vpn_gateway_id = aws_vpn_gateway.main.id
205
customer_gateway_id = aws_customer_gateway.secondary.id
206
type = "ipsec.1"
207
}
208
```
209
210
### Active-Active Configuration
211
212
- Multiple connections from different locations
213
- BGP for automatic failover
214
- Equal-cost multi-path (ECMP) routing
215
- Monitor health of all connections
216
217
## Monitoring and Troubleshooting
218
219
### Key Metrics
220
221
- Tunnel status (up/down)
222
- Bytes in/out
223
- Packet loss
224
- Latency
225
- BGP session status
226
227
### Troubleshooting
228
229
```bash
230
# AWS VPN
231
aws ec2 describe-vpn-connections
232
aws ec2 get-vpn-connection-telemetry
233
234
# Azure VPN
235
az network vpn-connection show
236
az network vpn-connection show-device-config-script
237
238
# OCI IPSec VPN
239
oci network ip-sec-connection list
240
oci network cpe list
241
```
242
243
## Cost Optimization
244
245
1. **Right-size connections** based on traffic
246
2. **Use VPN for low-bandwidth** workloads
247
3. **Consolidate traffic** through fewer connections
248
4. **Minimize data transfer** costs
249
5. **Use dedicated private links** for high bandwidth
250
6. **Implement caching** to reduce traffic
251
252
253
## Related Skills
254
255
- `multi-cloud-architecture` - For architecture decisions
256
- `terraform-module-library` - For IaC implementation
257