Share
Embed
Transcript
27 slides
-
⾃⼰紹介 • 佐藤 亨(Sato Akira) • @akirarara16 • デロイトトーマツウェブサービス •
JAWS SAPPOROの運営してます • StepFunctions、CloudFormation -
ざっくりやりたいこと • 検証内容ごとに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の場合 → 個⼈利⽤の学習費⽤としては⾟すぎる • 認定試験等でもよく問われる構成なので作ってみよう きっかけ -
Transit Gatewayとは︖ • VPC、オンプレミス間の接続に利⽤できるリージョン仮想ルーター • 主な機能 • ハブとして複数のVPCを接続可能 → ピアリングの場合は相互に接続が必要になる
• 主な⽤途 • 複数のVPC間の接続 • 複数のVPC間とVPNの接続 • アプライアンスVPCの作成 概要 参考︓Example use cases for transit gateways -
開始時の状況 • Private サブネットからNAT GWを経由して外部にアクセスできる状態 AWS Cloud Availability Zone 1a
VPC わたし EC2 NAT gateway 外部サイト -
⽬標のイメージ • NAT VPC から外部にアクセスできる状態 AWS Cloud Availability Zone 1a
VPC わたし EC2 NAT gateway AWS Transit Gateway Availability Zone 1a NAT VPC NAT gateway 外部サイト 廃⽌ -
ルートテーブルの変更 • 各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 -
Reachability Analyzerを⽤いた切り分け(3/3) • 詳細より以下の⽂⾔に注⽬する “パケットの送信先アドレスが 10.0.0.0/16 に⼀致しないため、Transit Gateway ルートテー ブル
tgw-rtb-018fa09a4acbf1881 の tgw-attach-01b05e8caf2587afe へのルートはパケットを 転送できません。” -
ルートテーブルの変更(再掲) • 各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 外部アクセスへの ルートがない -
ルートテーブルの修正 • 各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 -
まとめ • TGWを介してNAT VPCのNAT GWから外部サイトへのアクセスを実施する事 ができた • ネットワークのルーティングミスは冷静にReachability Analyzer等を⽤いて 解消する
AWS Cloud Availability Zone 1a VPC わたし EC2 NAT gateway AWS Transit Gateway Availability Zone 1a NAT VPC NAT gateway 外部サイト 廃⽌ -
おまけ • 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の⽅が安価 • リージョンによっても価格がかなり異なるのでデータ量を含めてしっかりとした⾒ 積もりが必要