Overview
클라우드 네트워킹에서 다양한 리소스 간의 안전하고 효율적인 연결은 현대 IT 인프라의 핵심이다. Google Cloud Platform(GCP)은 온프레미스 환경, 다른 클라우드 제공업체, 그리고 GCP 내부 리소스 간의 연결을 위한 다양한 네트워킹 옵션을 제공한다.
VPC Peering은 같은 조직 내 또는 서로 다른 조직의 VPC 간 프라이빗 연결을 제공하며, Cloud Interconnect는 온프레미스 네트워크와 GCP 간의 전용 연결을 통해 높은 대역폭과 낮은 지연시간을 보장한다. Cloud VPN은 인터넷을 통한 암호화된 터널을 제공하여 비용 효율적인 하이브리드 연결을 가능하게 한다.
최근 GCP의 네트워킹 서비스는 더욱 정교해졌다. Shared VPC를 통한 중앙집중식 네트워크 관리, Cloud Router의 BGP 라우팅 최적화, 그리고 Cross-Cloud Interconnect를 통한 멀티클라우드 연결까지 지원하고 있다. 특히 네트워크 보안과 성능을 동시에 고려한 아키텍처 설계가 중요해지고 있다.
이 글에서는 각 연결 방식의 원리와 특성을 심층 분석하고, 실제 운영 환경에서의 적용 시나리오, 비용 분석, 그리고 최적화 전략을 제시한다. 또한 Terraform을 활용한 실제 구현 예제와 하이브리드 클라우드 아키텍처 설계 패턴도 함께 다룬다.

