50
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川 貴士 Amazon EC2 Spot Instance Deep Dive アマゾン ウェブ サービス ジャパン株式会社 技術統括本部 ソリューションアーキテクト 2-H1-3-10

Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

小川貴士

Amazon EC2

Spot Instance Deep Dive

アマゾンウェブサービスジャパン株式会社

技術統括本部ソリューションアーキテクト

2-H1-3-10

Page 2: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

自己紹介

名前:小川貴士 (おがわたかし)

所属:アマゾンウェブサービスジャパン

ソリューションアーキテクト

担当エリア: CAEを中心としたHPCのお客様

担当サービス:Amazon EC2、AWS Batch

などのComputeサービス

Page 3: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

本セッションの目的

• 機能拡張で使いやすくなったスポットインスタンスの新機能を理解する

• スポットインスタンスを今まで以上に使ってみようという気持ちになって貰う

Page 4: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

アジェンダ

• スポットインスタンスとは

• 使いどころ

• 新機能について

• スポット利用を支援するツール

• ベストプラクティス

• まとめ

Page 5: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットインスタンスとは

Page 6: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Amazon EC2の購入オプション

オンデマンド

• スタンダードな時間課金型インスタンス

リザーブドインスタンス

• 1年間または3年間の利用予約をすることで25〜70%前後の割引

スポットインスタンス

• 使われていないEC2インスタンスに入札して格安利用

• 最大90%程度の大幅コストカットが可能!

※EC2 オンデマンド、リザーブド、スポットの具体的な価格については下記URLより参照ください

https://aws.amazon.com/jp/ec2/pricing/

Page 7: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットインスタンスの種類リクエストタイプ

永続性リクエスト

単位容量変更

起動に用いるAPI 概要

スポットインスタンス

instance

one-time(default)

orpersistent

instances 不可 request-spot-instances

単一のインスタンスタ

イプでスポットインス

タンスを起動する最も

シンプルなタイプ

スポットブロック

block(** min)

- instances 不可 request-spot-instances

1〜6時間の使用予定期間を指定。その時間内はTerminateされない。オンデマンドの20-

50%の割引

スポットフリート

fleet

requestor

maintain(default)

Instancesor

vCPUs可 request-spot-fleet

配分戦略に応じて複数のスポットインスタンスプールを自動的に利用

※スポットフリートの request/maintain はスポットインスタンスの one-time/persistent に似た挙動

Page 8: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットインスタンスの価値

• スポットインスタンスの価格は需給に応じた時価

• スポットインスタンスはオンデマンドよりも概ね50-90%安価に利用ができるので、下記のような事が行なえる

• 同じ予算内で2-10倍のコンピューティング容量に増やして処理を高速化

• 既存ワークロードのコストを50-90%節減できる

• これら両立も可能

Page 9: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットインスタンスのリスク

• 使われていないEC2を提供する性質上、インスタンス利用中でも下記の条件で強制停止されてしまう

• 時価(Market price)が入札価格を上回った時

• オンデマンドの利用リクエストにより、余剰なEC2のキャパシティが不足した時

Page 10: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットインスタンスのリスクへの対策

• 耐障害性のあるシステム構成、アプリケーションにしておく(最後に説明するベストプラクティスに従う)

• 失いたくない重要データは定期的に影響を受けない場所に保管する(S3やEBSなど)

• 強制停止の2分前から提供される警告通知を使って、停止に備える対処をする (警告はインスタンスメタデータおよびCloudWatchイベントから得られる→5秒ごとの

ポーリングを推奨)※

※詳しくは「スポットインスタンスの終了の通知」参照http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/spot-interruptions.html

Page 11: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

6時間以下の単位で区切れる処理であればスポットブロックを選択する

~ 21% 1時間以内

~ 35% 2時間以内

~ 40% 3時間以内

およそ50%のインスタンスが6時間以内にターミネートされている

• 6時間の妥当性

CloudHealth Technologieshttps://www.cloudhealthtech.com/

スポットインスタンスのリスク への対策(つづき)

Page 12: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

オンデマンド価格

