Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Transit GWでNat VPCを作成する

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

Transit GWでNat VPCを作成する

Avatar for Akira Sato

Akira Sato

March 17, 2024
Tweet

More Decks by Akira Sato

Other Decks in Technology

Transcript

  1. ざっくりやりたいこと • 検証内容ごとにVPCを分けたいけど、NAT GWの費⽤が⾼い。。 • AP-northeast-1の場合、(USD 0.062/h+ USD 0.062/GB)* VPCの数

    → 3つのVPCで1ヶ⽉稼働した場合、データの処理がなかったとしても (0.062 * 24 * 30)*3 = 133.92 (≒ 2万円) ※150円/USDの場合 → 個⼈利⽤の学習費⽤としては⾟すぎる • 認定試験等でもよく問われる構成なので作ってみよう きっかけ
  2. Transit Gatewayとは︖ • VPC、オンプレミス間の接続に利⽤できるリージョン仮想ルーター • 主な機能 • ハブとして複数のVPCを接続可能 → ピアリングの場合は相互に接続が必要になる

    • 主な⽤途 • 複数のVPC間の接続 • 複数のVPC間とVPNの接続 • アプライアンスVPCの作成 概要 参考︓Example use cases for transit gateways
  3. ⽬標のイメージ • NAT VPC から外部にアクセスできる状態 AWS Cloud Availability Zone 1a

    VPC わたし EC2 NAT gateway AWS Transit Gateway Availability Zone 1a NAT VPC NAT gateway 外部サイト 廃⽌
  4. ルートテーブルの変更 • 各VPCでのルートテーブルを変更する AWS Cloud Availability Zone 1a VPC EC2

    NAT gateway AWS Transit Gateway Availability Zone 1a NAT VPC NAT gateway ルートテーブル 10.1.0.0/16 local 0.0.0.0/0 NAT-GW 0.0.0.0/0 TGW ルートテーブル 10.0.0.0/16 local 0.0.0.0/0 NAT-GW 10.1.0.0/16 TGW ルートテーブル 10.0.0.0/16 NAT VPC Attachment 10.1.0.0/16 A-Project-VPC Attachment
  5. ルートテーブルの変更(再掲) • 各VPCでのルートテーブルを変更する AWS Cloud Availability Zone 1a VPC EC2

    NAT gateway AWS Transit Gateway Availability Zone 1a NAT VPC NAT gateway ルートテーブル 10.1.0.0/16 local 0.0.0.0/0 NAT-GW 0.0.0.0/0 TGW ルートテーブル 10.0.0.0/16 local 0.0.0.0/0 NAT-GW 10.1.0.0/16 TGW ルートテーブル 10.0.0.0/16 NAT VPC Attachment 10.1.0.0/16 A-Project-VPC Attachment 外部アクセスへの ルートがない
  6. ルートテーブルの修正 • 各VPCでのルートテーブルを変更する AWS Cloud Availability Zone 1a VPC EC2

    NAT gateway AWS Transit Gateway Availability Zone 1a NAT VPC NAT gateway ルートテーブル 10.1.0.0/16 local 0.0.0.0/0 TGW ルートテーブル 10.0.0.0/16 local 0.0.0.0/0 NAT-GW 10.1.0.0/16 TGW ルートテーブル 10.0.0.0/16 NAT VPC Attachment 10.1.0.0/16 A-Project-VPC Attachment 0.0.0.0/0 NAT VPC Attachment 追加する必要有り 参考︓Example: Centralized outbound routing to the internet
  7. おまけ • LTの中で質問いただいた結局どっちがどのくらい安いの︖について調べて みました。 • 2VPCのNAT GWをTransit Gatewayを⽤いて⼀⽅のVPCに寄せた場合です サービス 単体の料⾦

    環境合計 NAT GW USD 44.64 (⼀ヶ⽉30⽇の場合) USD 89.28 ∟データ処理料⾦ USD/GB 0.062 ︖︖︖ サービス 単体の料⾦ 環境合計 Transit GW (アタッチメント) USD 50.4 (⼀ヶ⽉30⽇の場合) USD 100.8 ∟データ処理料⾦ USD/GB 0.02 ︖︖︖ • データがほぼ処理されない場合だとUSD 11.52ほどTransit Gatewayの⽅が⾼価 • 275GB以上のデータ処理が必要となる場合においてはTransit Gatewayの⽅が安価 • リージョンによっても価格がかなり異なるのでデータ量を含めてしっかりとした⾒ 積もりが必要