More Related Content
Similar to [AWSマイスターシリーズ]Amazon Simple Storage Service (S3)
Similar to [AWSマイスターシリーズ]Amazon Simple Storage Service (S3) (20)
More from Amazon Web Services Japan
More from Amazon Web Services Japan (20)
[AWSマイスターシリーズ]Amazon Simple Storage Service (S3)
- 1. AWSマイスターシリーズ
Amazon Simple Storage Service
(Amazon S3)
2013.03.27
アマゾンデータサービスジャパン株式会社
ソリューションアーキテクト 北迫 清訓
© 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がもつストレージサービス
Amazon S3とは?
Amazon S3の基本
Amazon S3の新機能
Amazon S3のTips
まとめ
2
© 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. AWSストレージサービスのゴール
お客様がデータを安心して預けられる、
サービスの提供
• データが安全に保管されている
• データが取りたい時に常に取得可能
• データを保存したい時に常に保存可能
• データが誰がいつアクセス出来るかを完璧
にコントロールできる
• データ保存が低価格で実現できる
3
© 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ストレージサービス
安価かつ高い耐久性を持つオンライン
S3 ストレージサービス
超安価かつ高い耐久性を持つコールドス
Glacier トレージサービス
オンプレミス環境と連携したバックアッ
StorageGateway プ&ストレージサービス
仮想サーバ(Amazon EC2)にマウントで
EBS きる共有ディスクサービス
4
© 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 S3とは?
Amazon S3はWeb時代のストレージ
ユーザはデータを安全にどこからでも保存可能
AWSの主力サービスの1つ。2006年から開始
開発者が“Webスケール”なコンピューティング
を可能にするよう設計された
• 高いスケーラビリティ
• 高い信頼性・堅牢性
• セキュア
• 高速
• 低価格
5
© 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.
- 6. Amazon S3は、データ保存の基盤
S3 世界中の8拠点から選択
東京リージョン
データ置くだけ。
インフラ、電源、 保存するデータは、
気にしない。 自動で暗号化する
容量無制限。 ことも可能
データセンターA
データセンターB
バケット
3か所以上で
自動複製
データセンターC
高い耐久性で
安価な従量課金 データ失わない:
99.999999999%
ファイル(バイナリ、 例:1GB/月 – 約10円
テキスト、画像、動画)
6
© 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.
- 7. Amazon S3の用語
バケット
• オブジェクト置場。最大100/アカウント。名前がユニークな必
要あり
オブジェクト
• Amazon S3に置くファイルでURLによるアドレスが付与。バ
ケット内には無制限にオブジェクトを置くことが可能。1オブ
ジェクトのサイズは5TBまで
キー
• オブジェクト毎に付与される一意なキー
ACL
• アクセスコントロールリスト
7
© 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.
- 8. Amazon S3のネームスペース
Amazon S3
バケット バケット
オブジェクト オブジェクト オブジェクト オブジェクト
バケット
オブジェクト オブジェクト
8
© 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.
- 9. Amazon S3 –実例にあてはめてみる -
Amazon S3
mculver-images media.mydomain.com
Beach.jpg 2009/maui/sun.jpg img1.jpg img2.jpg
public.blueorigin.com
Installer.msi img/pic1.jpg
9
© 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.
- 10. Amazon S3のコンセプト
Durable(堅牢であること)
Available (いつでも利用可能であること)
Scalable (スケールすること)
Secure (安全であること)
Fast (高速に動くこと)
Simple (シンプルに使えること)
Cost Effective (低コストであること)
10
© 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.
- 11. Durable(堅牢であること)
データを失わない設計
• データを3箇所以上にレプリケーション
• 障害検知とデータ修復
99.999999999%の堅牢性
• 3つ以上同時にDCが消失しない限りデータ
を失わない
11
© 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.
- 12. Available(常に利用可能なこと)
常に利用可能なように設計
• 99.9%可用性SLA、実際はほぼ100%
計画停止無し
全世界からどの地域でもインターネット
経由で利用可能
• 異なる8つのリージョンから選択
12
© 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.
- 13. Scalable(スケールすること)
論理的には無限にスケールする
どれだけのファイルでも保存可能
• 1バイトから、いくらでも保存可能
• 1つのファイルサイズは最大5TBまで
13
© 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. Secure(安全であること)
全ての通信はSSL暗号化
認証・認可機能を持つ
• ACLベース/ポリシーベース
• ユーザアクセスコントロール
暗号化機能を持つ
• サーバサイド/クライアントサイド暗号化
ログ機能
認定・認証の取得
• ISO27001/PCI-DSS/SOC1など
14
© 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. Fast(高速であること)
ピーク時最大85万リクエスト/秒
常に安定したレイテンシ
世界8か所にリージョン展開
• 最も近い場所を利用可能
専用線で直結も可能
15
© 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. Simple(シンプルに使えること)
ファイルのPUT/GET/DELETE/LIST
• これだけ。とってもシンプル
• データサイズも数も気にしなくてよい
サードパーティツールでFTPライクに利用
SDKで様々な言語からすぐに利用可能
PutObjectRequest putObjectRequest =
new PutObjectRequest(bucketName, key, file);
PutObjectResult result = this.client.putObject(putObjectRequest);
16
© 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. Cost Effective(低コストなこと)
従量課金で使った分だけお支払い
初期費用もいらない
17
© 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. Amazon S3の価格
ストレージ料金 リクエスト料金
スタンダード 低冗長化※ リクエストタイプ 価格
最初の1TB/月 $0.100/GB $0.080/GB PUT,COPY,POST,LISTリ $0.01 1,000リクエスト
次の49TB/月 $0.085/GB $0.068/GB クエスト あたり
次の450TB/月 $0.075/GB $0.060/GB 削除リクエスト Free
次の500TB/月 $0.070/GB $0.056/GB GETおよびその他リクエス $0.01 10,000リクエス
ト トあたり
次の4PB/月 $0.065/GB $0.052/GB
次の5PB/月 $0.060/GB $0.044/GB
データ転送料金 [価格例]
※低冗長化ストレージ(RRS) データ格納
2拠点への複製により堅牢性が99.99%
• 1TB 約9,500円/月
転送方向 価格
IN 全てのデータ転送「IN」 $0.000/GB
Webホスティング
OUT 最初の1GB/月 $0.000/GB (20MB程度のWebサイトで月間10万PV)
10TBまで/月 $0.201/GB • 約2,000円/月
次の40TB/月 $0.158/GB
次の100TB/月 $0.137/GB
次の350TB/月 $0.127/GB 2013年1月時点の東京リージョン価格表
350TB/月以上 お問い合わせ
同一リージョン内でのデータ転送は無料
18
© 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. Amazon S3の機能
19
© 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. Amazon S3の機能
マルチパートアップロード
Webサイト機能
バージョニング
サーバアクセスログ
S3セキュリティ機能
データの暗号化
オブジェクトの期限付き保存
20
© 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. Amazon S3マルチパートアップロード
巨大なオブジェクトを複数のチャン
クに分割してアップロード
• 各チャンク < 5GB
• チャンクがアップロードされたら、
単一オブジェクトに結合
• 自動で結合する場合
• 自分で分割→結合
21
© 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. Amazon S3 Webサイト機能
静的なWebサイトのホスティングをS3で!
• ファイルをアップロードして、Website機能をON!
22
© 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. Amazon S3バージョニング
全てのオブジェクトのバージョン管理下におき保存、検
索、リストアが可能。バージョニング中はオブジェクト
は削除されない。
Amazon S3でよくみる光景はユーザアクションによる
データ消失。こういった事態から重要なデータを保護す
る。ただし課金はバージョニング分かかる
23
© 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. Amazon S3サーバアクセスロギング
Amazon S3バケットへアクセスログを保存
• デフォルトでは出力しない
API/SDKで設定可能
アクセスログのデリバリではチャージしていない
• ログの保存ではチャージ。ただしいつでも削除可能
• アクセスログへのアクセスについては若干のチャージ
24
© 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. Amazon S3の認証機構
Amazon S3を含む全AWSサービスでセキュリティは最
優先事項
認証のないアクセスからはデータは確実に保護
オブジェクトは全てフルコントロール可能
特定ユーザに対して権限を与えることも勿論可能
How?
• AWS Identity and Access Management(IAM) ポリシー
• バケットポリシー
• ACL
25
© 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. AWS Identity and Access
Management (IAM)
アカウント内で複数ユーザを作成し、セキュリティクレ
デンシャルや権限を付与する事が可能
• S3のバケットにオブジェクトのPUT/LIST/GETなど
IAMで出来る事:
• ユーザレベルでのコントロール
• S3に対してのお客様要件にあわせた操作の制御
アクセスポリシー言語を記述する
• JSON format
26
© 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 S3バケットポリシー
Amazon S3バケットレベルのポリシーベースのコント
ロール
バケットオーナーだけが適用可能
• バケットレベルでのAllow/Deny
• バケット内のオブジェクトの権限のDeny
• バケットオーナーがオブジェクトオーナーだった場合のみオブ
ジェクトに適切な権限を与える
アクセスポリシー言語を記述する
• JSON format
27
© 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. バケットポリシーの一例
例:
• ユーザ(1-22-333-4444, 3-55-678-9100)に
“mybucket” (arn:aws:s3:::mybucket/*“,)というバケットに
対してGETリクエストの発行を許可
{ "Version":"2008-10-17",
"Id":"aaaa-bbbb-cccc-dddd",
"Statement" : [
{ "Effect":"Allow",
"Sid":"1",
"Principal" : {
"AWS":["1-22-333-4444","3-55-678-9100"]
},
"Action":["s3:GetObject*"],
"Resource":"arn:aws:s3:::mybucket/*",
}
]
}
28
© 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. Amazon S3 Access Control List
バケットからオブジェクトへのコントロール
バケットのACLをオブジェクトは継承しない
作成と適用はいつでも可能
100個ACLは作成可能:
• Owner
• Email
• Any AWS account
• Anyone
パーミッション:
• READ – Object or bucket
• WRITE – Create, overwrite, delete objects in bucket
• READ_ACP – Read ACL for bucket or object
• WRITE_ACP – Overwrite ACL for bucket or object
• FULL_CONTROL – All of the above
29
© 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. データの暗号化
サーバサイド暗号化
クライアントサイド暗号化
30
© 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. サーバサイド暗号化
• マネージメントコンソールから実施する
• GUIツールで実施する
• コードで実施する
AmazonS3Client client = new AmazonS3Client(credentials);
client.setEndpoint("s3-ap-northeast-1.amazonaws.com");
PutObjectRequest putRequest = new PutObjectRequest(
"shot6jp", “S3に置くファイル名", new File(“実際のファイル"));
ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.setServerSideEncryption(
ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION);
putRequest.setMetadata(objectMetadata);
PutObjectResult result = client.putObject(putRequest);
31
© 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. クライアントサイド暗号化
• GUIツールで実施する
• コードで実施する
KeyPairGenerator generator =
KeyPairGenerator.getInstance("RSA");
generator.initialize(512);
KeyPair keyPair = generator.generateKeyPair();
EncryptionMaterials encryptionMaterials =
new EncryptionMaterials(keyPair);
AmazonS3EncryptionClient client =
new AmazonS3EncryptionClient(credentials, encryptionMaterials);
client.setEndpoint("s3-ap-northeast-1.amazonaws.com");
PutObjectResult ret = client.putObject(
“バケット名”, “S3上のファイル名”, new File(“現状ファイル"));
32
© 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. オブジェクトの期限付き保存
バケット単位でオブジェクトの生存
期間を指定可能
• Prefix単位
• 期間・日付で指定可能
http://bit.ly/A9dE0b
33
© 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. Amazon S3の新機能
34
© 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. CORSサポート
CORS(Cross Origin Resource Support)
• クロスドメインでリソース取得が可能
• より簡単にリソースの共有が可能に
ブラウザ
WebサイトAが
オリジンなら
データをGETさ
WebサイトAバケット データバケット
せますよ
35
© 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. Webページリダイレクト
Amazon S3でWebページのリダイレ
クトが可能になりました
36
© 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. Webページリダイレクト
リダイレクトルールを渡して、条件
を満たす場合のみリダイレクト
• キーのプレフィックスを一部変更
• 削除したディレクトリから別ページへ
• HTTPエラーコードで
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals>images/</KeyPrefixEquals>
</Condition>
<Redirect>
<ReplaceKeyWith>index.html</ReplaceKeyWith>
</Redirect>
</RoutingRule>
</RoutingRules>
imagesにマッチしたら、
index.htmlにリダイレクト
37
© 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. S3-Glacier連携機能
S3に格納されたファイルを自動的にGlacierに退避
AWSで安価な階層化ストレージを実現
• ルールベースで一定期間が経過したS3上のファイルを自動的に
Glacierに退避
• インデックス情報はS3で管理
• 簡単な画面操作でGlacierに退避されたファイルをS3上に取出し可
能 (3-5時間)
• Glacierに退避されると格納コストが1/10に
メタデータ
Upload Bucket 自動
(ルール設定) Archive
38
© 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. ルートドメイン設定
S3のWebサイトでもWWW等のホスト名
なしルートドメインが利用可能に
• S3+Route53で利用可能
39
© 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. S3を上手に使うには?
40
© 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. Amazon S3のパフォーマンスをあげるコツ
© 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. Amazon S3をうまく使うコツ
(パフォーマンス)
大前提:ほとんどのケースでは普通に使っても
らえばいいだけ。
大量にオブジェクトを保存したり、取得したり
する場合のみコツが必要
• キー名はとても大事。キー名の先頭を散らす
• 先頭2、3をハッシュ値にするだけで十分スケールする
• Amazon S3のパーティション分割
• 当然バケットが違えば更にスケール
42
© 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. Amazon S3をうまく使うコツ
秒間数百以上のPUTをする場合には、エラー
コードに注意
• 503が返ってきたらクライアント側でも送信側で
も少し軽減する(エクスポネンシャルバックオフ)
43
© 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 S3のよくある利用例
コンテンツの保存と配信
• メディア・エンターテイメントのコンテンツ
• ソフトウェアの配信
大規模データ分析のストレージ・データオリジナル
• オンラインストレージ
• アプリケーションそのもののストレージ
バックアップやディザスタリカバリ。低価格かつ安心の
テープの代替
• サーバのバックアップ
• 個人的なバックアップ
• 複数端末での共有
44
© 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. AWSの各サービス自体もユーザ
AWSサービスの中心にS3がある
EC2
EBS
…
…
S3
…
EMR
Dyna …
mo
DB
45
© 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. Amazon S3のサードパーティツール例
様々なサードパーティツールが存在する
• CloudBerry
• TNT Drive
• s3cmd
• s3fs
用法を守って正しくお使いください
46
© 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. Amazon S3を通じて実現したいこと
お客様がデータを安心して預けられる、
サービスの提供
• Amazon S3上のデータは常に安全に保管
• Amazon S3内データはいつでも取得可能
• Amazon S3内データを常に保存可能
• Amazon S3内へのデータアクセスは完璧
にコントロールできる
• データ保存が低価格で実現できる
47
© 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. 参考文献
Amazon S3
• http://aws.amazon.com/jp/s3/
Amazon S3 Getting Started Guide
• http://docs.amazonwebservices.com/AmazonS3/latest/gs
g/
Amazon S3 Developer Guide
• http://docs.amazonwebservices.com/AmazonS3/latest/de
v/
Amazon Web Services Japan blog
• http://aws.typepad.com/aws_japan/
48
© 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. 49
© 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.