スポット価格について(Market price)

オンデマンド価格で入札しても支払う費用はその時々のMarket price

EC2の需給の応じて価格が変動リージョン、AZ、インスタンスタイプ毎にスポット価格は異なる

Page 13: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

EC2キャパシティーの概念図

ap-northeast-1a

(Tokyo Region)

m4.large

m4.xlarge c4.large

ap-northeast-1c

m4.large

m4.xlarge c4.large

使用中使用中

使用中

使用中

使用中 使用中 …

キャパシティー予約されたリソース(AZ指定のリザーブドインスタンス)

オンデマンドやスポットで使用中のインスタンス

使われていないインスタンス(スポットインスタンスプール)

Page 14: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Spot Market

$0.27 $0.29$0.50

1c 1d1a

8XL

$0.30 $0.16$0.214XL

$0.07 $0.08$0.082XL

$0.05 $0.04$0.04XL

$0.01 $0.04$0.01L

C4

$2.02

On

Demand

$1.01

$0.50

$0.25

$0.13

スポット価格は下記ぞれぞれで異なる• インスタンスファミリー• インスタンスサイズ• アベイラビリティーゾーン(AZ)

• リージョン

オンデマンドの価格設定は、「インスタンスファミリー」「サイズ」「リージョン」毎だが、スポットは加えてAZ毎でもマーケットが異なる

Page 15: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットインスタンスの使いどころ

Page 16: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポット向き/不向きな処理

<スポットに適した処理>

・1つあたりの処理時間が短いもの

・やり直しがきく処理

・処理時間にばらつきがあってよいもの

<スポットに適さない処理>

• 中断のできない長時間の処理

• 処理の期限が厳密に決まっているもの

Page 17: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットのユースケース

・ログ/データ解析・分析

・金融リスク分析

・イメージレンダリング

・動画エンコーディング

・ビッグデータ処理

・地理情報解析

・科学技術計算

・ゲノム解析

・ウェブクロール

・機械学習

・ブログラムのビルド

・テスト環境

Page 18: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Clemson University 110万vCPUを使用した機械学習処理

https://aws.amazon.com/jp/blogs/aws/natural-language-processing-at-clemson-university-1-1-million-vcpus-ec2-spot-instances/

Page 19: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

TIBCO 130万vCPUを使用した金融リスク分析

https://aws.amazon.com/jp/blogs/news/creating-a-1-3-million-vcpu-grid-on-aws-using-ec2-spot-instances-and-tibco-gridserver/

Page 20: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットの利用ができるAWSサービス

AWS

CloudFormation

AWS

OpsWorks

Amazon

EMRAmazon

ECS

AWS Data

Pipeline

AWS BatchAuto

Scaling

Page 21: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットがインテグレートされたコミュニティやパートナー

Page 22: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットインスタンスの新機能について

Page 23: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

最近1年間で追加されたスポット新機能

• 2017/07/24:スポットフリートリクエスト時にタグの指定が可能に [Link]

• 2017/09/18:スポットインスタンスでStop/Startが可能に [Link]

• 2017/10/18:EBSボリュームの暗号化対応 [Link]

• 2017/11/10:スポットフリートでELBへのインスタンス自動アタッチ対応 [Link]

• 2017/11/10:スポットフリートでターゲット容量0にスケールダウン可能に[Link]

• 2017/11/16:中国(北京)リージョンでスポットインスタンスが利用可能に [Link]

• 2017/11/28:スポットインスタンスでHibernation/Resumeが可能に [Link]

• 2017/11/28:RunInstances APIでスポットインスタンスが起動可能に [Link]

• 2017/11/28:新しい料金モデルに変更 [Link]

• 2017/11/28:T2インスタンスがスポットで利用可能に• 2018/01/23:割り込み2分前警告がCloudWatch Eventに対応 [Link]

• 2018/01/25:C5/M5インスタンスでHibernation/Resume機能サポート [Link]

Page 24: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

最近1年間で追加されたスポット新機能

• 2017/07/24:スポットフリートリクエスト時にタグの指定が可能に [Link]

