0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【AWS勉強メモ】NAT Gateway とグローバル高可用性のベストプラクティス

Posted at

【AWS勉強メモ】NAT Gateway とグローバル高可用性のベストプラクティス

📌 今日の学び:プライベートサブネットのEC2がインターネットに安定接続する方法

✅ シナリオ

  • EC2インスタンスが us-east-1 リージョンの3つのアベイラビリティゾーンに分散配置されている。
  • それらはすべて プライベートサブネット に存在しており、外部から直接アクセスできない。
  • アプリケーションの要件として、インターネットへのアウトバウンド通信(ファイルダウンロードなど)が必要。
  • 同時に、**高可用性(HA)**も求められており、AZ障害時も通信断が起きないようにする必要がある。

❗課題

  • プライベートサブネット内のEC2は直接インターネットにアクセスできない。
  • 代わりに NAT(Network Address Translation) を通してアクセスさせる必要がある。

✅ ベストプラクティス:各AZにNAT Gatewayを配置する

サブネットタイプ リソース例
パブリックサブネット NAT Gateway, Internet Gateway
プライベートサブネット EC2インスタンスなど

📘 構成イメージ

[Private Subnet EC2 (AZ-a)]
        |
        | Route Table
        v
[NAT Gateway (AZ-a) in Public Subnet]
        |
        v
[Internet Gateway] → Internet

🛠 実装手順の概要

  1. 各AZに1つずつ パブリックサブネット + NAT Gateway を作成
  2. プライベートサブネットのルートテーブルに対応する NAT Gatewayへのルートを設定
  3. インスタンスがいるAZと同じAZ内のNAT Gatewayを経由することで、 低レイテンシ & 高可用性を確保

❌ 他の選択肢とその理由

選択肢 理由
NATインスタンス 管理が煩雑。パブリックサブネットでないと機能せず非推奨。
Transit Gateway VPC間接続用で、インターネット通信とは関係なし。
Internet Gatewayだけ配置 プライベートサブネット内のインスタンスには使えない。

🧠 まとめ

  • プライベートサブネットからのインターネット接続には NAT Gateway が必要。
  • 高可用性構成を実現するためには、各AZにNAT Gatewayを配置するのがベスト。
  • AWSのネットワーク設計では、「AZ間障害対策」が非常に重要!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?