왜 NAT를 안 쓰려고 하나?

항목 NAT Gateway
비용 시간당 ~$0.045 + 데이터 전송비
월 고정비 AZ당 약 $32
경기 환경 없어도 채점 가능한 경우 많음

방법 1: VPC Endpoint (가장 많이 씀)

AWS 서비스와 통신할 때 인터넷을 거치지 않고 AWS 내부망으로 직접 연결

Gateway Endpoint (무료)

Private Subnet EC2 ──────▶ S3
                    ──────▶ DynamoDB

Interface Endpoint (유료, 시간당 ~$0.01)

Private Subnet EC2 ──────▶ ENI(내 VPC 안) ──────▶ AWS 서비스
자주 쓰는 서비스 Endpoint 타입
S3 Gateway (무료)
Secrets Manager Interface
CloudWatch Logs Interface
KMS Interface
EC2 메타데이터 기본 제공 (Endpoint 불필요)
SSM Interface

실습 예시 (경기 과제 기준)

# Private Subnet App EC2가 하는 것들
S3에서 바이너리 다운로드       → S3 Gateway Endpoint
Secrets Manager에서 DB 정보    → Secrets Manager Interface Endpoint
CloudWatch Logs로 로그 전송    → CloudWatch Logs Interface Endpoint

NAT 없이 전부 가능!


방법 2: VPC Peering / Transit Gateway

다른 VPC의 리소스(RDS 등)에 접근할 때

App VPC (Private) ──── TGW 또는 Peering ──── DB VPC (Private)