• 2017/09/18:スポットインスタンスでStop/Startが可能に [Link]

• 2017/10/18:EBSボリュームの暗号化対応 [Link]

• 2017/11/10:スポットフリートでELBへのインスタンス自動アタッチ対応 [Link]

• 2017/11/10:スポットフリートでターゲット容量0にスケールダウン可能に[Link]

• 2017/11/16:中国(北京)リージョンでスポットインスタンスが利用可能に [Link]

• 2017/11/28:スポットインスタンスでHibernation/Resumeが可能に [Link]

• 2017/11/28:RunInstances APIでスポットインスタンスが起動可能に [Link]

• 2017/11/28:新しい料金モデルに変更 [Link]

• 2017/11/28:T2インスタンスがスポットで利用可能に• 2018/01/23:割り込み2分前警告がCloudWatch Eventに対応 [Link]

• 2018/01/25:C5/M5インスタンスでHibernation/Resume機能サポート [Link]

Page 25: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

新たな価格モデルへの改定

低価格・予想しやすい価格変動

入札価格の指定無しでスポットリクエスト可

Page 26: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

新たな価格モデルへの改定 (改定のポイント)

• 価格の変更頻度が減少し、スムーズな価格変動グラフに (安心できるスポット

価格モデルに)

• 最高価格での入札不要 (スポット価格の最大はオンデマンドの価格が上限に)

• 入札価格の指定なしでスポットリクエストが可能に (自動で上限のオンデマン

ド価格がセットされる)

スポット価格モデル改定により、コスト的に安心な構造となり、

使い方もシンプルになった

Page 27: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポット価格モデルの改定 before-after例)バージニアリージョン c5.18xlarge

2017/11/29前後

Page 28: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポット価格モデルの改定 before-after

2017/11/29前後

例)バージニアリージョン p3.16xlarge

Page 29: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

APIを統一化

オンデマンドと同一のAPIでスポット起動が可能

$ aws ec2 run-instances --image-id ami-15e9c770 ¥--count 1 --instance-type c4.large --instance-market-options MarketType=spot

現時点で入札価格の指定はできない

Page 30: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットインスタンスのStop&Hibernation動作対応

スポットリクエスト時にインスタンスの中断動作を指定

スポットはStopおよびHibernateのインスタンスライフサイクルを管理

Terminate HibernateStop

Page 31: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットでのStop/Start機能

• EC2のStop/Startと同じ動作

• 追加料金なしでStop/Start機能の利用が可能

• ルートボリュームはEBSが使用が前提(EBS-

backed)

• ルートボリュームとアタッチされたボリュームを維持

• スポットリクエストのタイプはpersistentである必要がある(スポットフリートの場合は“maintain”

オプション)

• ~2分の警告は従来通り

Page 32: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットでのStop/Start機能(ユースケース)

長いプロビジョニングを必要とするワークロード (ソフトウェ

アや通信のセットアップなど)

永続的にデータを維持する必要があるステートフルなアプリケーション

時間経過と共にストレージ内のデータを変更するアプリケーション(開

発・テストワークロード)

PC/ワークステーション

Page 33: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットでのHibernate/Resume機能

• ラップトップPCを開け閉めするのと似た動作

• 稼働中のメモリイメージをルートボリュームに書き出して永続化

• 追加料金なしでStop/Start機能の利用が可能

• ルートボリュームはEBSが使用が前提(EBS-

backed)

• ルートボリュームとアタッチされたボリュームを維持

• スポットリクエストのタイプはpersistentである必要がある(スポットフリートの場合は“maintain”

オプション)

Page 34: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットでのHibernate/Resume機能(つづき)

• 対応するインスタンスタイプ: C3, C4, C5, M4, M5, R3,

R4 のメモリが100GB以下のもの

• EBSボリュームのサイズはメモリサイズ以上が必須

• Hibernationエージェントがプリインストールもしくは追加導入したOSをならびにAMIを使用

• サポートされるOS

Amazon Linux

Ubuntu (linux-aws 4.40-1041以降)

Windows (2008 R2以降)

• Hibernationエージェントを起動させておく