VPC 네트워킹 기초 개념
VPC(Virtual Private Cloud) 이해
VPC는 GCP에서 제공하는 가상 네트워크 환경으로, 물리적으로 격리된 클라우드 네트워크를 제공한다. 각 VPC는 독립적인 네트워크 공간을 가지며, 서브넷, 라우팅 테이블, 방화벽 규칙 등을 포함한다.
VPC의 핵심 구성 요소
- 서브넷: 특정 리전 내의 IP 주소 범위
- 라우팅 테이블: 트래픽 경로 정의
- 방화벽 규칙: 네트워크 보안 제어
- 피어링 연결: 다른 VPC와의 연결
- 게이트웨이: 외부 네트워크와의 연결점
# 기본 VPC 구성
resource "google_compute_network" "main_vpc" {
name = "main-vpc"
auto_create_subnetworks = false
description = "Main VPC for production workloads"
}
resource "google_compute_subnetwork" "web_subnet" {
name = "web-subnet"
ip_cidr_range = "10.0.1.0/24"
region = "us-central1"
network = google_compute_network.main_vpc.id
secondary_ip_range {
range_name = "pods"
ip_cidr_range = "10.1.0.0/16"
}
secondary_ip_range {
range_name = "services"
ip_cidr_range = "10.2.0.0/16"
}
}
resource "google_compute_subnetwork" "db_subnet" {
name = "db-subnet"
ip_cidr_range = "10.0.2.0/24"
region = "us-central1"
network = google_compute_network.main_vpc.id
}
VPC Peering vs Shared VPC 설계 패턴
VPC Peering 개념과 원리
VPC Peering은 두 VPC 간의 네트워크 연결을 제공하여 프라이빗 IP 주소를 통한 통신을 가능하게 한다. 이는 소프트웨어 정의 네트워킹을 통해 구현되며, 두 VPC의 라우팅 테이블에 피어 VPC로의 경로를 자동으로 추가한다.
VPC Peering의 동작 원리
- 피어링 요청: 한쪽 VPC에서 다른 VPC로 피어링 요청 전송
- 피어링 승인: 대상 VPC에서 요청 승인
- 라우팅 설정: 양쪽 VPC의 라우팅 테이블 자동 업데이트
- 트래픽 전달: 프라이빗 IP를 통한 직접 통신
# VPC Peering 구성
resource "google_compute_network" "production_vpc" {
name = "production-vpc"
auto_create_subnetworks = false
}
resource "google_compute_network" "development_vpc" {
name = "development-vpc"
auto_create_subnetworks = false
}
resource "google_compute_network_peering" "prod_to_dev" {
name = "prod-to-dev-peering"
network = google_compute_network.production_vpc.self_link
peer_network = google_compute_network.development_vpc.self_link
auto_create_routes = true
# 커스텀 라우트 가져오기/내보내기 설정
export_custom_routes = true
import_custom_routes = true
}
resource "google_compute_network_peering" "dev_to_prod" {
name = "dev-to-prod-peering"
network = google_compute_network.development_vpc.self_link
peer_network = google_compute_network.production_vpc.self_link
auto_create_routes = true
export_custom_routes = true
import_custom_routes = true
}
Shared VPC 개념과 설계
Shared VPC는 조직 내에서 네트워크 리소스를 중앙집중식으로 관리할 수 있게 해주는 기능이다. 호스트 프로젝트에서 VPC를 관리하고, 서비스 프로젝트에서 해당 VPC의 서브넷을 사용할 수 있다.
Shared VPC의 장점
- 중앙집중식 네트워크 관리: 네트워크 정책과 보안 규칙의 일관성 유지
- 비용 효율성: 네트워크 리소스 공유로 비용 절감
- 보안 강화: 네트워크 관리 권한의 명확한 분리
- 규정 준수: 엔터프라이즈 거버넌스 요구사항 충족
# Shared VPC 구성
resource "google_compute_shared_vpc_host_project" "host" {
project = var.host_project_id
}
resource "google_compute_shared_vpc_service_project" "service1" {
host_project = google_compute_shared_vpc_host_project.host.project
service_project = var.service_project1_id
}
resource "google_compute_shared_vpc_service_project" "service2" {
host_project = google_compute_shared_vpc_host_project.host.project
service_project = var.service_project2_id
}
# Shared VPC 네트워크
resource "google_compute_network" "shared_vpc" {
name = "shared-vpc"
auto_create_subnetworks = false
project = var.host_project_id
depends_on = [google_compute_shared_vpc_host_project.host]
}
# 서비스 프로젝트용 서브넷
resource "google_compute_subnetwork" "service1_subnet" {
name = "service1-subnet"
ip_cidr_range = "10.1.0.0/24"
region = "us-central1"
network = google_compute_network.shared_vpc.id
project = var.host_project_id
}
resource "google_compute_subnetwork" "service2_subnet" {
name = "service2-subnet"
ip_cidr_range = "10.2.0.0/24"
region = "us-central1"
network = google_compute_network.shared_vpc.id
project = var.host_project_id
}
VPC Peering vs Shared VPC 비교
| 특성 | VPC Peering | Shared VPC |
| 관리 방식 | 분산형 관리 | 중앙집중식 관리 |
| 조직 구조 | 독립적인 프로젝트 간 연결 | 조직 내 프로젝트 통합 |
| 네트워크 정책 | 각 VPC별 개별 관리 | 호스트 프로젝트에서 통합 관리 |
| 비용 | 각 프로젝트별 과금 | 호스트 프로젝트 통합 과금 |
| 보안 관리 | 개별 VPC 보안 관리 | 중앙집중식 보안 관리 |
| 라우팅 | 피어링 기반 라우팅 | 단일 VPC 내 라우팅 |
| 확장성 | 피어링 제한 존재 | 서브넷 기반 확장 |
| 적용 시나리오 | 서로 다른 조직/팀 연결 | 같은 조직 내 리소스 공유 |
Cloud Interconnect 심층 분석
Cloud Interconnect 개념과 원리
Cloud Interconnect는 온프레미스 네트워크와 Google Cloud 간의 전용 네트워크 연결을 제공한다. 이는 인터넷을 경유하지 않는 프라이빗 연결로, 높은 대역폭과 낮은 지연시간, 안정적인 성능을 보장한다.
Cloud Interconnect의 동작 원리
- 물리적 연결: 온프레미스 라우터와 Google 네트워크 간 직접 연결
- BGP 세션: Border Gateway Protocol을 통한 라우팅 정보 교환
- VLAN 태깅: 802.1Q VLAN을 통한 논리적 연결 분리
- 라우팅 전파: Cloud Router를 통한 동적 라우팅
Dedicated Interconnect
Dedicated Interconnect는 고객의 온프레미스 네트워크와 Google 네트워크 간의 직접적인 물리적 연결을 제공한다.
# Dedicated Interconnect 구성
resource "google_compute_interconnect_attachment" "dedicated" {
name = "dedicated-attachment"
interconnect = var.interconnect_name
description = "Dedicated interconnect attachment"
bandwidth = "BPS_10G"
candidate_subnets = ["169.254.1.0/29"]
# VLAN 설정
vlan_tag8021q = 100
}
# Cloud Router 구성
resource "google_compute_router" "interconnect_router" {
name = "interconnect-router"
region = "us-central1"
network = google_compute_network.main_vpc.id
bgp {
asn = 65000
advertise_mode = "CUSTOM"
advertised_groups = ["ALL_SUBNETS"]
advertised_ip_ranges {
range = "10.0.0.0/16"
description = "On-premises network"
}
}
}
# BGP 피어 설정
resource "google_compute_router_interface" "interconnect_interface" {
name = "interconnect-interface"
router = google_compute_router.interconnect_router.name
region = google_compute_router.interconnect_router.region
ip_range = "169.254.1.1/30"
vpn_tunnel = google_compute_interconnect_attachment.dedicated.id
}
resource "google_compute_router_peer" "interconnect_peer" {
name = "interconnect-peer"
router = google_compute_router.interconnect_router.name
region = google_compute_router.interconnect_router.region
peer_ip_address = "169.254.1.2"
peer_asn = 65001
advertised_route_priority = 100
interface = google_compute_router_interface.interconnect_interface.name
}
Partner Interconnect
Partner Interconnect는 Google Cloud Partner를 통해 Google 네트워크에 연결하는 방식이다.
# Partner Interconnect 구성
resource "google_compute_interconnect_attachment" "partner" {
name = "partner-attachment"
type = "PARTNER"
region = "us-central1"
description = "Partner interconnect attachment"
# Partner에서 제공하는 pairing key
pairing_key = var.partner_pairing_key
# 대역폭 설정
bandwidth = "BPS_1G"
candidate_subnets = ["169.254.2.0/29"]
vlan_tag8021q = 200
}
# Partner Interconnect용 Cloud Router
resource "google_compute_router" "partner_router" {
name = "partner-router"
region = "us-central1"
network = google_compute_network.main_vpc.id
bgp {
asn = 16550
advertise_mode = "DEFAULT"
}
}
Dedicated vs Partner Interconnect 비교
| 특성 | Dedicated Interconnect | Partner Interconnect |
| 연결 방식 | 직접 물리 연결 | 파트너 경유 연결 |
| 최소 대역폭 | 10Gbps | 50Mbps |
| 최대 대역폭 | 200Gbps | 50Gbps |
| 월 비용 (10Gbps) | $1,650 | $250-500 |
| 데이터 전송 비용 | $0.02/GB | $0.02/GB |
| 설치 시간 | 2-4주 | 1-2주 |
| SLA | 99.9% | 99.9% |
| 적용 시나리오 | 대용량 트래픽 | 중소 규모 연결 |
Cloud VPN 구성과 최적화
Cloud VPN 개념과 원리
Cloud VPN은 IPsec VPN 터널을 통해 온프레미스 네트워크와 Google Cloud VPC를 안전하게 연결한다. 인터넷을 통한 암호화된 연결로 비용 효율적인 하이브리드 연결을 제공한다.
Cloud VPN의 종류
- Classic VPN: 기본적인 IPsec VPN 연결
- HA VPN: 고가용성을 위한 이중화 VPN 연결
# HA VPN 구성
resource "google_compute_ha_vpn_gateway" "main" {
name = "main-ha-vpn-gateway"
region = "us-central1"
network = google_compute_network.main_vpc.id
}
# 외부 VPN 게이트웨이 (온프레미스)
resource "google_compute_external_vpn_gateway" "onprem" {
name = "onprem-gateway"
redundancy_type = "SINGLE_IP_INTERNALLY_REDUNDANT"
description = "On-premises VPN gateway"
interface {
id = 0
ip_address = var.onprem_gateway_ip
}
}
# VPN 터널 구성
resource "google_compute_vpn_tunnel" "tunnel1" {
name = "ha-vpn-tunnel1"
region = "us-central1"
vpn_gateway = google_compute_ha_vpn_gateway.main.id
vpn_gateway_interface = 0
peer_external_gateway = google_compute_external_vpn_gateway.onprem.id
peer_external_gateway_interface = 0
shared_secret = var.shared_secret
ike_version = 2
router = google_compute_router.vpn_router.id
}
resource "google_compute_vpn_tunnel" "tunnel2" {
name = "ha-vpn-tunnel2"
region = "us-central1"
vpn_gateway = google_compute_ha_vpn_gateway.main.id
vpn_gateway_interface = 1
peer_external_gateway = google_compute_external_vpn_gateway.onprem.id
peer_external_gateway_interface = 0
shared_secret = var.shared_secret_2
ike_version = 2
router = google_compute_router.vpn_router.id
}
# VPN용 Cloud Router
resource "google_compute_router" "vpn_router" {
name = "vpn-router"
region = "us-central1"
network = google_compute_network.main_vpc.id
bgp {
asn = 64512
advertise_mode = "DEFAULT"
}
}
# BGP 세션 구성
resource "google_compute_router_interface" "vpn_interface1" {
name = "vpn-interface1"
router = google_compute_router.vpn_router.name
region = "us-central1"
ip_range = "169.254.1.1/30"
vpn_tunnel = google_compute_vpn_tunnel.tunnel1.name
}
resource "google_compute_router_peer" "vpn_peer1" {
name = "vpn-peer1"
router = google_compute_router.vpn_router.name
region = "us-central1"
peer_ip_address = "169.254.1.2"
peer_asn = 65001
advertised_route_priority = 100
interface = google_compute_router_interface.vpn_interface1.name
}
Cloud Router와 BGP 라우팅 전략
Cloud Router 개념과 역할
Cloud Router는 Google Cloud에서 제공하는 완전 관리형 라우터 서비스로, BGP(Border Gateway Protocol)를 통해 동적 라우팅을 제공한다.
Cloud Router의 핵심 기능
- 동적 라우팅: BGP를 통한 자동 라우트 학습 및 광고
- 고가용성: 다중 인터페이스 및 피어 지원
- 라우트 필터링: 커스텀 라우트 정책 적용
- 로드 밸런싱: ECMP(Equal Cost Multi-Path) 지원
# 고급 Cloud Router 구성
resource "google_compute_router" "advanced_router" {
name = "advanced-router"
region = "us-central1"
network = google_compute_network.main_vpc.id
bgp {
asn = 64512
advertise_mode = "CUSTOM"
# 특정 서브넷만 광고
advertised_groups = []
advertised_ip_ranges {
range = "10.0.1.0/24"
description = "Web tier subnet"
}
advertised_ip_ranges {
range = "10.0.2.0/24"
description = "App tier subnet"
}
}
}
# 라우트 정책 적용
resource "google_compute_router_peer" "advanced_peer" {
name = "advanced-peer"
router = google_compute_router.advanced_router.name
region = "us-central1"
peer_ip_address = "169.254.1.2"
peer_asn = 65001
advertised_route_priority = 100
interface = google_compute_router_interface.advanced_interface.name
# 커스텀 라우트 필터
advertise_mode = "CUSTOM"
advertised_groups = ["ALL_SUBNETS"]
advertised_ip_ranges {
range = "192.168.1.0/24"
description = "Corporate network"
}
}
BGP 라우팅 최적화 전략
1. 라우트 우선순위 설정
# 기본 연결과 백업 연결의 우선순위 차등 적용
resource "google_compute_router_peer" "primary_peer" {
name = "primary-peer"
router = google_compute_router.main_router.name
region = "us-central1"
peer_ip_address = "169.254.1.2"
peer_asn = 65001
advertised_route_priority = 100 # 높은 우선순위
interface = google_compute_router_interface.primary_interface.name
}
resource "google_compute_router_peer" "backup_peer" {
name = "backup-peer"
router = google_compute_router.main_router.name
region = "us-central1"
peer_ip_address = "169.254.2.2"
peer_asn = 65002
advertised_route_priority = 200 # 낮은 우선순위 (백업용)
interface = google_compute_router_interface.backup_interface.name
}
2. 라우트 필터링
# 특정 라우트만 광고하는 정책
resource "google_compute_router" "filtered_router" {
name = "filtered-router"
region = "us-central1"
network = google_compute_network.main_vpc.id
bgp {
asn = 64512
advertise_mode = "CUSTOM"
# 기본 그룹 제외
advertised_groups = []
# 명시적 라우트만 광고
advertised_ip_ranges {
range = "10.0.0.0/16"
description = "Internal network only"
}
}
}
하이브리드 클라우드 네트워크 아키텍처
다층 하이브리드 아키텍처
현대의 엔터프라이즈 환경에서는 온프레미스, 퍼블릭 클라우드, 프라이빗 클라우드를 아우르는 하이브리드 아키텍처가 필수적이다.
# 하이브리드 클라우드 아키텍처 구성
module "hybrid_network" {
source = "./modules/hybrid-network"
# 온프레미스 연결
onprem_asn = 65001
onprem_gateway_ip = var.onprem_gateway_ip
onprem_networks = ["192.168.0.0/16", "172.16.0.0/12"]
# 클라우드 네트워크
cloud_asn = 64512
vpc_networks = {
production = "10.0.0.0/16"
development = "10.1.0.0/16"
management = "10.2.0.0/16"
}
# 연결 타입
primary_connection = "interconnect"
backup_connection = "vpn"
# 보안 정책
enable_private_google_access = true
enable_flow_logs = true
}
# Interconnect + VPN 이중화 구성
resource "google_compute_router" "hybrid_router" {
name = "hybrid-router"
region = "us-central1"
network = google_compute_network.production_vpc.id
bgp {
asn = 64512
advertise_mode = "CUSTOM"
advertised_groups = ["ALL_SUBNETS"]
# 온프레미스 특정 서비스만 광고
advertised_ip_ranges {
range = "10.0.1.0/24"
description = "Public services"
}
}
}
# Primary: Dedicated Interconnect
resource "google_compute_interconnect_attachment" "primary" {
name = "primary-interconnect"
interconnect = var.dedicated_interconnect_name
bandwidth = "BPS_10G"
candidate_subnets = ["169.254.1.0/29"]
vlan_tag8021q = 100
}
# Backup: HA VPN
resource "google_compute_ha_vpn_gateway" "backup" {
name = "backup-vpn-gateway"
region = "us-central1"
network = google_compute_network.production_vpc.id
}
멀티리전 하이브리드 연결
# 멀티리전 하이브리드 연결 구성
locals {
regions = {
primary = "us-central1"
secondary = "us-east1"
disaster = "europe-west1"
}
}
# 각 리전별 VPN 게이트웨이
resource "google_compute_ha_vpn_gateway" "regional" {
for_each = local.regions
name = "${each.key}-vpn-gateway"
region = each.value
network = google_compute_network.global_vpc.id
}
# 각 리전별 Cloud Router
resource "google_compute_router" "regional" {
for_each = local.regions
name = "${each.key}-router"
region = each.value
network = google_compute_network.global_vpc.id
bgp {
asn = 64512
advertise_mode = "CUSTOM"
advertised_groups = ["ALL_SUBNETS"]
# 리전별 우선순위 차등 적용
advertised_ip_ranges {
range = "10.${index(keys(local.regions), each.key)}.0.0/16"
description = "${each.key} region networks"
}
}
}
네트워크 연결 방식 종합 비교
연결 방식별 특성 비교
| 특성 | VPC Peering | Shared VPC | Dedicated Interconnect | Partner Interconnect | Cloud VPN |
| 연결 대상 | VPC 간 | 프로젝트 간 | 온프레미스 | 온프레미스 | 온프레미스 |
| 대역폭 | 네트워크 한도 | 네트워크 한도 | 10-200Gbps | 50Mbps-50Gbps | 최대 3Gbps |
| 지연시간 | 매우 낮음 | 매우 낮음 | 낮음 | 낮음 | 중간 |
| 설정 복잡도 | 낮음 | 중간 | 높음 | 중간 | 낮음 |
| 월 비용 | 무료 | 무료 | $1,650+ | $250+ | $45+ |
| SLA | 99.9% | 99.9% | 99.9% | 99.9% | 99.9% |
| 보안 | 프라이빗 | 프라이빗 | 전용 연결 | 프라이빗 | IPsec 암호화 |
비용 분석 및 최적화
Dedicated Interconnect 비용 모델
# 비용 계산을 위한 변수 정의
locals {
# Dedicated Interconnect 비용 (10Gbps 기준)
monthly_port_cost = 1650 # USD per month
data_transfer_cost = 0.02 # USD per GB
# 월간 예상 트래픽 (GB)
monthly_traffic_gb = 10000
# 총 월간 비용
total_monthly_cost = local.monthly_port_cost + (local.monthly_traffic_gb * local.data_transfer_cost)
# Partner Interconnect 비용 비교 (1Gbps)
partner_monthly_cost = 400 # USD per month
partner_total_cost = local.partner_monthly_cost + (local.monthly_traffic_gb * local.data_transfer_cost)
# VPN 비용 비교
vpn_gateway_cost = 45 # USD per month per gateway
vpn_tunnel_cost = 36 # USD per month per tunnel
vpn_total_cost = (local.vpn_gateway_cost * 2) + (local.vpn_tunnel_cost * 2) + (local.monthly_traffic_gb * 0.045)
}
# 비용 최적화를 위한 출력
output "cost_comparison" {
value = {
dedicated_interconnect = "${local.total_monthly_cost} USD/month"
partner_interconnect = "${local.partner_total_cost} USD/month"
ha_vpn = "${local.vpn_total_cost} USD/month"
}
}
연결 방식 선택 가이드
# 트래픽 패턴에 따른 연결 방식 선택
variable "requirements" {
description = "Network requirements"
type = object({
bandwidth_gbps = number
monthly_traffic_tb = number
latency_sensitive = bool
budget_limit_usd = number
compliance_required = bool
})
}
locals {
# 요구사항에 따른 연결 방식 추천
recommended_solution = (
var.requirements.bandwidth_gbps > 10 ? "dedicated_interconnect" :
var.requirements.monthly_traffic_tb > 5 ? "partner_interconnect" :
var.requirements.latency_sensitive ? "partner_interconnect" :
var.requirements.budget_limit_usd < 500 ? "ha_vpn" :
"partner_interconnect"
)
}
output "recommended_solution" {
value = local.recommended_solution
}
고급 네트워크 보안 및 모니터링
Private Google Access와 Private Service Connect
# Private Google Access 구성
resource "google_compute_subnetwork" "private_subnet" {
name = "private-subnet"
ip_cidr_range = "10.0.1.0/24"
region = "us-central1"
network = google_compute_network.main_vpc.id
private_ip_google_access = true
# Flow Logs 활성화
log_config {
aggregation_interval = "INTERVAL_10_MIN"
flow_sampling = 0.5
metadata = "INCLUDE_ALL_METADATA"
}
}
# Private Service Connect 엔드포인트
resource "google_compute_global_address" "psc_endpoint" {
name = "psc-endpoint"
purpose = "PRIVATE_SERVICE_CONNECT"
network = google_compute_network.main_vpc.id
address_type = "INTERNAL"
}
resource "google_compute_global_forwarding_rule" "psc_forwarding_rule" {
name = "psc-forwarding-rule"
target = "all-apis"
network = google_compute_network.main_vpc.id
ip_address = google_compute_global_address.psc_endpoint.id
load_balancing_scheme = ""
}
네트워크 모니터링 및 로깅
# VPC Flow Logs 구성
resource "google_compute_subnetwork" "monitored_subnet" {
name = "monitored-subnet"
ip_cidr_range = "10.0.2.0/24"
region = "us-central1"
network = google_compute_network.main_vpc.id
log_config {
aggregation_interval = "INTERVAL_5_MIN"
flow_sampling = 1.0
metadata = "INCLUDE_ALL_METADATA"
metadata_fields = [
"src_vpc",
"dest_vpc",
"src_gke_details",
"dest_gke_details"
]
}
}
# 네트워크 태그 기반 방화벽 규칙
resource "google_compute_firewall" "web_tier" {
name = "allow-web-tier"
network = google_compute_network.main_vpc.name
allow {
protocol = "tcp"
ports = ["80", "443"]
}
source_ranges = ["0.0.0.0/0"]
target_tags = ["web-server"]
# 로깅 활성화
log_config {
metadata = "INCLUDE_ALL_METADATA"
}
}
resource "google_compute_firewall" "app_tier" {
name = "allow-app-tier"
network = google_compute_network.main_vpc.name
allow {
protocol = "tcp"
ports = ["8080", "8443"]
}
source_tags = ["web-server"]
target_tags = ["app-server"]
log_config {
metadata = "INCLUDE_ALL_METADATA"
}
}
네트워크 성능 최적화 전략
지역별 트래픽 최적화
# 멀티리전 네트워크 최적화
resource "google_compute_network" "global_network" {
name = "global-network"
auto_create_subnetworks = false
routing_mode = "GLOBAL"
}
# 리전별 서브넷 구성
resource "google_compute_subnetwork" "regional_subnets" {
for_each = {
"us-central1" = "10.1.0.0/16"
"us-east1" = "10.2.0.0/16"
"europe-west1" = "10.3.0.0/16"
"asia-east1" = "10.4.0.0/16"
}
name = "${each.key}-subnet"
ip_cidr_range = each.value
region = each.key
network = google_compute_network.global_network.id
# 리전별 Private Google Access
private_ip_google_access = true
# 세컨더리 IP 범위 (GKE용)
secondary_ip_range {
range_name = "pods"
ip_cidr_range = cidrsubnet(each.value, 8, 1)
}
secondary_ip_range {
range_name = "services"
ip_cidr_range = cidrsubnet(each.value, 8, 2)
}
}
# 리전별 Cloud NAT
resource "google_compute_router" "regional_routers" {
for_each = toset(["us-central1", "us-east1", "europe-west1", "asia-east1"])
name = "${each.key}-router"
region = each.key
network = google_compute_network.global_network.id
}
resource "google_compute_router_nat" "regional_nat" {
for_each = google_compute_router.regional_routers
name = "${each.key}-nat"
router = each.value.name
region = each.value.region
nat_ip_allocate_option = "AUTO_ONLY"
source_subnetwork_ip_ranges_to_nat = "ALL_SUBNETWORKS_ALL_IP_RANGES"
log_config {
enable = true
filter = "ERRORS_ONLY"
}
}
대역폭 및 지연시간 최적화
# Premium 네트워크 티어 구성
resource "google_compute_global_address" "premium_ip" {
name = "premium-global-ip"
address_type = "EXTERNAL"
# Premium 티어 사용 (기본값)
network_tier = "PREMIUM"
}
# 지역별 표준 티어 IP (비용 절약)
resource "google_compute_address" "standard_ip" {
for_each = toset(["us-central1", "us-east1"])
name = "${each.key}-standard-ip"
address_type = "EXTERNAL"
region = each.key
network_tier = "STANDARD"
}
# 전용 Interconnect 대역폭 모니터링
resource "google_monitoring_alert_policy" "interconnect_utilization" {
display_name = "Interconnect High Utilization"
combiner = "OR"
conditions {
display_name = "Interconnect utilization > 80%"
condition_threshold {
filter = "resource.type=\"gce_interconnect_attachment\""
comparison = "COMPARISON_GREATER_THAN"
threshold_value = 0.8
duration = "300s"
aggregations {
alignment_period = "300s"
per_series_aligner = "ALIGN_MEAN"
}
}
}
notification_channels = [var.notification_channel_id]
}
재해 복구 및 고가용성 설계
멀티리전 재해 복구 아키텍처
# 기본 리전과 재해 복구 리전 구성
variable "regions" {
description = "Primary and DR regions"
type = object({
primary = string
dr = string
})
default = {
primary = "us-central1"
dr = "us-east1"
}
}
# 각 리전별 VPC 구성
resource "google_compute_network" "regional_vpc" {
for_each = var.regions
name = "${each.key}-vpc"
auto_create_subnetworks = false
routing_mode = "REGIONAL"
}
# VPC Peering for DR
resource "google_compute_network_peering" "primary_to_dr" {
name = "primary-to-dr"
network = google_compute_network.regional_vpc["primary"].self_link
peer_network = google_compute_network.regional_vpc["dr"].self_link
auto_create_routes = true
export_custom_routes = true
import_custom_routes = true
export_subnet_routes_with_public_ip = false
import_subnet_routes_with_public_ip = false
}
resource "google_compute_network_peering" "dr_to_primary" {
name = "dr-to-primary"
network = google_compute_network.regional_vpc["dr"].self_link
peer_network = google_compute_network.regional_vpc["primary"].self_link
auto_create_routes = true
export_custom_routes = true
import_custom_routes = true
export_subnet_routes_with_public_ip = false
import_subnet_routes_with_public_ip = false
}
# 각 리전별 온프레미스 연결
resource "google_compute_ha_vpn_gateway" "regional_gateways" {
for_each = var.regions
name = "${each.key}-vpn-gateway"
region = each.value
network = google_compute_network.regional_vpc[each.key].id
}
# 자동 페일오버를 위한 Health Check
resource "google_compute_health_check" "primary_health" {
name = "primary-region-health"
check_interval_sec = 10
timeout_sec = 3
healthy_threshold = 2
unhealthy_threshold = 3
tcp_health_check {
port = "80"
}
}
네트워크 자동화 및 IaC 관리
# 네트워크 구성 모듈화
module "enterprise_network" {
source = "./modules/enterprise-network"
# 기본 설정
project_id = var.project_id
regions = var.regions
# 네트워크 설정
vpc_configs = {
production = {
cidr_range = "10.0.0.0/16"
enable_flow_logs = true
subnets = {
web = "10.0.1.0/24"
app = "10.0.2.0/24"
db = "10.0.3.0/24"
}
}
staging = {
cidr_range = "10.1.0.0/16"
enable_flow_logs = false
subnets = {
web = "10.1.1.0/24"
app = "10.1.2.0/24"
db = "10.1.3.0/24"
}
}
}
# 연결 설정
interconnect_config = {
type = "partner"
bandwidth = "1Gbps"
vlan_tag = 100
}
# 보안 설정
firewall_rules = {
allow_web = {
ports = ["80", "443"]
source_ranges = ["0.0.0.0/0"]
target_tags = ["web-server"]
}
allow_ssh = {
ports = ["22"]
source_ranges = [var.admin_cidr]
target_tags = ["admin-access"]
}
}
}
마무리
GCP의 네트워크 연결 옵션들은 각각 고유한 장점과 적용 시나리오를 가지고 있어, 조직의 요구사항에 맞는 최적의 선택이 중요하다.
VPC Peering은 간단하고 비용 효율적인 VPC 간 연결을 제공하며, Shared VPC는 대규모 조직의 중앙집중식 네트워크 관리를 가능하게 한다.
Cloud Interconnect는 온프레미스와의 고성능 연결을 위한 최적의 선택이며, Dedicated Interconnect는 대용량 트래픽을, Partner Interconnect는 중소 규모의 연결을 효과적으로 처리한다.
Cloud VPN은 가장 경제적인 하이브리드 연결 방식으로, 중간 규모의 트래픽과 백업 연결에 적합하다.
핵심 선택 기준
- 비용 대비 성능: 트래픽 패턴과 예산을 고려한 연결 방식 선택이 중요하다. 월 10TB 이상의 트래픽이라면 Interconnect가, 그 이하라면 VPN이 비용 효율적이다.
- 지연시간 요구사항: 실시간 애플리케이션이나 고성능 컴퓨팅에는 Dedicated Interconnect를, 일반적인 엔터프라이즈 애플리케이션에는 Partner Interconnect나 HA VPN이 적합하다.
- 보안 및 규정 준수: 금융이나 의료 등 엄격한 규정이 있는 산업에서는 전용 연결인 Dedicated Interconnect를 권장한다.
- 확장성과 관리 편의성: Shared VPC는 대규모 조직의 네트워크 거버넌스를, VPC Peering은 독립적인 프로젝트 간 유연한 연결을 제공한다.
- 재해 복구: 멀티리전 구성과 다중 연결 방식을 통한 고가용성 확보가 필수적이다.
Cloud Router와 BGP를 통한 동적 라우팅은 네트워크의 자동화와 최적화에 핵심적인 역할을 한다. 특히 ECMP를 활용한 로드 밸런싱과 우선순위 기반 경로 선택을 통해 네트워크 성능을 극대화할 수 있다.
적절한 네트워크 아키텍처는 애플리케이션의 성능, 보안, 그리고 운영 효율성을 크게 좌우한다. 이 가이드에서 제시한 설계 패턴과 최적화 전략을 바탕으로, 조직의 요구사항에 최적화된 하이브리드 클라우드 네트워크를 구축하시기 바란다.
Reference
공식 Google Cloud 문서
- GCP VPC Documentation - VPC 네트워킹 기본 개념과 구성
- Cloud Interconnect Documentation - 전용 연결 서비스 가이드
- Cloud VPN Documentation - IPsec VPN 터널 구성
- VPC Peering Documentation - VPC 간 피어링 연결
- Shared VPC Documentation - 공유 VPC 설정 및 관리
- Cloud Router Documentation - 동적 라우팅 구성
- BGP Routing Best Practices - BGP 라우팅 최적화 방법
네트워크 보안 및 고급 기능
- GCP Network Security Documentation - 네트워크 보안 서비스
- Private Google Access Documentation - 프라이빗 구글 액세스 구성
- Private Service Connect Documentation - 프라이빗 서비스 연결
- Cloud NAT Documentation - 클라우드 NAT 서비스
- VPC Flow Logs Documentation - 네트워크 트래픽 로깅
- Cloud Armor Documentation - DDoS 방어 및 WAF
- Network Intelligence Center - 네트워크 모니터링 및 분석
아키텍처 및 설계 가이드
- GCP Architecture Framework - 클라우드 아키텍처 설계 원칙
- Hybrid and Multi-cloud Architecture Patterns - 하이브리드 클라우드 패턴
- Network Security Design Patterns - 네트워크 보안 설계 패턴
- Enterprise Networking on GCP - 엔터프라이즈 네트워킹 가이드
- Multi-region Architecture - 멀티 리전 아키텍처 패턴
Terraform 및 자동화
- Terraform Google Cloud Provider - Terraform GCP 프로바이더
- Terraform Network Module - 네트워크 모듈
- Cloud Foundation Toolkit - IaC 템플릿 및 모듈
- Config Connector - Kubernetes 기반 리소스 관리
비용 및 운영 최적화
- GCP Network Pricing - 네트워크 서비스 요금
- Cloud Interconnect Pricing - 인터커넥트 요금 구조
- Cloud VPN Pricing - VPN 서비스 요금
- Cost Optimization Best Practices - 비용 최적화 방법
- Network Performance Guide - 네트워크 성능 튜닝
모니터링 및 문제 해결
- Cloud Monitoring Documentation - 모니터링 서비스 가이드
- Cloud Logging Documentation - 로깅 서비스 구성
- Network Troubleshooting Guide - 네트워크 문제 해결
- Connectivity Tests - 연결성 테스트 도구
- Performance Dashboard - 성능 대시보드
규정 준수 및 보안
- Security Command Center - 보안 모니터링 센터
- Compliance Resource Center - 규정 준수 가이드
- Data Residency Guide - 데이터 주권 가이드
- GDPR Compliance - GDPR 준수 방안
- SOC 2 Type II Report - SOC 2 인증 정보
커뮤니티 및 학습 리소스
- Google Cloud Networking Specialist Certification - 네트워킹 전문가 자격증
- Cloud OnBoard - 무료 교육 프로그램
- Google Cloud Blog - Networking - 네트워킹 관련 블로그
- Stack Overflow - Google Cloud Platform - 기술 질문 및 답변
- Google Cloud Community - 사용자 커뮤니티
- GitHub - GoogleCloudPlatform - 샘플 코드 및 도구
Somaz | DevOps Engineer | Kubernetes & Cloud Infrastructure Specialist
'GCP' 카테고리의 다른 글
| GCP Load Balancer 완전 비교 가이드 (0) | 2026.01.08 |
|---|---|
| GCP에서 딥러닝을 위한 GPU VM 서버 만들기(GCP) (0) | 2024.03.04 |
| Terraform 으로 GCS 생성후 Cloud CDN 생성(GCP) (0) | 2024.01.22 |
| GCP를 활용한 데이터 자동화(MongoDB, CloudSQL, GA, Dune) (2) | 2023.12.22 |
| Shared VPC를 사용하여 GKE 클러스터 생성시 IAM 설정 (0) | 2023.10.08 |