[AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

77
© 2012 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マイスターシリーズ Amazon Elastic Compute Cloud (Amazon EC2) 2013.03.13 アマゾンデータサービスジャパン株式会社 技術統括本部長 玉川 憲 ソリューションアーキテクト 安川 健太

description

 

Transcript of [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

Page 1: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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マイスターシリーズ

Amazon Elastic Compute Cloud (Amazon EC2)

2013.03.13 アマゾンデータサービスジャパン株式会社

技術統括本部長 玉川 憲

ソリューションアーキテクト 安川 健太

Page 2: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

Amazon EC2とは?

Amazon EC2の基本

Amazon EC2のセキュリティモデル

最新アップデート!

利用におけるTIPS

料金モデル

まとめ

Page 3: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

今日のAgenda

Amazon EC2とは?

Amazon EC2の基本

Amazon EC2のセキュリティモデル

最新アップデート

利用におけるTIPS

料金モデル

まとめ

Page 4: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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の様々なサービス

4

お客様のアプリケーション

認証 AWS IAM

モニタリング Amazon

CloudWatch

Web管理画面 Management

Console

デプロイと自動化 AWS Elastic Beanstalk

AWS CloudFromation AWS OpsWorks

IDEプラグイン Eclipse

Visual Studio

ライブラリ & SDKs Java, PHP, .NET,

Python, Ruby

デプロイ&

アドミン

コンテンツ配信 Amazon CloudFront

メッセージ Amazon SNS Amazon SQS

分散処理 Elastic MapReduce

メール配信 Amazon SES

キャッシング Amazon Elasticache

ワークフロー管理 Amazon SWF

アプリケーション

サービス

コンピュータ処理 Amazon EC2

Auto Scale

ストレージ Amazon S3

Amazon EBS AWS StorageGateway

データベース Amazon RDS

Amazon DynamoDB Amazon SimpleDB Amazon RedShift

AWS グローバルインフラ 世界に拡がるリージョン, アベイラビリティゾーン, エッジロケーション AZ Region

ネットワーク & ルーティング Amazon VPC / Amazon Elastic Load Balancer / Amazon Route 53 /AWS Direct Connect

インフラストラクチャ

サービス

Page 5: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

Amazon EC2のイメージ

データセンター

仮想サーバ(Amazon EC2)

Windows ( スタンダード)

CentOS (ハイCPU)

Oracle DB(Linux) (ハイメモリ)

コマンドライン / SDK利用

SSH公開鍵 認証

仮想外部ディスク (Amazon EBS)

Amazon S3

マシンイメージ (AMI)から 起動

仮想デスクトップ

ターミナル

AMI 保存

API

Webコンソール

Page 6: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

リージョンとエッジロケーション

カリフォルニア ダブリン

シンガポール

東京

オレゴン

バージニア

サンパウロ

リージョン

エッジローケーション

GovCloud

世界8(+1)カ所のリージョン(地域) 39のエッジロケーション を即座に利用可能

http://aws.amazon.com/jp/about-aws/globalinfrastructure/

シドニー

Page 7: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

アベイラビリティゾーン(AZ)

• 各リージョン内に、複数のAZ(データセンター群)が存在 • 各AZはお互いに影響を受け難いように、

地理的・電源的・ネットワーク的に分離して設計 • AZ間は高速専用線で接続(リージョン間はインターネット経由)

Page 8: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

EC2は非常に汎用的なプラットフォーム

コンシューマー & ウェブアプリケーション

HPC & ビッグデータ

全社 & 部門 アプリケーション

バックアップ & ディザスタリカバリー

Oracle, SAP, Microsoft, Dassault 顧客の業務アプリケーション

コンシューマー向けWebサイトのログ解析 ゲノム配列解析 大規模バッチプロセス

E-コマース ウェブサイト ゲーム ファイル同期 & 共有サービス

オンプレミスデータのバックアップ テープの代わりにアーカイブに利用 ディザスタリカバリー

Page 9: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

典型的Webアーキテクチャ(他のサービスとの組み合わせ)

東京リージョン

AZ-1a AZ-1c

EC2 EC2

RDSマスタ RDSスレーブ

自動同期

ELB (ロードバランサ)

Amazon Route 53 (ドメイン名割り当て)

静的コンテンツ

S3

CloudFront

(コンテンツ 配信)

Page 10: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

Virtual Private Cloud (VPC)とEC2

AWSパブリック

クラウド環境

Amazon Virtual Private

Cloud (VPC)環境

ユーザごとの

プライベート領域で

インスタンスを利用可!

これまでの標準環境 今後の標準環境

VPC for Everyone!

Page 11: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

今日のAgenda

Amazon EC2とは?

Amazon EC2の基本 • 触ってみよう!

• 基本コンセプト

Amazon EC2のセキュリティモデル

最新アップデート

利用におけるTIPS

料金モデル

まとめ

Page 12: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

マネジメントコンソールからログイン

作成したアカウントのメールアドレス・パスワードでログイン • https://console.aws.amazon.com/ec2/home

Page 13: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

AWSサービスの選択 Webコンソールでコントロールするサービスを選ぶ

Page 14: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

リージョン選択 日本にいながら、世界中のどのリージョンも選択できる

XXXX

Page 15: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

AMI選択

任意のAMIを選ぶことで、 好みの環境 (OS、ミドルウェア、アプリ、データ) を選択できる

Page 16: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

台数、インスタンスタイプ、 アベイラビリティゾーンの指定

Page 17: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

EBSの設定

Page 18: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

Key Pair選択

いわゆる公開鍵方式でサーバーにアクセスする。 初回時は、秘密鍵を、手元にダウンロードする

Page 19: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

Security Groups選択

いわゆるファイアウォールの設定 作っておいたグループをサーバーに割り当てる

Page 20: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

起動完了

起動完了画面を確認し、起動ウィザードを終了

Page 21: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

起動したインスタンスの情報確認

XXXXX

パブリックDNS名

Page 22: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

ターミナルでアクセス

ログインの際のアカウント名は、AMIによって違うので注意

例) Amazon Linux -> ec2-user

その他Linuxの多く -> root

パブリックDNS名

秘密鍵

Page 23: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

今日のAgenda

Amazon EC2とは?

Amazon EC2の基本 • 触ってみよう!

• 基本コンセプト

Amazon EC2のセキュリティモデル

最新アップデート

利用におけるTIPS

料金モデル

まとめ

Page 24: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

Amazon Machine Image (AMI)

AMIはインスタンス作成に使用するイメージテンプレート

AWS公式AMIや、サードパーティもAMIを提供 • https://aws.amazon.com/amis/

• https://aws.amazon.com/marketplace/

選択したAMIから起動する

EC2インスタンスから、任意のタイミングで カスタムAMIを作成できる

launch

Amazon

Machine

Image (AMI)

Amazon EC2インスタンス

Page 25: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

AMIとインスタンス、AZの関係

インスタンス

Amazon S3

AMI

Availability Zone-1a Availability Zone-1b

カスタム

AMI

AMIからインスタンスを 起動

カスタムAMIを使って、インスタンスを複数台起動

カスタムAMIを作成 必要に応じて共有設定

Page 26: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

AMIの取得/AMIからの起動

Copyright © 2011 Amazon Web Services

Page 27: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

EC2インスタンスのライフサイクル

起動したインスタンスは3つの状態を持つ • Running : 実行中、課金される

• Stopped : 停止中、課金されない

• Terminated: 終了。Stop/Startはできない。

Running

Terminated

Stopped

Start Stop

Terminate

launch

Terminate

Amazon

Machine

Image (AMI)

Amazon EC2インスタンス

Page 28: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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インスタンスの停止と終了

Page 29: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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インスタンスのタイプ変更

Stop(停止)していると、いつでもタイプ(スペック)を変更できる

Page 30: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

Amazon Elastic Block Store (EBS)

EBSとは、EC2に仮想外付けされる

ブロックレベルのストレージサービス

サイズは1GB単位で~1TBまで

サイズ/期間(/IO)で課金される

各EC2インスタンスで、複数EBSを使える

詳細

データは永続的に保存される

いつでもバックアップ(スナップショット)

スナップショットから、EBSを作成可能 (他のAZに作成できる)

Provisioned IOPSでIOパフォーマンス指定 • 2013年3月時点で、最大2000IOPS

他のEC2インスタンスに付け替え可能

Region

Availability Zone - a

EBS EBS EBS

Availability Zone - b

EBS EBS

Amazon S3

EBS スナップショット

EC2 EC2

Page 31: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

EBSボリュームのアタッチ

Copyright © 2011 Amazon Web Services

EC2インスタンスと、同じゾーンに作ることを注意。

スナップショットから複製も可能。

Page 32: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

EC2インスタンスのアドレス

全てのインスタンスが下記を持つ

Private IPアドレス

Private DNS名(*.internal)

Public DNS名 (*.amazonaws.com)

public IPアドレスをオプションで付けられる

Elastic IP Addresses (EIP)と呼ぶ

稼働しているEC2インスタンスに、瞬時に付け外しが可能

インスタンスにアサインしているときは料金はかからない

Page 33: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

EIPの割り当て

Page 34: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

EIPの使いどころ

通常のケースはEIPは必要なく、 EC2のPublic DNS名を用いて、CNAMEで名前変換を行う

Route 53(名前解決サービス)で、Public DNSを用いる

固定IPアドレスが必要なときに限りEIPを用いる

メールサーバー、監視サーバー等

メールサーバの送信制限解除、逆引き申請が必要な場合は下記から申請を行う https://aws-portal.amazon.com/gp/aws/html-forms-controller/contactus/ec2-email-limit-rdns-request

Page 35: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

Amazon EC2の関連サービス/関連情報

監視、負荷分散、自動スケール

→CloudWatch、ELB、AutoScaling

閉域網での利用、仮想ネットワーキング

→Amazon VPC (Virtual Private Cloud)

① 社内ネットワークからVPN接続

② ルーティング、イントラIPアドレス、仮想NIC、等々

占有サーバ →Amazon Dedicated Instance

専用線接続 →Amazon Direct Connect

Windows →Windowsインスタンス

スパコン →HPCインスタンス

アクセス管理 →IAM (Identity and Access Management)

料金関係 →Consolidated Billing

昨年の資料集 http://aws.amazon.com/jp/aws-meister/

Page 36: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

今日のAgenda

Amazon EC2とは?

Amazon EC2を触ってみる

Amazon EC2のセキュリティモデル

最新アップデート

利用におけるTIPS

料金モデル

まとめ

Page 37: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

AWSのセキュリティの考え方

第三者認証

SOC 1/SSAE 16/ISAE 3402,

ISO 27001, PCI DSS, HIPAA, ITAR,

FISMA Moderate, FIPS 140-2

ファシリティ DC、電源、ネットワーク冗長化

Your

Apps

Webサイト/アプリケーション これまでと同様の セキュリティを

お客様、SI様で実現可能

インフラ よりハイレベルの

セキュリティをAWSが提供

シェアード・レスポンシビリティ・モデル(責任共有モデル)

Page 38: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

EC2の責任共有モデル

物理インタフェース

ファイアウォール

ハイバーバイザー

Sm

all

Larg

e

Sm

all Amazon EC2

インスタンス

物理ホスト

ユーザーが

責任を持って

管理する

AWSが

責任を持って

管理する

Page 39: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

ファイアウォールを実現するSecurity Group

インスタンスへのトラフィックを制限するファイアウォール機能

デフォルトで全トラフィック閉

必要な受信アクセスに対してアクセスルールを定義する • プロトコル( TCP/UDP)

• 宛先ポート

• アクセス元IP / Security Group

ルールをひとまとめにした テンプレートを Security Groupと呼ぶ

EC2 インスタンス

ポート22 (SSH)

ポート80 (HTTP)

EC2ファイアウォール

Security Group

ポート25 (SMTP)

Page 40: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

Security Groupの使い方

インスタンスの用途に応じたSecurity Groupを用意する • Webサーバ用、DBサーバ用、メールサーバ用等

アクセス元にSecurity Groupも設定して限定可能

Webサーバ

Webサーバ

DBサーバ

sg-1234

22: 0.0.0.0/0

80: 0.0.0.0/0

25: sg-1234

sg-1234

sg-1234

sg-abcd sg-abcd

22: 0.0.0.0/0

3306: sg-1234

Webサーバ

sg-xyz

Page 41: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

セキュリティ証明書

仮想サーバ(Amazon EC2)

Windows ( スタンダード)

コマンドライン / SDK利用

SSH公開鍵 認証

仮想デスクトップ

ターミナル

REST / SOAP

API

Webコンソール

①EC2インスタンスへのアクセス

→鍵認証

②Webコンソールへのアクセス

→パスワード認証 / 多要素認証 / IAM

③APIへのアクセス →アクセスキー /

X.509証明書 / IAM

Page 42: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

Key Pair(キーペア)を用いた鍵認証

鍵認証は、ユーザ名・パスワードの認証よりも安全な認証方式

ダウンロードされた秘密鍵

①キーペア作成

②インスタンス起動時に 公開鍵をコピー

公開鍵

③公開鍵・秘密鍵の ペアが合致すると ログイン可能

Page 43: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

EC2のSLA

EC2の可用性が99.95%

上記に満たない場合は、Serviceクレジットを返還する

詳細は

http://aws.amazon.com/ec2-sla/

Page 44: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

AWSの運用への努力

各サービスの状況をWeb上でリアルタイム表示

Service Health Dashboard http://status.aws.amazon.com/

Page 45: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

AWSセキュリティセンター

日本語のホワイトペーパー • セキュリティ概要

• リスクとコンプライアンス

Page 46: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

今日のAgenda

Amazon EC2とは?

Amazon EC2を触ってみる

Amazon EC2のセキュリティモデル

最新アップデート

利用におけるTIPS

料金モデル

まとめ

Page 47: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

VPC for Everyone! --EC2-VPCがデフォルトに--

AWSパブリック

クラウド環境 EC2-Classic

EC2-VPC

AWSパブリック

クラウド環境

EC2-VPC

従来のインスタンス起動

• VPCか否かを選択

• デプロイ先AZ / Subnetを選択

EC2-VPCがデフォルトの場合

• VPCか否かを選択

• デプロイ先AZ / Subnetを選択

選択しなければ

EC2-Classic

常にEC2-VPC!

2013年3月12日発表!

Page 48: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

EC2-VPCがデフォルトの場合の動作

初めてインスタンスを起動する際の動作

1. Default VPCが自動作成される

2. 各AZにDefault Subnet (public)が自動作成される

3. 選択したAZのDefault Subnetにインスタンスがデプロイされる

4. EC2インスタンスにはPublic IPアドレスがアサインされる

Default VPC (172.31.0.0/16)

デフォルトのデプロイ先VPC

Default Subnet

AZごとに作成されるデフォルトのデプロイ先サブネット

大きさは/20 (4096 IPs)

Public IPアドレス

インスタンスに動的割当て

されるGlobal IPアドレス

Page 49: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

VPC for Everyoneがもたらすのは

EC2-VPCが適用されたお客様には

• VPCの進んだネットワーク機能を今までと同様の使い方で提供

これまでと使い方が変わってしまう?

AWSを使い始めるためにVPC

を学ばないといけない?

No!

いわば、EC2サービスのアップグレード!

Page 50: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

EC2-VPCの適用で可能になること

VPCでは出来て、EC2-Classicでは出来なかった全て

• 静的IPアドレス設定

• 複数IPアドレス

• 複数ネットワークインターフェース

• セキュリティグループのメンバーシップの動的変更

• セキュリティグループによるOutboundフィルタリング

• NACL

• …

VPC 自体の恩恵

• 複数Subnetの利用

• Private SubnetにPrivate接続してEC2を利用

Page 51: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

いつから誰に適用されるか

既に利用実績のあるリージョンについてはこれまで通り

• EC2-ClassicとEC2-VPCの両方をサポート

新規利用のリージョンに適用されていればEC2-VPCがデフォルトに

• シドニー、サンパウロから適用開始

• リージョンによって適用開始時期は異なります

Page 52: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

128

64

32

16

8

4

2

1

1 2 4 8 16 32 64 128

新EC2インスタンスタイプ – M3

EC2起動時に任意のインスタンスタイプ(スペック)を選択可能 • http://aws.amazon.com/jp/ec2/instance-types/

EC2 Compute Units (ECU)

Mem

ory

(G

B)

Small 1.7 GB 1 EC2 Compute Unit 1 virtual core $0.092/0.115

Micro 613 MB Up to 2 ECUs (for short bursts) $0.027/0.035

Large 7.5 GB 4 EC2 Compute Units 2 virtual cores $0.368/0.460

Extra Large 15 GB 8 EC2 Compute Units 4 virtual cores $0.736/$0.920

High-CPU Med 1.7 GB 5 EC2 Compute Units 2 virtual cores $0.190/$0.285

High-CPU XL 7 GB 20 EC2 Compute Units 8 virtual cores $0.760/$1.140

Cluster GPU 4XL 22 GB 33.5 EC2 Compute Units, 2 x NVIDIA Tesla “Fermi” M2050 GPUs $2.10/2.60

Cluster Compute 4XL 23 GB 33.5 EC2 Compute Units $1.60/1.98

Cluster Compute 8XL 60.5 GB 88 EC2 Compute Units $2.40/2.97

Medium 3.75 GB 2 EC2 Compute Unit 1 virtual core $0.184/0.230

Hi-Mem 4XL 68.4 GB 26 EC2 Compute Units 8 virtual cores $2.072/$2.280

Hi-Mem 2XL 34.2 GB 13 EC2 Compute Units 4 virtual cores $1.036/$1.140

Hi-Mem XL 17.1 GB 6.5 EC2 Compute Units 2 virtual cores $0.518/$0.570

M3 Extra Large 15 GB 13 EC2 Compute Units 4 virtual cores $0.736/$0.920

Extra Large 30 GB 26 EC2 Compute Units 8 virtual cores $0.736/$0.920

Page 53: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

リージョン間AMIコピー

Page 54: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

去年からのEC2関連アップデート EC2 ミディアムインスタンス追加

EC2 64ビット対応インスタンス2つ追加

EC2 ウェブコンソールにSSHクライアント統合

EBSボリュームの状態を監視可能に

Amazon EC2のVMをエクスポートできる機能が追加

IAM role for EC2が追加

EC2インスタンスのステータスメトリクス

Red Hat Enterprise LinuxのEC2リザーブドインスタンス

Provisioned IOPS for EBS

AWS Management Console: AWS Marketplaceにアクセスしやすく, EBSディスクの編集が可能に

2TBのSSDを持つ、ハイ I/O EC2 インスタンスの登場

Amazon EC2 リザーブドインスタンスマーケットプレイスオープン

Amazon EC2 Cluster GPUインスタンス (cg1.4xlarge)がアイルランド、VPC内で利用可能に

TCO Comparison Calculator for Web Applications リリース

Amazon EC2 第二世代スタンダートインスタンスタイプ登場

Amazon EC2 第一世代スタンダートインスタンスタイプ値下げ

Amazon EC2 スポットインスタンスの入札ステータスを取得可能に

IAM role を使ったAPIアクセスの移譲機能

EBS プロビジョンドIOPSのスループットを2000まで設定可能に

EC2にハイメモリクラスタエイトエクストララージのインスタンスタイプが追加

EC2のM3インスタンスが全リージョンで利用可能に。さらにEC2の料金とリージョン間の転送料金を値下げ。

EC2のハイメモリクラスタおよびハイI/Oインスタンスが米国西部(オレゴン)で利用可能に

Linux用CloudWatch監視スクリプトに新機能を追加

IAM Role サポート スクリプト -> CloudWatch

Page 55: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

今日のAgenda

Amazon EC2とは?

Amazon EC2を触ってみる

Amazon EC2のセキュリティモデル

最新アップデート

利用におけるTIPS

料金モデル

まとめ

Page 56: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

故障のための設計: Design for Failure

故障に備えた設計をしておく

すべてが故障しうると考え、システム全体での保守的設計

SPOF(単一障害点)の排除

障害からの復旧(対応品質)を重視する

EC2における故障のための設計

AMIを常にとっておく

EBSスナップショットでバックアップ

複数アベイラビリティゾーンへの分散

ELBでサーバを冗長化、Auto Scalingで自動復帰

Reserved Instanceでキャパシティ保障

他の冗長性高いサービスとの組み合わせ

S3, SimpleDB, RDS他

http://www.slideshare.net/kentamagawa/aws-7991623

Page 57: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

定期的なバックアップ

EC2のAMIを定期的に作成する (参考) 無停止でAMI取得 Cloudpackさんブログhttp://blog.cloudpack.jp/2011/03/aws-news-ec2-instance-no-reboot-ami.html

データボリュームとしてのEBSの場合、EBSのスナップショットを定期的に作成

スクリプトを書いて定期的なバックアップを行うことも可能 Code.rockさんブログhttp://blog.dateofrock.com/2010/03/auto-backup-amazon-ebs-with-ruby.html

サーバーワークスさんブログhttp://blog.serverworks.co.jp/tech/2011/07/21/awssdk-for-ruby-create-snapshot/

Page 58: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

EC2へのファイル転送は?

SCPを使う

scp pk-XXX.pem [email protected]:/xxx

Windowsの場合は、WinSCPなど

S3経由で共有する

S3にアップロードし、EC2からwgetでアクセスする

FTPを立ち上げる

EC2側でFTPサーバーを立ち上げておく

高速に送信したい

Tsunami UDP, Aspera等のソリューション

Page 59: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

VM Import / Export

複数プラットフォームのVMイメージを、 Amazon EC2に移行(インポート、エクスポート)可能

http://aws.typepad.com/aws_japan/2010/12/vm-import-bring-your-vmware-images-to-the-cloud.html

Page 60: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

稼働EC2インスタンスからメタデータ取得

ami-id

ami-launch-index

ami-manifest-path

block-device-mapping/

hostname

instance-action

instance-id

Instance-type

kernel-id

local-hostname

local-ipv4

mac

network/

placement/

profile

public-hostname

public-ipv4

public-keys/

reservation-id

curl http://169.254.169.254/latest/meta-data

Page 61: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

起動時にパラメーターを渡す

起動時に16KB以内で任意のものを渡せる

ChefやPuppetなどを利用して、自己構成できるAMIに

参照 AWSマイスター CloudFormation資料http://www.slideshare.net/kentamagawa/cloudformation-aws5

Page 62: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

EC2コマンドラインツール & AWS SDKs

コマンドラインからEC2のAPIにアクセスできるツール

ツールをインストールし、セキュリティ証明書を配置

AWS SDKs

http://aws.amazon.com/code/

Page 63: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

マネージメントコンソールだけでなく、 APIからプログラマブルにアクセス

ec2-run-instances ami-b232d0db

--instance-count 3

--availability-zone

ap-northeast-1a --instance-type m1.small

ec2-run-instances ami-b232d0db

--instance-count 3

--availability-zone

ap-northeast-1b --instance-type m1.small

Tokyo リージョン

Page 64: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

EC2のスケジュールイベント表示機能

EC2インスタンスが稼働しているハードかソフトにメンテナンスが必要な場合に、情報を提供する仕組み

インスタンスリブート、システムリブート、リタイヤ

Page 65: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

EC2のステータスチェック機能

下記の2種類のチェックを自動テストで実行し、情報を提示 システムステータスチェック

EC2インスタンスに、ネットワークパケットが通るかチェック

インスタンスステータスチェック EC2インスタンスのOSが、ネットワークパケットを受け取るかチェック

もし状況に乖離がある場合は、レポートできます

Page 66: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

AWS制限増加申請

EC2を誤って大量に作成しないよう、最大インスタンス数の上限を20に制限しています

制限増加申請フォームで各種制限の増加を行えます

• http://aws.amazon.com/jp/contact-us/

Page 67: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

既存EBSボリュームのサイズ変更

例: 10GB -> 100GB変更への流れ

EBSをデタッチする

EBSからS3にスナップショットを作成する

新たなボリュームサイズを指定して、EBSを作成する

EBSをアタッチする

マウントして、リサイズする

リージョン

アベイラビリティゾーン

EC2インスタンス

Amazon

S3 スナップショット

EBS

(10GB)

EBS

(100GB)

Page 68: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

EBSとS3

EBSは複数EC2にアタッチ不可

単独のEC2インスタンスへのブロックデバイスとしての使い方

NFSのような使い方をする際は、EC2にミドルウェアを導入 (GlusterFS等)

S3は複数のEC2からアクセス可

ただし、Write Once Read A Lotな使い方に向いている

アップロード並列化も使える

耐久性の設計は、99.999999999%で非常に高い

Copyright © 2011 Amazon Web Services

リージョン

アベイラビリティゾーン

EC2インスタンス

Amazon S3

バケット

EBS

EC2インスタンス

HTTP/ HTTPS

Page 69: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

EIP使用時の注意点

グローバルIP(EIP)を用いた場合、インターネット経由のアクセスとなり、課金発生するケースがある

名前解決したいサーバに、固定IPを付与する

各サーバは、固定グローバルIPを元に AWSのDNSに名前を問い合わせ

問い合わせた結果返ってくる外部DNS名でサーバにアクセスを行う

EC2内部で外部DNS名を使ってアクセスすると 、プライベートIPアドレスに変換されるため、 目的のサーバにプライベートIPでアクセスできる

Page 70: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

今日のAgenda

Amazon EC2とは?

Amazon EC2を触ってみる

Amazon EC2のセキュリティモデル

最新アップデート

利用におけるTIPS

料金モデル

まとめ

Page 71: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

AWSの課金の仕組み

インターネット

ELB

EC2

EBS

S3

データ転送量

ELB利用料・データ処理量

インスタンスタイプ別利用料

EBSの利用料

S3の利用料

大半 を占める!

Page 72: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

AWSでは、EC2インスタンスの稼働料金が大半

ELB (1台) 19¥ 2%

EC2 (large, 7台) 871¥ 74%

EBS (300GB) 30¥ 3%

RDS (マルチAZ) 165¥ 14%

データ転送 55¥ 5%

その他 30¥ 3%

合計 1,170¥

「EC2料金、EBS料金」を見積もれば大まかにはOK

多くの場合、データ転送量は5%~15%程度

Page 73: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

Simple Monthly Calculator

Web上にある計算機を使って概算費用を計算できます http://calculator.s3.amazonaws.com/calc5.html?lng=ja_JP

Page 74: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

複数の価格モデル

課金モデルが選べる

通常の時間課金の オンデマンド・インスタンス

ある程度継続してEC2を使う(1年、3年)

EC2リザーブドインスタンス

入札を利用してより安く使う

EC2スポットインスタンス

→マイスターシリーズ: RI&スポットインスタンス

Page 75: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

AWS無料試用枠

AWSでは、無料試用枠を用意しています

• http://aws.amazon.com/jp/free/

Page 76: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

24時間・365日での日本語サポートの提供 • 日本語でのサポートをご提供しております

http://aws.amazon.com/jp/premiumsupport/

ベーシック デベロッパー ビジネス エンタープライズ

受付時間 24時間 / 365日(年中無休)

初回応答時間 セルフサービス 12時間

(営業時間内) 1時間 15分

サポート連絡先 N/A 1人 5人 無制限

チャット 不可 不可 可能 可能

TEL 不可 不可 可能 可能

専任スタッフ なし なし なし あり

料金(月額) 無料(AWSの利用料に

含まれる) $49/月

AWS利用総額の 10%~

※最低料金:$100/月

AWS利用総額の 10%~

※最低$15,000/月

80

Page 77: [AWSマイスターシリーズ] Amazon Elastic Compute Cloud (EC2)

© 2012 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

ご参加ありがとう ございました。