より詳細は下記ドキュメントを参照:

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-hibernation.html

Page 35: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットでのHibernate/Resume機能(注意事項)

Hibernate状態のインスタンス数が多い場合はEBSボリュームとElasticIPの上限に注意する

前提条件を満たしていなかった場合、インスタンスは停止状態になる

中断2分前の通知は行われるが、Hibernate処理は2分待たずに即座に開始される

メモリイメージがディスクに書かれるのでHibernation機能を使用する場合は暗号化されたEBSボリュームをルートボリュームに使用することを推奨

Page 36: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットでのHibernate/Resume機能(ユースケース)

メモリの状態を保持する長時間実行されるタスク

HPCワークロード 多くの状態/

キャッシュを保持するアプリケーション

Page 37: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポット利用を支援するツール

Page 38: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

インスタンスタイプ毎にオンデマンド価格に対するコストセーブ率やスポットキャパシティ不足によりインスタンスを中断頻度(確率)を一覧表示

価格セーブ率や中断の頻度の値でソートが可能で、中断リスクの低いインスタンスや割引率の高いインスタンスを探すのに便利

EMRインスタンスにも対応

スポットインスタンスアドバイザー

https://aws.amazon.com/jp/ec2/spot/instance-advisor/

Page 39: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Spot Advisor (管理コンソール画面)

リクエストしたいvCPUやメモリ、台数などを入力すると

Page 40: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Spot Advisor (管理コンソール画面)

おすすめのフリートをリストアップしてくれる

リストアップされたフリートをそのままオーダーできる

Page 41: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

EC2 Spot Labs https://github.com/awslabs/ec2-spot-labs

スポットインスタンスのベストプラクティスな例を示すサンプルコードやスクリプトがコレクションされたサイト

Page 42: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットインスタンスのベストプラクティス

Page 43: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットインスタンスのベストプラクティス

フォールト

トレランスステートレス マルチAZ 疎結合

インスタンスタイプに対する柔軟性

Page 44: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

スポットインスタンスのベストプラクティス

1、ステートレス→インスタンスをステートレスに保つ≒個々のサーバに依存した情報を持たない

2、フォールトトレランス→インスタンスに問題が発生してもリカバリー可能な、耐障害性のあるシステム

3、マルチAZ

→どのAZで実行しても動作に支障がない構成に

4、疎結合→どのインスタンスがいつ終了しても問題ない状態に

5、インスタンスタイプに対する柔軟性→ 複数のスポットプールに対応できるアプリケーション、システムを

Page 45: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

<参考>EC2インスタンスファミリー(各最新世代スペック一覧)

FamilyCPU(クロックGHz)vCPU

数メモリ[GiB]ストレージ アクセラレータ ユースケース

汎用T2

Intel Xeon Family (

最大3.3 or 3.0GHz)1〜8 0.5〜32 EBSのみ なし

開発環境、Web、マイクロサービス

M5Xeon Plutinum

8175(2.5GHz)2〜96 8〜384 EBSのみ なし

小中規模のDB、キャッシュサーバ

コンピューティング最適化

C5Xeon Plutinum

8000(3.0GHz)2〜72 4〜144 EBSのみ なし

HPC、バッチ処理、動画エンコーディング

ストレージ最適化

D2Xeon E5-

2676v3(2.4GHz)4〜36 30.5〜244

最大48TB

HDDなし

BigData処理、分散型ファイルシステム

H1Xeon E5-

2686v4(2.3GHz)8〜64 32〜256

最大16TB

HDDなし

BigData処理、分散型ファイルシステム

I3Xeon E5-

2686v4(2.3GHz)2〜64 15.25〜488

最大15.2TB

NVMe SSDなし NoSQLデータベース、DWH

メモリ最適化R4

Xeon E5-

2686v4(2.3GHz)2〜64 15.25〜488 EBSのみ なし

ハイパフォーマンスDB、BigData処理

X1eXeon E7-

8880v3(2.3GHz)4〜128 122〜3904

最大3840GB

SSDなし

インメモリDB、ハイパフォーマンスDB

