[awsマイスターシリーズ]...
TRANSCRIPT
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
AWSマイスターシリーズ Reloaded
リザーブドインスタンス& スポットインスタンス編
2013.03.28
安川 健太 高山 博史
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
2
Agenda
はじめに
• AWSの割引の仕組み
• 時間課金系サービスのご利用オプション
オンデマンドインスタンス
リザーブドインスタンス
スポットインスタンス
まとめ
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
3
でもAWSをもっとお安くご利用いただけるかもしれません
AWSは、値引きはないの? うちだけ値引きしてくれない?
AWSは、どんなお客様にもフェアな 単一料金です(個人利用から大企業まで)
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
4
AWSでのコスト削減
前提として…
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
5
AWSでのコスト削減って?
よりクラウドネイティブな設計 ・EC2以外のAWSサービス積極的に活用
・インスタンスタイプの最適化
・スタンバイ機の見直し
割引の活用 ・リザーブド・インスタンス
・スポット・インスタンス
・Cloudfrontの予約容量等々…
その他のリソースの無駄チェック ・EBS, Snapshot, EIP等々…
効果大
効果小
運用コスト削減も
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
6
AWSでのコスト削減って?
よりクラウドネイティブな設計 ・EC2以外を積極的に活用
・インスタンスタイプの最適化
・スタンバイ機の見直し
割引の活用 ・リザーブド・インスタンス
・スポット・インスタンス
・Cloudfrontの予約容量
その他のリソースの無駄チェック ・EBS, Snapshot, EIP等々…
効果大
効果小
既存オンプレミス構成を そのままAWSで再現している場合などは、
「構成の見直し」もご検討ください
(AWSのSales/SAにご相談ください) [お問い合わせフォーム] http://aws.amazon.com/jp/contact-us/aws-sales/
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
7
AWSの割引の仕組み
前提を踏まえた上で…
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
8
AWSの割引の仕組み①
EC2・RDS・Elasticache等(時間課金サービス)での利用オプションによる割引[本資料で説明]
①リザーブド・インスタンス
②スポット・インスタンス
ご利用が増えると自動的に単価が安くなるもの
→データ転送量(50TB/月以上)や S3ストレージ料金(50TB/月以上)など
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
9
AWSの割引の仕組み②
Cloudfrontの予約容量
→リージョンごとに10TB/月から
10TB以上配信される場合は、ご相談ください
随時行われる価格改定
→規模の経済・運用効率化による
サービス開始から20回以上の値下げ実績あり
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
10
ご参考:2013年2月にも
EC2オンデマンド料金値下げ!
リージョン間データ転送料の値下げ!
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
11
インスタンスの時間単価の削減は効果的
月々のAWSご利用料金の中で、EC2やRDSなどの時間課金サービスが占める割合が大きいことが多い!
データ転送料金の割合が多い場合は、Cloudfrontの予約容量もご検討ください
コスト削減に 効果的! EC2
RDS
データ転送量
その他
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
12
用途に合わせて選べる AWSのご利用オプション
オンデマンド・インスタンス(通常はこちら) • 初期費用ゼロ・コミットなし・時間課金
リザーブド・インスタンス(オプション) • 予約金の支払で時間単価の割引・キャパシティの予約
• 年間を通して大幅な費用削減が可能
スポット・インスタンス(オプション) • 初期費用ゼロ • スポット価格(需要と供給によりリアルタイムに変動)で課金 • 最大で払ってもいい額を決定して「入札」
• 「入札額 >= スポット価格」 インスタンスが利用可 • 「入札額<スポット価格」インスタンスがターミネート
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
13
オンデマンド以外オプションの用途
リザーブド・インスタンス • 年間通して多くの時間起動しているインスタンス
• 常時稼動のDBサーバ
• 最低限必要なWeb/APサーバ等
スポット・インスタンス • 時間の制約がなく、中断しても支障のないタスクを実行するインスタンス
• Webクローラ
• 分散処理のタスクノード等
システム内に上記のようなインスタンスがあればコスト削減の可能性
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
14
オンデマンド・インスタンス
まずは基本の
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
15
オンデマンド・インスタンス
オンデマンド・インスタンス(通常はこちら) • 初期費用ゼロ
• 時間課金
• 長期コミットメントなし
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
16
オンデマンド・インスタンス
オンデマンド インスタンス
積算料金
期間 初期費用0
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
17
リザーブド・インスタンス
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
18
リザーブド・インスタンス オンデマンド インスタンス
リザーブド インスタンス
積算料金
期間
予約金 (キャパシティ予約、 時間単価割引確定)
1年/3年
長期間ご利用の場合、 大幅にお安く
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
19
リザーブド・インスタンス よくある勘違い
リザーブド・インスタンスは、1年/3年の利用料前払いである
リザーブド・インスタンスを購入したら、1年/3年の”縛り”がある(必ず使用しないといけない)
インスタンスタイプを変更すると、割引が適用されない
エンタープライズ向けであり、スタートアップには適さない
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
20
リザーブド・インスタンス よくある勘違い
リザーブド・インスタンスは、1年/3年の利用料前払いである
リザーブド・インスタンスを購入したら、1年/3年の”縛り”がある(必ず使用しないといけない)
インスタンスタイプを変更すると、割引が適用されない
エンタープライズ向けであり、スタートアップには適さない
× ×
× △
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
21
リザーブド・インスタンス
リザーブド・インスタンス(以下、RI) • 予約金お支払いによる、1年間/3年間の時間課金の割引
→一時金のお支払で、時間単価が安くなる仕組み
• 月額費用は割引単価での時間課金 *後述の「重度使用」のみ、RI期間中は起動時間にかかわらず、 毎月100%起動したものとして月額課金
• 該当キャパシティを予約
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
22
リザーブド・インスタンスは、1年/3年の利用料前払いである
リザーブド・インスタンスを購入したら、1年/3年の”縛り”がある(必ず使用しないといけない)
インスタンスタイプを変更すると、割引が適用されない
エンタープライズ向けであり、スタートアップには適さない
×
リザーブド・インスタンス よくある勘違い
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
23
リザーブド・インスタンスのポイント
必ずしも1年間使用し続ける必要はない • ただし使用しない場合でも初期費用の返金はなし *後述の「重度使用」のみ、リザーブ期間中は起動時間にかかわらず、 毎月100%起動したものとして月額課金
オンデマンド インスタンス
リザーブド インスタンス
積算料金
期間
予約金
途中で使用を止めたり、 24時間起動しなくても
お得な場合も *RIタイプ(後述)により異なる
例:6か月分
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
24
リザーブド・インスタンスは、1年/3年の利用料前払いである
リザーブド・インスタンスを購入したら、1年/3年の”縛り”がある(必ず使用しないといけない)
インスタンスタイプを変更すると、割引が適用されない
エンタープライズ向けであり、スタートアップには適さない
×
リザーブド・インスタンス よくある勘違い
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
25
リザーブド・インスタンスのポイント 2
該当AWSアカウント用に、キャパシティを予約 • 条件に合致するインスタンスを予約することで、 予約した数のインスタンスは、 必要になったときにいつでも起動できるという安心感
AWSは随時リソースを追加し続けています!
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
26
リザーブド・インスタンス(RI)のタイプ
[梅]Light Utilization(軽度使用)
[竹]Medium Utilization(中度使用)
[松]Heavy Utilization(重度使用)
初期費用 少ない
初期費用 多い
時間課金 割引小さい
時間課金 割引大きい
*ただし重度使用のみ、RI期間中は起動時間にかかわらず、 毎月100%起動したものとして課金(月初に24時間×日数分を月額費用に計上)
ご利用用途に合わせたタイプの選択が必要
RIタイプは「初期費用/時間単価」の組み合わせで3種類
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
27
リザーブド・インスタンス(RI)のタイプ
サービスごとの価格はこちら
EC2(リザーブド・インスタンス) http://aws.amazon.com/jp/ec2/reserved-instances/
RDS(リザーブド・インスタンス) http://aws.amazon.com/jp/rds/reserved-instances/
ElastiCache(リザーブド・キャッシュノード) http://aws.amazon.com/jp/elasticache/reserved-cache-nodes/
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
28
EC2のRIタイプ別比較(1年): 削減効果
各タイプのスイートスポットと削減効果(目安)
年間100%利用した 場合の削減効果
(対オンデマンドインスタンス)
年間利用率の スイートスポット
(何%利用の場合一番お得か?)
Light (軽度使用)
32% 21%~74%
Medium (中度使用)
39% 74%~77%
Heavy (重度使用)
46% 77%~
*Tokyoリージョンでスタンダードインスタンス(Linux)利用の場合で算出 (インスタンスタイプにより異なる) 2013年3月現在
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
29
EC2のRIタイプ別比較(1年): スイートスポット
各タイプのスイートスポットと削減効果(目安)
年間100%利用した 場合の削減効果
(対オンデマンドインスタンス)
年間利用率の スイートスポット
(何%利用の場合一番お得か?)
Light (軽度使用)
32% 21%~74%
Medium (中度使用)
39% 74%~77%
Heavy (重度使用)
46% 77%~
*Tokyoリージョンでスタンダードインスタンス(Linux)利用の場合で算出 (インスタンスタイプにより異なる) 2013年3月現在
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
30
スイートスポットとは?
先ほどの表を図示したのが下記のグラフ(イメージ)
0% 100%
オンデマンド
ライト
ミディアム
ヘビー
積算料金
期間 21% 74% 77%
Lightが お得
Heavyが お得
Mediumが お得
*Tokyoリージョンでスタンダードインスタンス(Linux)利用の場合で算出 (インスタンスタイプにより異なる) 2013年3月現在
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
31
EC2のRIタイプ別比較(3年)
各タイプのスイートスポットと削減効果(目安)
3年間100%利用した 場合の削減効果
(対オンデマンドインスタンス)
3年間利用率の スイートスポット
(何%利用の場合一番お得か?)
Light (軽度使用)
48% 9%~50%
Medium (中度使用)
57% 50%~74%
Heavy (重度使用)
64% 74%~
*Tokyoリージョンでスタンダードインスタンス(Linux)利用の場合で算出 (インスタンスタイプにより異なる) 2013年3月現在
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
32
EC2のRI割引適用条件
購入時に以下の条件を指定 ①プラットフォーム「非VPC/VPC」や「OS(ライセンス料込か?)」
②インスタンスタイプ「Small, Large」など
③アベイラビリティーゾーン(AZ)「ap-northeast-1a」など
④期間「1年または3年」
⑤タイプ(重度・中度・軽度)
⑥VPCの場合のみ「占有インスタンスか否か?」
④の期間中に①②③⑥の条件が合致すると、 割引料金が適用される
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
33
購入時に以下の条件を指定 ①プラットフォーム「非VPC/VPC」や「OS(ライセンス料込か?)」
②インスタンスタイプ「Small, Large」など
③アベイラビリティーゾーン(AZ)「ap-northeast-1a」など
④期間「1年または3年」
⑤タイプ(重度・中度・軽度)*後述します
⑥VPCの場合のみ「占有インスタンスか否か?」
④の期間中に①②③⑥の条件が合致すると、 割引料金が適用される
インスタンスタイプとAZ指定により AWS側のDCプランニングがしやすくなる
→割引によるお客様還元
EC2のRI割引適用条件
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
34
EC2のRI適用例
割引の権利は“AWSアカウント単位”で管理 • インスタンスIDとの紐づけは無し
料金計算イメージ:
・RI権利 :Small*1インスタンス分
・稼働中 :Small*3インスタンス
Small割引料金×1 Small通常料金×2
*適用にはインスタンスタイプ以外の 各条件も合致していること
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
35
1インスタンスをスケールアップした場合
料金計算イメージ:
・RI権利 :Small*1インスタンス分
・稼働中 :Small*3インスタンス
・RI権利 :Small*1インスタンス分
・稼働中 :Small*2インスタンス
:Large*1インスタンス
*適用にはインスタンスタイプ以外の
各条件も合致していること
Small割引料金×1 Small通常料金×2
Small割引料金×1 Small通常料金×1 Large通常料金×1
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
36
リザーブド・インスタンスは、1年/3年の利用料前払いである
リザーブド・インスタンスを購入したら、1年/3年の”縛り”がある(必ず使用しないといけない)
インスタンスタイプを変更すると、割引が適用されない
エンタープライズ向けであり、スタートアップには適さない
△
リザーブド・インスタンス よくある勘違い
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
37
RIの使いどころ(例)①
常に起動しているDBやキャッシュサーバなど →今後スケールアップの可能性がある場合は、 LightタイプやMediumタイプがオススメ
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
38
RIの使いどころ(例)②
常に起動している分のWeb/Appサーバ →スケールアウトする分はオンデマンドで
平常時 ピーク時
RI RI オンデマンド
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
39
RIの導入フロー
まずはオンデマンドタイプの利用で「インスタンスタイプ」の検討と「利用率」を算出
以下のようなインスタンスについてRIを購入 • 定常的に同一インスタンスタイプで起動しているサーバ
• 一定の利用率がありそうなサーバ (Lightタイプなどを)
→権利の購入なので、無停止でRIに切り替え可
ご利用は計画的に!
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
40
リザーブド・インスタンスは、1年/3年の利用料前払いである
リザーブド・インスタンスを購入したら、1年/3年の”縛り”がある(必ず使用しないといけない)
インスタンスタイプを変更すると、割引が適用されない
エンタープライズ向けであり、スタートアップには適さない ×
リザーブド・インスタンス よくある勘違い
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
41
ご参考:Trusted Advisor
お客様のAWS環境を精査し、コスト削減等の推奨事項をお知らせする機能
サポートレベルが「ビジネス」または「エンタープライズ」の場合に、サポートセンター経由でアクセス可能
RI, EC2インスタンス、EBS等100個を超えるチェック項目を持つ
多くのお客様にAWSのサービスを適用してきたベストプラクティスが適用されている
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
42
ベーシック デベロッパー ビジネス エンタープライズ
フォーラム 利用可能 利用可能 利用可能 利用可能
サポートへの コンタクト
EC2の 健全性エラーが発生した場合
コンタクト フォーム
電話、チャット コンタクト フォーム
電話、チャット コンタクト フォーム
初回応答時間 不可 12時間
(営業時間内) 1時間 15分
連絡先登録 - 1 5 無制限
24/365対応 なし なし あり あり
Trusted Advisor なし なし あり あり
専任スタッフ なし なし なし あり
特別サポート なし なし なし あり
料金(月額) 無料 $49
AWS利用総額の $0~$10K: 10% $10K~$80K: 7% $80K~$250K: 5% $250K~: 3% (最低$100)
AWS利用総額の10% (最低$15000)
ご参考:AWSサポート
日本語での技術サポートをご提供
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
43
リザーブド・インスタンス よくある勘違い
リザーブド・インスタンスは、1年/3年の利用料前払いである
リザーブド・インスタンスを購入したら、1年/3年の”縛り”がある(必ず使用しないといけない)
インスタンスタイプを変更すると、割引が適用されない
エンタープライズ向けであり、スタートアップには適さない
× ×
× △
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
44
RIの購入方法
AWS Management Consoleにて購入
デフォルトでは月間20インスタンスまで購入可能 [制限増加申請フォーム] http://aws.amazon.com/jp/contact-us/reserved-instances-limit-request/
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
45
RIの購入方法
Purchase Reserved Instancesを選択
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
46
RIの購入方法
条件を選択して検索
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
47
条件に合うRIをカートに追加し購入
Sellerが「AWS」のものが、AWSが販売しているRIです。
Sellerが「3rd Party」のものは、AWS以外が販売しているRIです。
RIの購入方法
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
48
RI権利を売買できるようになりました
RI Marketplace
→使わなくなったRIの権利を売買できる!
ただし売却には米国の銀行口座が必要
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
49
クレジットカードの限度額にご注意ください
月々のご利用とは、別タイミングで決済されます (月々のご利用分とは合算されません)
[お問い合わせフォーム] http://aws.amazon.com/jp/contact-us/aws-sales/
RIの購入時のご注意
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
50
【補足】EC2(非VPC)とVPCとの関係
非VPCでRIを購入して、VPCでインスタンスを 起動した場合…
・非VPC/VPC間でもインスタンスタイプ・AZ等の 他条件が一致すれば、割引料金は適用される
・ただしこの場合キャパシティ保証は適用されない (RI購入時の非VPC/VPC側でのキャパシティ保証)
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
51
参考:Consolidated Billing(一括決済)とRI
一括決済とは? →AWSの費用請求をまとめられるサービス
複数アカウントの費用を、1つにまとめて支払える
アカウント間でRIの融通が可能
参考:AWSマイスターシリーズ Reloaded AWS Billing編 http://slidesha.re/Q7tAMf
使われていない リザーブドインスタンス
条件が合えば こちらのアカウントに割引適用
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
52
スポット・インスタンス
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
53
スポットインスタンスとは?
需要と供給の関係に基づいてリアルタイムで変動する 「スポット価格」が割当てられたインスタンス
AWS Cloud Availability Zone Availability Zone
55%
off
40%
off
59%
off
59%
off
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
54
スポットインスタンスとは?
需要と供給の関係に基づいてリアルタイムで変動する 「スポット価格」が割当てられたインスタンス
AWS Cloud Availability Zone Availability Zone
55%
off
40%
off
59%
off
59%
off
• オンデマンドインスタンスや リザーブドインスタンスの価格モデルを補完
• 時間の制約がなく、中断可能なタスクの 計算コストを大幅に削減
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
55
スポット価格と入札
スポット価格:EC2インスタンスの需要と供給によりリアルタイムに価格が変動
入札によるインスタンス利用
• 「入札額 >= スポット価格」なら指定したインスタンスが起動
• 「入札額 < スポット価格」となるとインスタンスがターミネートされる
$9で入札
$8で入札
$7で入札
ユーザA
ユーザB
ユーザC
$9で入札
$8で入札
$10で入札
ユーザA
ユーザB
ユーザC
スポット価格=$7.5 スポット価格=$8.5
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
56
スポットリクエストとインスタンス
スポットリクエスト:入札条件を指定したインスタンス起動要求
• 最大で払っても良い金額
• インスタンスタイプ、など
インスタンスの起動と終了
• 起動のタイミング:
• スポットリクエストの条件が満たされた時点 (オンデマンドやリザーブドはリクエスト後すぐ)
• 終了のタイミング:
• ユーザが終了命令を出した時点
• スポット価格がスポットリクエストで指定した価格を上回った時点
課金について
• インスタンス起動時から1時間毎にスポット価格にて課金
• インスタンスが強制終了された場合、1時間未満の時間に対しては課金されない
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
57
スポットリクエストと課金
入札額>スポット価格 となったので
インスタンス起動
単価
時間
入札額<スポット価格 となったので
インスタンス終了
入札額 > スポット価格 となったので
インスタンス起動
スポットリクエスト投入
1h 1h 1h
<1h
スポット価格
入札額
課金額
強制終了時の
1時間未満の
利用分は非課金
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
58
時間の制約がなく、
中断しても支障のない
タスクを省コストで
代表的なユースケース
複雑な解析や
シミュレーション ビックデータ解析
金融モデリングや経済分析
地理空間
情報の解析
メディア
プロセッシング 科学演算
Webクローリング 開発や検証
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
59
時間の制約がなく、
中断しても支障のない
タスクを省コストで
顧客事例
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
60
顧客事例(抜粋)
ビックデータ解析
メディアプロセッシング
300万/日の”チェックイン”のデータを解析するためにElastic
Map Reduceを使用する中で、スポットインスタンスを活用
毎日たまるインターネットサービスのログを解析する中でスポットインスタンスを活用し、50%のコスト削減を実現
広告メール等、画像を多用したEメールが各種クライアントでど
う表示されるか解析するサービスでスポットインスタンスを活用し、57%のコスト削減を実現
Webクローリング
オンライン上のやり取りを観測して企業のイメージ調査を助けるサービスにてスポットインスタンスを活用し、66%のコスト削減
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
61
大規模Webサイトでの活用事例
Webサーバのインスタンス利用状況
Auto Scale採用によるインスタンス数の効率化
Auto Scale採用によるランニングコスト
用途に合わせた価格モデル採用によるコスト削減
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
62
アンチパターン
停止が許されないインスタンスでの利用
• DB、ファイルサーバ等
遅延が許されないタスクでの利用
• スポットリクエストは満たされるとは限らない
止まってはいけないサービスを少数のインスタンスで実行している場合
• 数台のインスタンスで運用される小さめのWebサイト等
• インスタンス終了時のキャパシティへの影響が大きい
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
63
スポット・インスタンスの利用方法 ~AWSコンソールから
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
64
スポット・インスタンスの利用方法 ~AWSコンソールから
Request Spot Instancesにてリクエストを作成
価格の履歴も確認できる
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
65
AMI選択後、各種パラメータを設定してスポットリクエストを作成
スポット・インスタンスの利用方法 ~AWSコンソールから
現在の スポット価格
入札額
ローンチグループを設定(任意) ローンチグループを指定されたインスタンスは、同一グループ内の全スポットリクエストが満たされた時にのみ起動する。クラスタの構成等で有用
AZグループを設定(任意) AZグループを指定されたインスタンスは単一のAZでグループ内の全スポットリクエストが満たされる場合にのみ起動する
※AZグループ、ローンチグループ等を指定すると無指定に比べてリクエストが満たされる可能性は下がる
リクエストの有効期間を指定 (任意)
インスタンスがTerminateされた後に再
入札するか否か
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
66
スポット・インスタンスの利用方法 ~AWSコンソールから
インスタンスタイプを選択
OSタイプ を選択
Pricing Historyの確認
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
67
スポット リクエストの ライフサイクル
開発者向けドキュメントより
http://docs.aws.amazon.c
om/AWSEC2/latest/UserG
uide/using-spot-instances-
bid-status.html
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
68
スポットリクエストの状態確認
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
69
スポット・インスタンスの利用方法 ~コマンドラインから
Task CLI
スポット価格の履歴を取得 ec2-describe-spot-price-history
スポットリクエストの一覧を取得 ec2-describe-spot-instance-requests
スポットインスタンスの入札をリクエスト ec2-request-spot-instances
スポットインスタンスの入札をキャンセル ec2-cancel-spot-instance-requests
PROMPT> ec2-request-spot-instances
--price price
--user-data data
--instance-count count
--type one-time | persistent
[--valid-from timestamp]
[--valid-until timestamp]
[--launch-group launchgroup]
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
70
スポット・インスタンスの利用方法 ~各種プログラミング言語から
Task API
スポット価格の履歴を取得 DescribeSpotPriceHistory
スポットリクエストの一覧を取得 DescribeSpotInstanceRequests
スポットインスタンスの入札をリクエスト RequestSpotInstances
スポットインスタンスの入札をキャンセル CancelSpotInstanceRequests
// AmazonEC2Client オブジェクトを作成
AmazonEC2 ec2 = new AmazonEC2Client();
// スポットリクエストを初期化
RequestSpotInstancesRequest requestRequest
= new RequestSpotInstancesRequest();
// 入札額を$0.03に設定
requestRequest.setSpotPrice("0.03");
… 中略 ….
// RequestSpotInstance APIを呼ぶ
RequestSpotInstancesResult requestResult
= ec2.requestSpotInstances(requestRequest);
Javaの例:
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
71
Autoscalingにスポットインスタンス
Autoscaling = 負荷に合わせて動的にインスタンスを水平スケールさせるAWSの機能
Autoscalingのローンチコンフィグを作成時に”—spot-price”オプションを設定
> as-create-launch-config spotlc-5cents --image-id ami-XXXXXX
--instance-type m1.small --spot-price "0.05"
インスタンスがTerminateされてもDesired Capacityを満たすよう継続的に入札が行われる
スポット価格が入札額を上回っている場合はDesired Capacityを満たせない
Scale Outパターン http://aws.clouddesignpattern.org
Autoscalingに関するマイスターWebinarのリンク: http://slidesha.re/KrooPC
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
72
Elastic MapReduce (EMR)に スポットインスタンス
EMR = AWS上のマネージドHadoopサービス
利用シナリオ: ジョブのランニングコストを抑えたい
• オンデマンドのm2.xlarge 4ノードで開始
• 処理の高速化のためスポットインスタンスで5ノード追加
4ノードで 起動
Spot 5ノード 追加
Job Flow
残り時間 14時間
残り時間
Job Flow
7時間
スポットなしのコスト 4 instances *14 hrs * $0.50 = $28
スポットありのコスト 4 instances *7 hrs * $0.50 = $13 + 5 instances * 7 hrs * $0.25 = $8.75 Total = $21.75
時間の削減効果: 50% コスト削減効果: ~22%
EMRに関するマイスターWebinarのリンク: http://slidesha.re/LT7Ba2
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
73
EMR+Spotの使いどころ
ユースケース Master Instance Group
Core Instance Group
Task Instance Group
長時間稼働のジョブフローの高速化
オンデマンド オンデマンド Spot
低コストで実行したいジョブ
Spot Spot Spot
クリティカルデータを扱うジョブ
オンデマンド オンデマンド Spot
アプリケーションのテスト
Spot Spot Spot
コストを抑えつつ、利用目的にあわせて柔軟に変更可能
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
74
入札戦略
1. コスト最小型
• 最低価格で入札
• インスタンス停止にはアーキテクチャで対応
2. 価格履歴順応型
• 直近の価格を観測してそれより少し高い額で入札
• オンデマンド価格より低く設定した閾値以上は入札しない
3. オンデマンドに比べて節約型
• オンデマンドの価格付近に入札
• オンデマンドより高くなったらオンデマンドに切り替え
4. 割り込みリスク最小型
• オンデマンドよりも高く入札
課金額増大リスク 小
インスタンス終了リスク 大
課金額増大リスク 大
インスタンス終了リスク 小
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
75
入札戦略:コスト最小型
最低価格で入札
アプリケーション側の工夫でインスタンス停止に対応
• 例:ジョブ管理をインスタンス外のキューやDBにて行い、新たに起動したインスタンスがジョブを引き継ぐ、など
処理時間よりもコストを重視する場合に
再開後にジョブを継続
1時間毎の課金スロットのうち、Terminateさ
れたスロットは課金されない
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
76
入札戦略:価格履歴順応型
直近の価格を観測してそれより少し高い額で入札
オンデマンド価格より低く設定した閾値以上は入札しない
SDKやCLIを利用した自動化で実現
価格履歴から決定する入札額
オンデマンドの価格より低く設定した閾値
Vimeoはこの戦
略で月によっては50%のコスト節減を実現
(参考資料)
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
77
入札戦略:オンデマンドに比べて節約型
オンデマンドの価格付近に入札
オンデマンドより高くなったらオンデマンドに切り替え
• システムのキャパシティを維持しつつコストを節約
緑で示した部分がオンデマンドに比べた節約分に相当
オンデマンド価格。ここを超えたらオンデマンドで起
動
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
78
入札戦略:割り込みリスク最小型 オンデマンドよりも高く入札
• 課金額がオンデマンドを超えるリスクを取りつつ
• 平均的にはコストを節約
• インスタンスは高い確率で継続稼働
一時的にオンデマンドを超える課金も
平均的には
大きくコスト
を節約
Litmusはこの戦略で57%のコスト節減を実現
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
79
まとめ
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
80
用途に合わせて選べる AWSのご利用オプション
オンデマンド・インスタンス(通常はこちら) • 初期費用ゼロ・コミットなし・時間課金
リザーブド・インスタンス(オプション) • 予約金の支払で時間単価の割引・キャパシティの予約
• 年間を通して大幅な費用削減が可能
スポット・インスタンス(オプション) • 初期費用ゼロ • スポット価格(需要と供給によりリアルタイムに変動)で課金 • 最大で払ってもいい額を決定して「入札」
• 「入札額 >= スポット価格」 インスタンスが利用可 • 「入札額<スポット価格」インスタンスがターミネート
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
81
オンデマンド以外オプションの用途
リザーブド・インスタンス • 年間通して多くの時間起動しているインスタンス
• 常時稼動のDBサーバ
• 最低限必要なWeb/APサーバ等
スポット・インスタンス • 時間の制約がなく、中断しても支障のないタスクを実行するインスタンス
• Webクローラ
• 分散処理のタスクノード等
用途に合わせたオプションの利用でコストの最適化を!
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
82
Appendix
参考資料 • サービス別リザーブドインスタンス価格表
• EC2 – http://aws.amazon.com/jp/ec2/reserved-instances/
• RDS – http://aws.amazon.com/jp/rds/reserved-instances/
• ElastiCache – http://aws.amazon.com/jp/elasticache/reserved-cache-
nodes/
• スポットインスタンス最低価格表 • http://aws.amazon.com/jp/ec2/spot-instances/
• AWSマイスターシリーズ Reloaded AWS Billing編 • http://www.slideshare.net/AmazonWebServicesJapan/
awsaws-billing
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
83