More Related Content
More from Amazon Web Services Japan (20)
AWS Black Belt ELB Update Network Load Balaner(NLB)
- 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アマゾン ウェブ サービス ジャパン株式会社
ソリューションアーキテクト ネットワークスペシャリスト
菊池 之裕
ソリューションアーキテクト
辻 正史
2017.11.14
【AWS Black Belt Online Seminar】
ELB Update - Network Load Balancer (NLB) と
関連サービス
- 2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
自己紹介
名前:菊池 之裕(きくち ゆきひろ)
所属:アマゾン ウェブ サービス ジャパン株式会社
技術統括本部 レディネスソリューション部
ソリューションアーキテクト ネットワークスペシャリスト
ロール: Network系サービスについてのご支援
経歴: ISP,IXP,VPN運用、開発を経てネットワーク機器、仮想ルータ販売会社のプリセール
ス、プロダクトSEからAWSへ
好きな AWS サービス: ELB,Direct Connect,VPC,Market Place
- 3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
自己紹介
名前
辻 正史(つじ まさふみ)
所属
アマゾン ウェブ サービス ジャパン株式会社
技術統括本部 ストラテジックソリューション部
ソリューション アーキテクト
前職
DB関連会社でコンサルタントとしてERPパッケージのインフラを担当
好きなAWSサービス
Amazon EC2、ECS、ALB、RDS
- 4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
質問を投げることができます!
Adobe ConnectのQ&Aウィンドウから、質問を書き込んでください。
(書き込んだ質問は、主催者にしか見えません)
今後のロードマップに関するご質問はお答えできませんのでご了承ください。
Twitterへツイートする際はハッシュタグ #awsblackbelt をご利用ください。
①Q&Aウィンドウ右
下のフォームに質問
を書き込んでください
②吹き出しマークで
送信してください
- 5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWSJのTechメンバがAWSに関する様々な事を紹介するオンラインセミナーです
【火曜 12:00~13:00】
主にAWSのソリューションや
業界カットでの使いどころなどを紹介
(例:IoT、金融業界向け etc.)
【水曜 18:00~19:00】
主にAWSサービスの紹介や
アップデートの解説
(例:EC2、RDS、Lambda etc.)
※開催曜日と時間帯は変更となる場合がございます。
最新の情報は下記をご確認下さい。
オンラインセミナーのスケジュール&申し込みサイト
• https://aws.amazon.com/jp/about-aws/events/webinars/
- 6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
内容についての注意点
• 本資料では2017年11月14日時点のサービス内容および価格についてご説明しています。最
新の情報はAWS公式ウェブサイト(http://aws.amazon.com)にてご確認ください。
• 資料作成には十分注意しておりますが、資料内の価格とAWS公式ウェブサイト記載の価格に相違が
あった場合、AWS公式ウェブサイトの価格を優先とさせていただきます。
• 価格は税抜表記となっています。日本居住者のお客様が東京リージョンを使用する場合、別途消費
税をご請求させていただきます。
• AWS does not offer binding price quotes. AWS pricing is publicly available and is subject to
change in accordance with the AWS Customer Agreement available at
http://aws.amazon.com/agreement/. Any pricing information included in this document is
provided only as an estimate of usage charges for AWS services based on certain information
that you have provided. Monthly charges will be based on your actual use of AWS services,
and may vary from the estimates provided.
- 7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• ELB update
• NLB
• NLBの特徴
• NLB と ECS の連携
• NLBのパケットフロー
• まとめ
- 8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
〜 AWSクラウド上のロードバランシングサービス 〜
ELBで実現できるシステム
スケーラブル : 複数のEC2インスタンス/ECSコンテナ..etc(ターゲット)に負荷分散
高い可用性 : 複数のアベイラビリティゾーンにある複数のターゲット
の中から正常なターゲットにのみ振り分け
ELB自体の特徴
スケーラブル : ELB自体も負荷に応じてキャパシティを自動増減
安価な従量課金 : 従量課金で利用可能
運用管理が楽 : マネージドサービスなので管理が不要
豊富な連携機能 : Auto Scaling, Route 53, Cloud Formation… などと連携
- 9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
- 10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
- 11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
- 12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ALB NLB
- 13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• 複数のTLS証明書を1つのALBのListenerに設定可能に
• SNIをサポートするクライアントには、適切な証明書を選択してTLSで
通信をできる
• SNI非サポートのクライアントにはデフォルト証明書が使われる
• ドメインはもちろんサポートする鍵交換方式や暗号、署名アルゴリズ
ムを元に証明書を選択するスマートセレクション
• ALB毎に最大25証明書まで (デフォルト証明書を除く)
• ACMまたはIAMの全ての証明書が利用可能
https://aws.amazon.com/jp/blogs/news/new-application-load-balancer-sni/
https://aws.amazon.com/about-aws/whats-new/2017/10/elastic-load-balancing-application-load-balancers-now-support-multiple-ssl-certificates-and-smart-
certificate-selection-using-server-name-indication-sni/
- 14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CLBを、Load Balancer Capacity Unit (LCU)ベースで課金されるALBへ移行する際、参
考になるおおよその値がCloudWatchメトリクスに出力されるようになった
4つの新規追加メトリクス
• EstimatedALBActiveConnectionCount
• EstimatedALBNewConnectionCount
• EstimatedProcessBytes
• EstimatedALBConsumedLCUs – ALBにおける課金対象の1つ
メトリクスはどれも移行の見積もり用で、CloudWatchアラームでは利用しないこと
https://aws.amazon.com/about-aws/whats-new/2017/07/elastic-load-balancing-support-for-lcu-metrics-on-classic-load-balancer/
- 15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CLBから、ALB/NLBへウィザード形式でワンステップで
移行できるウィザードがCLBの画面から使えるようになった。
https://aws.amazon.com/about-aws/whats-new/2017/11/new-one-step-migration-wizard-to-migrate-a-classic-load-balancer//
- 16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• TCP(L4)のバランサとして機能
• 固定IPアドレス: AZ毎に1つ、既に持っているEIPも利用可能
• 送信元アドレスの保持: X-Forwarded-ForやProxy Protocolが不要
• 暖機なしに急激なスパイクにも対応可能
• SSL/TLSターミネートは行わない
https://aws.amazon.com/jp/blogs/news/new-network-load-balancer-effortless-scaling-to-millions-of-requests-per-second/
https://aws.amazon.com/about-aws/whats-new/2017/09/announcing-network-load-balancer-for-elastic-load-balancing/
- 17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
- 18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
大きく3つ
1. 高可用性、高スループット、低レイテンシ
2. Source IP/Portがターゲットまで保持される
3. 固定IP
- 19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• 高い可用性を実現
• DNS名なら、UnhealthyなAZのIPアドレスが自動削除される
• 長時間セッションも維持が可能
• 暖機不要で突発的な数百万リクエスト/秒のトラフィックも捌ける
• ELBは動的にキャパシティが拡張されるが、突発的なアクセス上昇の場合、
ALB/CLBの拡張が間に合わないことがある。その場合は暖機申請が必要
• 固定IPのまま動的にスケールする
• TCP負荷分散を同一AZ内で行うので、レイテンシが小さい
• 単一AZ構成も可能 (ALBは複数AZ構成が必須)
- 20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• クライアントのSource IPとPortが、そのままTargetまで届く
• Targetはクライアントと直接通信しているかの様に見える
• 実際は、行きも帰りもNLBを通っている (DSRではない)
• IP Target(後述)の場合は保持されず、NLBからの通信となる
• Direct Connectは接続されているVPCからのみ通信可能なので、こちらで回避
• TargetのSecurity GroupでクライアントIPの接続を許可する必要あり
• インターネット向けに広く公開する場合は0.0.0.0/0で公開が必要
• ある程度制限をする場合は加えて、Health checkのためにVPC CIDRかNLB ENIから
のアクセスも許可する必要あり
• Targetの選択は5-tupleなのでStickyになる
• src ip, src port, dst ip, dst port, protocol
- 21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ロードバランサ
ALB,NLB
IP target
- 22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• Internet-facing、Internal共にIPアドレスが固定
• AZ毎に1つのIPアドレスを利用、DNSはAレコードでも設定可能
• ALB, CLBではIPアドレスは不定(DNSで同定可能)
• NLB作成時に自動割当されたIPアドレス、又はNLB作成時に指定した自
分が持っているElastic IPのいずれか
• 自動割り当てされたIPアドレス以外の自前のElastic IPを使う際にはNLB作成前に
あらかじめElastic IPを用意しておく必要あり(重要)
• NLB作成後に変更は不可能
• よくあるユースケース
• Firewallの制約等で、ELBのIPアドレスの固定が必要な時
- 23. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• Instance Targetには一部古い世代が利用不可
• C1, CC1, CC2, CG1, CG2, CR1, CS1, G1, G2, HI1, HS1, M1, M2, M3, T1
• まとめるとI2,C3を除く2013年以前のインスタンスタイプ
• Internal NLBはVPC PeeringやVPN越しにアクセス不可
• Idle Timeoutは350秒固定
• Health Checkの設定に、あまり柔軟性がない
• Timeoutは固定(TCPとHTTPSは10秒、HTTPは6秒)
• Intervalは10秒または30秒のみで、後から変更不可
• Cross Zone Balancingは不可
• VPC Flow Logで代替(一般的なaccess_logではない)
URL
https://aws.amazon.com/jp/elasticloadbalancing/details/#compare
- 24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• NLB APIはALBと互換
• Load Balancer=>Listener=>Rule=>Target Group
• ALB同様、1つのTargetをポートを変えて同じTarget Groupに複数登録可能
• TargetはInstance又はIPアドレスが利用可能
• IPアドレスはプライベートセグメントのみ、Direct Connect越しのIPアドレスも利用可能 (VPC peeringと
VPNは不可)
• 関連サービスでNLB対応済のもの一覧
• Amazon ECS, AWS CloudFormation, AWS CodeDeploy, AWS Elastic Beanstalk
- 25. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
- 26. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
特徴(https://aws.amazon.com/ecs/)
• 管理ノード不要の、安定かつ高パフォーマンスな
クラスタ管理サービス
• Serviceスケジューラで多様なロングランニング
プロセスを実行する基盤に
• コンテナを必要な台数稼働させる
• ELB連携で、デプロイも簡単に
• Run Taskでバッチジョブを実行する基盤に
• どこかのEC2でコンテナを起動して処理させる
価格体系 (https://aws.amazon.com/ecs/pricing/)
• 無料
• 利用するEC2, EBS, ELBなどの料金のみ発生
管理されたEC2クラスタ上に、コンテナを自在に配置できる
Amazon
ECR
Amazon ECS
Elastic Load
Balancing
- 27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ALB と同様に ECS のタスク(サービス)を NLB のターゲットグループに登録することで、ECS の
各タスクに対して負荷分散を実施
ターゲットグループ
Target
Task A
Task A
Task B
ECS
Container
ECS
Container
Task A
Task B
ECS
Container
Task A
Task B
Task B
ECS
Container
Target
Target
Target
NLB
ECS Cluster
TCP Port 80
IP XXX, Port 32768 IP XXX Port 32768
動的ホストポートマッピング
が可能で、このポートを
ターゲットグループに登録
- 28. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Multi-AZ 構成、Private Subnet に ECS クラスタを配置
NLB
ECS Cluster
EIP
EIP
NAT Gateway
0.0.0.0/0
NAT Gateway 0.0.0.0/0
Public Subnet Private Subnet
Task A
Task A
Task A
Task A
Route Table
Route Table
- 29. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
NLB 側の暖機申請が不要なため、バックエンドの ECS のキャパシティが重要
NLB
ECS Cluster
Public Subnet Private Subnet
Task A
Task A
- 30. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
NLB には Security Group が設定できないため、ECS コンテナインスタンス側で Security Group
の設定を行う。ECS タスクに動的に設定されるポートの範囲を意識する必要がある。
Task A
Task B
Port 32768
Port 32769
NLB
•
•
Security Group
は設定出来ない
ECS クラスタ
Security Group
- 31. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
- 32. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
NLB
EIP
EIP
NAT Gateway
0.0.0.0/0
NAT Gateway 0.0.0.0/0
Public Subnet Private Subnet
10.0.2.21
10.0.2.21
10.0.3.31
10.0.3.31
Route Table
Route Table
203.0.113.1
198.51.100.10
192.0.2.15
- 33. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• 1AZ,1
• 203.0.113.1 NLB: 198.51.100.10 80
10.2.21 80
NLB
EIP
NAT Gateway
0.0.0.0/0
Public Subnet Private Subnet
10.0.2.21:8
0
Route Table
203.0.113.1
198.51.100.10
DST:198:51.100.10:80
SRC:203.0.113.1:40392
- 34. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• NLB Destination Address NAT Source
NLB
EIP
NAT Gateway
0.0.0.0/0
Public Subnet Private Subnet
10.0.2.21:8
0
Route Table
203.0.113.1
198.51.100.10
DST:10.0.2.21:80
SRC:203.0.113.1:40392
- 35. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
•
NLB
EIP
NAT Gateway
0.0.0.0/0
Public Subnet Private Subnet
10.0.2.21:8
0
Route Table
203.0.113.1
198.51.100.10
DST:10.0.2.21:80
SRC:203.0.113.1:40392
- 36. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
•
NLB
EIP
NAT Gateway
0.0.0.0/0
Public Subnet Private Subnet
10.0.2.21:8
0
Route Table
203.0.113.1
198.51.100.10
DST:203.0.113.1:40392
SRC:10.0.2.21:80
- 37. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• NLB Source Address NLB NAT Destination
• (Direct Server Return)DSR
NLB
EIP
NAT Gateway
0.0.0.0/0
Public Subnet Private Subnet
10.0.2.21:8
0
Route Table
203.0.113.1
198.51.100.10
DST:203.0.113.1:40392
SRC:198.51.100.10:80
- 38. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• NLB EIP
NLB
EIP
NAT Gateway
0.0.0.0/0
Public Subnet Private Subnet
10.0.2.21:8
0
Route Table
203.0.113.1
198.51.100.10
DST:203.0.113.1:40392
SRC:198.51.100.10:80
- 39. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
- 40. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• TCP(L4)のバランサとして機能
• 固定IPアドレス: AZ毎に1つ、既に持っているEIPも利用可能
• 送信元アドレスの保持: X-Forwarded-ForやProxy Protocolが不要
• 暖機なしに急激なスパイクにも対応可能
• SSL/TLSターミネートは行わない
https://aws.amazon.com/jp/blogs/news/new-network-load-balancer-effortless-scaling-to-millions-of-requests-per-second/
https://aws.amazon.com/about-aws/whats-new/2017/09/announcing-network-load-balancer-for-elastic-load-balancing/
- 41. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• Application Load Balancer => HTTP or HTTPS
• Network Load Balancer => TCP & Internal LB
• Classic Load Balancer => EC2 Classic
この機会にClassic Load Balancerからの移行の検討を!
サポートツールも公開しています。多くのケースで低コストとな
ります。(後述)
https://github.com/aws/elastic-load-balancing-tools
- 42. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• CLB
• CLB毎の料金+転送されるデータに応じて 1時間単位で転送
データに応じてGB 単位で課金
• $0.027/hour
• $0.008/GB
• NLB
• NLB毎の料金+LCU消費の料金が1時間単位
• NLB 1つにつき1時間毎に$0.0243 (東京リージョン)
• 1 LCU 1時間毎に$0.006 (全リージョン)
• 参考: ALBは$0.008
• LCUの定義が異なるのでALB/NLBどちらが安いかは
比較すること。
• ALB
• ALB毎の料金+LCU消費の料金が1時間単位
• ALB 1つにつき1時間毎に$0.0243 (東京リージョン)
• 参考: ALBも$0.0243
• 1 LCU 1時間毎に$0.008 (全リージョン)
ALBの1 LCUの単位
• 新規接続数: 25/sec
• Active接続数: 3,000/min
• 帯域: 2.22 Mbps (1 GB/hour)
• Ruleの評価数 1,000/sec
NLBの1 LCUの単位
• 新規接続又はフロー数: 800/sec
• Active接続又はフロー数: 10,000/min
• 帯域: 2.22 Mbps (1 GB/hour)
NLB/ALB CLB
- 43. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• AWS Black Belt Online Seminar 2016 Elastic Load Balancing
• https://www.slideshare.net/AmazonWebServicesJapan/aws-black-belt-online-
seminar-2016-elastic-load-balancing
• AWS Black Belt Online Seminar 2016 Amazon EC2 Container Service
• https://www.slideshare.net/AmazonWebServicesJapan/aws-black-belt-online-
seminar-2016-amazon-ec2-container-service
• ELB料金
• https://aws.amazon.com/jp/elasticloadbalancing/pricing/
43
- 44. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
- 45. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS クラウドサービス活用資料集
• http://aws.amazon.com/jp/aws-jp-introduction/
AWS Solutions Architect ブログ
• 最新の情報、セミナー中のQ&A等が掲載されています
• http://aws.typepad.com/sajp/
- 46. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
@awscloud_jp
検索
最新技術情報、イベント情報、お役立ち情報、
お得なキャンペーン情報などを日々更新しています!
もしくは
http://on.fb.me/1vR8yWm
- 47. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWSクラウド導入に関するご質問、お見積り、資料請求を
ご希望のお客様は以下のリンクよりお気軽にご相談ください
https://aws.amazon.com/jp/contact-us/aws-sales/
※「AWS 問い合わせ」で検索してください
- 48. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Well Architectedフレームワークに基づく数十個の質問項目を
元に、お客様がAWS上で構築するシステムに潜むリスクやその
回避方法をお伝えする個別相談会
https://pages.awscloud.com/well-architected-consulting-
2017Q4-jp.html
参加無料
毎週火曜・木曜開催
- 49. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
11月の配信予定 (+ 一部先行予告)
• 11月1日(水) 18:00~19:00 Amazon EMR
• 11月9日(木) 12:00~13:00 Amazon Pinpoint で始
めるモバイルアプリのグロースハック
• 11月15日(水) 18:00~19:00 ELB Update -
Network Load Balancer(NLB)と関連サービス
• 11月21日(火) 12:00~13:00 AWS上の位置情報
• 11月22日(水) 18:00~19:00 AWS WAF
• 12月1日(金) 12:00~13:00
AWS re:Invent 2017 Report
申し込みサイト
• https://aws.amazon.com/jp/about-aws/events/webinars/
(もしくは「AWS セミナー」で検索)
※下線はイレギュラー日程です。ご注意ください
- 50. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
画面に表示されるアンケートフォームに入力をお願いします。
皆様のご意見は、今後の改善活動に活用させて頂きます。
コメント欄には1行で自由な内容を書き込み下さい。
例)
- 本オンラインセミナーへのご意見
- 今後オンラインセミナーで取り上げて欲しい題材
- 発表者への激励
等々…
※Q&A同様に書き込んだ内容は主催者にしか見えません
- 51. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
- 52. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.