アクセラレーテッド

G3Xeon E5-

2686v4(2.3GHz)16〜64 122〜488 EBSのみ

NVIDIA Tesla M60 GPU

(最大4)

3Dビジュアライゼーション、レンダリング、動画処理

P3Xeon E5-

2686v4(2.3GHz)8〜64 61〜488 EBSのみ

NVIDIA Tesla V100 GPU

(最大8)機械学習/深層学習、HPC

F1Xeon E5-

2686v4(2.3GHz)8〜64 122〜976

最大3760GB

SSD

Xilinx Virtex UltraScale+

VU9P FPGA (最大8)

ゲノム分析、リスク計算、リアルタイムビデオ処理

Page 46: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

<参考>EC2インスタンスファミリー(各最新世代スペック一覧)

FamilyCPU(クロックGHz)vCPU

数メモリ[GiB]ストレージ アクセラレータ ユースケース

汎用T2

Intel Xeon Family (

最大3.3 or 3.0GHz)1〜8 0.5〜32 EBSのみ なし

開発環境、Web、マイクロサービス

M5Xeon Plutinum

8175(2.5GHz)2〜96 8〜384 EBSのみ なし

小中規模のDB、キャッシュサーバ

コンピューティング最適化

C5Xeon Plutinum

8000(3.0GHz)2〜72 4〜144 EBSのみ なし

HPC、バッチ処理、動画エンコーディング

ストレージ最適化

D2Xeon E5-

2676v3(2.4GHz)4〜36 30.5〜244

最大48TB

HDDなし

BigData処理、分散型ファイルシステム

H1Xeon E5-

2686v4(2.3GHz)8〜64 32〜256

最大16TB

HDDなし

BigData処理、分散型ファイルシステム

I3Xeon E5-

2686v4(2.3GHz)2〜64 15.25〜488

最大15.2TB

NVMe SSDなし NoSQLデータベース、DWH

メモリ最適化R4

Xeon E5-

2686v4(2.3GHz)2〜64 15.25〜488 EBSのみ なし

ハイパフォーマンスDB、BigData処理

X1eXeon E7-

8880v3(2.3GHz)4〜128 122〜3904

最大3840GB

SSDなし

インメモリDB、ハイパフォーマンスDB

アクセラレーテッド

G3Xeon E5-

2686v4(2.3GHz)16〜64 122〜488 EBSのみ

NVIDIA Tesla M60 GPU

(最大4)

3Dビジュアライゼーション、レンダリング、動画処理

P3Xeon E5-

2686v4(2.3GHz)8〜64 61〜488 EBSのみ

NVIDIA Tesla V100 GPU

(最大8)機械学習/深層学習、HPC

F1Xeon E5-

2686v4(2.3GHz)8〜64 122〜976

最大3760GB

SSD

Xilinx Virtex UltraScale+

VU9P FPGA (最大8)

ゲノム分析、リスク計算、リアルタイムビデオ処理

CPUやメモリのスペックだけ

で見るとインスタンスタイプが違っても同一スペックのものが多く存在

CPUやメモリのスペックだけ

で見るとインスタンスタイプが違っても同一スペックのものが多く存在

CPUやメモリのスペックだけ

で見るとインスタンスタイプが違っても同一スペックのものが多く存在

Page 47: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

<参考>マルチAZ利用を助けるデータストアサービス一例

Amazon Elastic

File System

(EFS)

Amazon S3

Amazon EC2

Container

Registry(ECR)

Page 48: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

まとめ

Page 49: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

まとめ

スポットインスタンスは機能拡張によって

• スポット価格を意識しなくても簡単に安価に利用が可能に

• 価格変動も緩やかになり、誰でも安心して使える

• Stop/Hibernation機能で利用シチュエーションが拡大

スポットが適用できるシーンを再検討してコスト削減と

コンピューティングの更なる活用に役立てる

Page 50: Amazon EC2 Spot Instance Deep Dive · 2018-08-17 · © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 小川貴士 Amazon EC2 Spot Instance Deep Dive アマゾンウェブサービス

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ありがとうございました