More Related Content
Similar to [AWSマイスターシリーズ] Amazon CloudFront / Amazon Elastic Transcoderによるコンテンツ配信
Similar to [AWSマイスターシリーズ] Amazon CloudFront / Amazon Elastic Transcoderによるコンテンツ配信 (20)
More from Amazon Web Services Japan
More from Amazon Web Services Japan (20)
[AWSマイスターシリーズ] Amazon CloudFront / Amazon Elastic Transcoderによるコンテンツ配信
- 1. re:Generate
AWSマイスターシリーズ
re:Generate
Amazon CloudFront /
Amazon Elastic Transcoderによる
コンテンツ配信
2014.10.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.
- 2. Agenda
! Amazon CloudFrontとは
! CloudFrontの機能
! Amazon Elastic Transcoderとは
! Elastic Transcoderの機能
! 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. Amazon CloudFrontとは
© 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. Contents Distribution Network
! ユーザからのアクセスを、最も近いエッジサーバに誘導
することで、ユーザへの配信を⾼高速化
! エッジサーバでは、コンテンツのキャッシングを⾏行行い、
オリジンに負荷をかけず効率率率的に配信
1.最適なエッジに
リクエスト
3.エッジにキャッシュがなければ
オリジンにリクエスト
Amazon
CloudFront
(Edge Location)
レスポンス向上負荷軽減
キャッシュ
コンテンツ
4.エッジにコンテンツ
を送信
2.キャッシュを配信
クライアント
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.
- 5. Amazon CloudFrontの動作
! 最適なエッジへの誘導
DNSサーバ
① CFの名前解決
xxx.cloudfront.net
クライアント
CloudFront
Edge
② IPアドレス問合せ
③ 最適なEdgeアドレス
④ 最適なEdgeに
cloudfront.net DNS
CloudFront DNS
CloudFront
Edge
の応答
アクセス
地理理情報
オリジン配信
サーバ
⑤ キャッシュが無ければ
オリジンから取得
© 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. 現時点のエッジロケーション
Europe
Amsterdam,
Netherlands(2)
Dublin,
Ireland
Frankfurt,
Germany
(3)
London,
England
(3)
Madrid,
Spain
Milan,
Italia
Paris,
France
(2)
Stockholm,
Sweden
Asia
Chennai,
India
Hong
Kong,
China(2)
Mumbai,
India
Osaka,
Japan
Singapore
(2)
Seoul,
Korea
Sydney,
Australia
Tokyo,
Japan(2)
South
America
Sao
Paulo,
Brazil
North
America
Atlanta,
GA
Ashburn,
VA
(3)
Dallas,
TX
(2)
Hayward,
CA
Jacksonville,
FL
Los
Angeles,
CA(2)
Miami,
FL
New
York,
NY
(3)
Newark,
NJ
Palo
Alto,
CA
San
Jose,
CA
Seattle,
WA
South
Bend,
IN
St.
Louis,
MO
2013年年11⽉月時点
© 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. Amazon CloudFrontの特徴
! CDNインフラとしてのAmazon CloudFront
⾼高性能な分散配信
(世界46拠点のエッジサーバ)※2013年年11⽉月現在
⾼高いパフォーマンス
(業界トップクラスのパフォーマンス測定結果)
キャパシティプランからの解放
(予測不不可能なスパイクアクセスもCloudFrontがカバー)
完全重量量課⾦金金
(初期費⽤用がなく安価かつスポットも利利⽤用可能)
設定が容易易で即時利利⽤用可能
(GUIからの設定で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.
- 8. Amazon CloudFrontの機能
© 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. CloudFront Distribution
! Distributionの作成
• Management Consoleで作成し、すぐに利利⽤用開始可能
• DownloadもしくはStreamingを選択
• 1アカウントで作成できるDistribution数は100個
• 使⽤用量量が最⼤大1Gbpsまたは1,000RPSを超える場合は上限緩和
申請が必要
• Price Classを利利⽤用してコストの低い地域エッジからの配信制御
! CNAMEエイリアスの指定による独⾃自ドメインの利利⽤用
• デフォルトでは「xxx.cloudfront.net」が指定される
• 1つのディストリビューションで最⼤大25個まで設定可能
• ワイルドカード指定もサポート
(リクエストされるFQDNと設定しているCNAMEが⼀一致しないとエラーを返すので注意)
© 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. HTTP/HTTPSリクエスト対応
! サポートHTTPメソッド/プロトコル
GET, HEAD
POST, PUT, DELETE, OPTION, PATCH
• GET, HEADはエッジにコンテンツがキャッシュされる
• GET, HEAD以外は、エッジがProxyとして動作し、毎回オリジンに
リクエストが送信される
(GET, HEAD以外はエッジからオリジンへのリクエストデータ転送量量が課⾦金金されるので注意)
• HTTP/HTTPSをサポート
! オリジンへのリクエスト
• オリジンはInternet経由でアクセスできることが必要
• Range GET対応
• User-‐‑‒Agentは“Amazon CloudFront”に⼊入れ替わる
© 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. キャッシュコントロール
! キャッシュ有無/期間設定
• オリジン側のHTTPヘッダーでキャッシュコントロールの指定
• CloudFront側で設定したMinimum TTLとの組み合わせで動作が変わる
CloudFront Minimum TTL設定
Minimum TTL = 0
(デフォルト)Minimum TTL 0を設定
オリジンHTTPヘッダー
Cache-‐‑‒Control max-‐‑‒age
を指定
指定されたmax-‐‑‒age期間
キャッシュ
指定されたmax-‐‑‒ageもしくはMinimum TTL
の⻑⾧長い⽅方の期間キャッシュ
Cache-‐‑‒Control設定なし24時間キャッシュ24時間もしくはMinimum TTLの
⻑⾧長い⽅方の期間キャッシュ
Cache-‐‑‒Control max-‐‑‒age
とs-‐‑‒maxageを指定
指定されたs-‐‑‒maxage期間エッジ
にキャッシュされ、max-‐‑‒age期間
ブラウザーにキャッシュ
指定されたs-‐‑‒maxageもしくはMinimum TTL
の⻑⾧長い⽅方の期間エッジにキャッシュされ、
max-‐‑‒age期間ブラウザーにキャッシュ
Expiresを指定Expiresで指定された⽇日付まで
キャッシュ
Expiresで指定された⽇日付とMinimum TTLの
期間を加算した期間キャッシュ
Cache-‐‑‒Control no-‐‑‒
cache, no-‐‑‒storeを指定キャッシュされないMinimum TTLの期間キャッシュ
• HTML MetaタグのHTTP Cache-‐‑‒ControlもしくはProgmaが指定されていてもCloudFrontの
キャッシュコントロールでは利利⽤用されない
• オリジンがS3の場合はMetadataにHTTPヘッダーを指定
© 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. キャッシュコントロール
! キャッシュコンテンツ
• 単⼀一ファイルの最⼤大サイズは20GBまで
! Cookieのキャッシュ(オプション)
• すべてもしくはWhitelist(特定のCookie)のキャッシュを選択可能
! Query Stringsのキャッシュ(オプション)
• 有効の場合、Query Strings部分も含めてオリジンへリクエストし、
その結果をキャシュする
(キャッシュはQuery Stringsの⼤大⽂文字⼩小⽂文字を判定するため注意)
• 無効の場合、CloudFrontにてQuery Strings部分を除去しオリジン
にリクエストしキャッシュする
© 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. キャッシュコントロール
! キャッシュのInvalidation(無効化)
• 無効化するコンテンツ個々のファイルパスを指定
• 同時に3つのInvalidation要求を実⾏行行可能
• 1回のInvalidation要求で最⼤大1,000のオブジェクトを指定可能
• Management ConsoleもしくはAPIで実装可能
Management ConsoleのInvalidation画⾯面
© 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. SSL証明書対応
! デフォルト証明書
• cloudfront.netドメインのSSL証明書は標準で利利⽤用可能
! 持ち込み可能な独⾃自SSL証明書
• X.509 PEM形式かつ認証チェーンが含まれていること
• サポートするSSL証明書の鍵⻑⾧長は最⼤大2048bit
• 様々な証明書タイプをサポート
• Domain Validated 証明書
• Extend Validated 証明書
• Wildcard 証明書
• Subject Alternative Name証明書 など
© 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. 独⾃自SSL証明書の利利⽤用
! 利利⽤用申請
• デフォルトでは証明書を1つしか登録できない
• 2つ以上利利⽤用される場合は申請が必要
cloudfront-‐‑‒ssl-‐‑‒request@amazon.comにメールをお願いします。
! 利利⽤用⽅方法
1. 証明書機関の署名を受けた証明書をIAM CLIを利利⽤用してアップロード
2. CloudFrontのDistribution作成画⾯面でアップロードした証明書を選択
(Distributionに対して1つ指定)
3. 証明書と同じCNAMEを指定
4. 指定したCNAMEとDistribution作成後に⽣生成されるDomain名を紐紐付
けるレコードをDNSに登録
© 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. 独⾃自SSL証明書の利利⽤用
! IAM CLIによる証明書のアップロード
証明書のアップロード
# iam-‐‑‒servercertupload –s [AWS上での証明書名] –k [秘密鍵] –c [中間証明書] –b [SSL証明書] -‐‑‒p /cloudfront”
アップロードした証明書の削除
# iam-‐‑‒servercertdel –s [削除するAWS上での証明書名]
! CloudFront Distribution作成画⾯面での設定
CNAMEの指定
Uploadした証明書を選択
! CloudFront DistributionのDomain名
DistributionのDomain名
© 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. マルチオリジン
! マルチオリジン機能
• BehaviorsのPath Pattern(正規表現)を利利
⽤用したオリジンの振り分け
• オリジンはDistribution毎に25個まで登録
可能
• 振り分けルール(Behaviors)もDistribution
毎に10個まで登録可能
• Behavior毎にキャッシュポリシーや
オリジンへのアクセスルール指定が可能
http://www.mydomain.com/
Amazon
CloudFront
マルチオリジン
/image//site1//site2/
静的コンテンツ動的コンテンツ
オンプレ
Webサーバ
EC2
Webサーバ
S3
Web Hosting
Behaviors Path Patternの記述方法
• 「*」 0もしくはそれ以上の文字列
• 「?」 1文字
例) /*.jpg, /image/*, /image/a*.jpg, /a??.jpg
© 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. カスタムエラーページ
! カスタムエラーページ設定
• オリジンからのエラーコードに対して、CloudFront側で指定した任意
のエラーページを返すことが可能なうえ、エラーのキャッシュ時間も
指定可能
! 利利点
• サーバエラーの詳細をクライアントに通知
することなく任意のSorry Pageを返すこと
が可能
• エラーのキャッシュ時間が指定可能
• 障害中オリジンへの無駄なアクセスを回避
• ⼀一時的なものであれば即時復復旧
• エラーコードごとにページやキャッシュ
時間を個別に指定可能
CFが対応するStatus Code
HTTP Status
Code Information
Client
Error
400 Bad Request
403 Forbidden
404 Not Found
405 Method Not Allowed
414 Request-URI Too Long
Server
Error
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway TImeout
© 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. カスタムエラーページ
! 設定のポイント
• エラーステータスコードごとに設定
が必要
• Error Caching Minimum TTLは
オリジンへ再取得要求するまでの期間
(エラーページ⾃自体のキャッシュ期間ではない)
• Customize Error Responseを指定し
ないと、Error Caching Minimum TTLのみが有効
• Response Pathはドメインからの指定ができないため、S3など別サー
バ上のページを指定したい場合は、マルチオリジン設定とPath
Patternの組み合わせで振り先サーバを変える
• HTTP Response Codeで応答ページのステータスコードを変えられる
(200 OKにも可能)
© 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. カスタムエラーページ
! エラーページを別のオリジンから取得するための設定
Error Page設定画⾯面
Behaviors設定画⾯面
Origin設定画⾯面
紐紐づけ
© 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. カスタムエラーページ
! S3と組み合わせた構成例例Webサーバ側で
4XXエラー時の
5XXのカスタムエラーページ設定
ページをS3に設定
(4XXはオプション)
5XX発⽣生時
(4XX発⽣生時)
4XX発⽣生時
CloudFront
オリジン Custom
S3
Error Page
Custom
Error Page
Custom
Error Page
クライアント
• 4XX系はCF側ですべてをハンドリングしていない上、クライアント
要求のエラーのため、オリジン側で対応
5XX系はオリジン側のエラーのため、CF側で対応
© 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. ストリーミング配信
! CloudFrontを活⽤用したストリーミング配信
• 配信規模に応じて多くのネットワーク帯域が必要となるストリー
ミングを効率率率的に配信可能
• ⼩小規模から⼤大規模配信まで柔軟に対応
• 対応可能な配信⽅方式
1. S3と組み合わせたオンデマンドストリーミング配信
2. HTTPベースのストリーミング配信(オンデマンド・ライブ)
配信先デバイスに合わせて配信⽅方式の選択が重要
© 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. ストリーミング配信
! S3と組み合わせたオンデマンドストリーミング配信
• Distribution作成時にStreamingを指定
• CloudFrontにセットアップされているFlash Media Server(FMS)
を利利⽤用したオンデマンドストリーミング配信が可能
• RTMP, RTMPE, RTMPT, RTMPTEプロトコルをサポート
• CloudFront上のclossdomain.xmlはすべてのドメインからのアクセス
を許可
• ストリーミング配信のためクライアント側に映像ファイルが残らない
• コンテンツはS3に格納されていることが条件
CloudFrontS3
PlayerからのリクエストURL
rtmp://xxx.cloudfront.net/cfx/st/XXXX.flv
クライアント
RTMP
Flash Player
© 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. ストリーミング配信
! HTTPベースのストリーミング
• HTTP Live Streaming(HLS), HTTP Dynamic
Streaming(HDS), IIS Smooth Streaming、Progressive
Downloadなどの配信⽅方式
• Distribution作成時にDownloadを指定
• オンデマンド、ライブ双⽅方で利利⽤用可能
• ⾃自前でオリジンのストリーミングサーバを構築する場合が多い
マルチデバイスへの配信が可能
CloudFront
S3
クライアント
HTTP
EC2
HTTP
© 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. ストリーミング配信
! HTTPベースのストリーミング
• Adobe Media Service(AMS), IIS Media Serviceおよび
Wowza⽤用のCloudFormationライブ配信環境テンプレートを提
供
CloudFrontとAMSを利用したHTTPライブ配信
• http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/
LiveStreamingAdobeMediaServer5.0.html
CloudFrontとIIS Media Serviceを利用したライブ Smooth Streaming配信
• http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/
IISLiveSmoothStreaming4.1.html
CloudFrontとWowzaを利用したHTTPライブ配信
• http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/live-streaming-wowza.
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.
- 26. プライベートコンテンツ配信
! 署名付きURLを利利⽤用した配信コンテンツの保護
• 標準 (Canned Policy)
• オプション (Custom Policy)
• 有効期間(時刻を秒単位指定)
• 有効コンテンツパス
① アクセス
• アクセス元IPアドレス制限
• 有効開始時刻指定
• 許可コンテンツのワイルドカード指定
ユーザ認証
ユーザ認証
システム
③ CloudFront URL応答
② CloudFront
署名付きURL⽣生成
認証確認
④ アクセス
⑤ 有効時のみ応答
S3
EC2
その他
Webサーバ
コンテンツ
保護
Amazon CloudFront
クライアント
© 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. プライベートコンテンツ配信
! 署名付きURL
• DownloadおよびStreaming双⽅方に対応
• Downloadの場合は有効期限を最⼩小化することを推奨
– TCPコネクションが確⽴立立中は対象コンテンツのダウンロードが可能
• Streamingの場合は動画の再⽣生時間以上有効期限の設定が必要
• S3と連携することでよりセキュアに配信可能
• Origin Access Identityを利利⽤用し、S3 Bucketへのアクセスを
CloudFrontに制限
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-‐‑‒content-‐‑‒restricting-‐‑‒
access-‐‑‒to-‐‑‒s3.html
• カスタムオリジンを利利⽤用する場合は、オリジン側のURLを外部に公開
しない、またIPアドレスをもとにCloudFrontからのアクセスに制限
© 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. プライベートコンテンツ配信
! 署名付きURLの⽣生成
• 署名⽤用Key Pairの取得 (⾃自前の鍵を登録することも可能)
Management Consoleの「Security Credential」ページで作成し、Private Keyをダウンロード
• CloudFront Distribution作成時にSigned URLを有効化
Trusted Signersを有効にした場合、AWSアカウントIDを指定することで、別のAWSアカウント
のCloudFront Key Pairを利用することも可能
© 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. プライベートコンテンツ配信
! 署名付きURL
• 標準(Canned Policy)
⽣生成するURLパターン
http://xxxx.cloudfront.net/contents/file.jpg?Expires=XXXSignature=XXXKey-‐‑‒Pair-‐‑‒Id=XXX
rtmp://xxxx.cloudfront.net/cfx/st/video/file.mp4?Expires=XXXSignature=XXXKey-‐‑‒Pair-‐‑‒Id=XXX
パラメータ説明
ベースURL許可するコンテンツURLを設定
(Download例例: http://xxx.cloudfront.net/contents/file.jpg)
(Streaming例例: video/file.mp4)
ExpiresUnix TimeでURLを有効化する終了了⽇日時(秒まで)を指定 (例例: 2013/1/1 10:00AM(UTC) → 1357034400)
SignaturePrivate Keyで署名したポリシー(ポリシーはJSONフォーマットで記述)
JSONフォーマットポリシー
{“Statement”:[{
“Resource”:”ベースURL”,
”Condition”:{“DateLessThan”:{“AWS:EpochTime”:”Expiresと同じ値”}}
}]}
ポリシーをPrivate Keyを利利⽤用して暗号化後、Base64エンコードおよび「+=/」⽂文字列列を置換
(http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-‐‑‒content-‐‑‒linux-‐‑‒
openssl.html)
Key-‐‑‒Pair-‐‑‒Id利利⽤用するCloudFrontのKey Pair IDを設定
任意のQuery Stringsも利利⽤用可能だが、Expires, Signature, Key-‐‑‒Pair-‐‑‒Idは予約されているため利利⽤用不不可
© 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. プライベートコンテンツ配信
! 署名付きURL
• Custom Policy(開始時間およびIPアドレスはオプション)
⽣生成するURLパターン
http://xxxx.cloudfront.net/contents/file.jpg?Policy=XXXSignature=XXXKey-‐‑‒Pair-‐‑‒Id=XXX
rtmp://xxxx.cloudfront.net/cfx/st/video/file.mp4?Policy=XXXSignature=XXXKey-‐‑‒Pair-‐‑‒Id=XXX
パラメータ説明
ベースURL許可するコンテンツURLを設定 (ワイルドカード指定した場合は、ベールURL内のコンテンツ全てに適⽤用)
(Download例例: http://xxx.cloudfront.net/contents/*)
(Streaming例例: video/*)
PolicyJSONフォーマットポリシー
{“Statement”:[{
“Resource”:”ベースURL”,
”Condition”:{
“DateLessThan”:{“AWS:EpochTime”:”Unix TimeでURLを有効化する終了了⽇日時(秒まで)”},
“DateGreaterThan”:{“AWS:EpochTime”:”Unix TimeでURLの有効化を開始する⽇日時(秒まで)”},
“IpAddress”:{“AWS:SourceIp”:”許可すソースるIPアドレス“}
}}]}
ポリシーをBase64エンコードおよび「+=/」⽂文字列列を置換
SignaturePrivate Keyで署名したポリシー
ポリシーをPrivate Keyを利利⽤用して暗号化後、Base64エンコードおよび「+=/」⽂文字列列を置換
(http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-‐‑‒content-‐‑‒linux-‐‑‒
openssl.html)
Key-‐‑‒Pair-‐‑‒Id利利⽤用するCloudFrontのKey Pair IDを設定
© 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. プライベートコンテンツ配信
! 署名付きURLサンプルソースコード
• Perl
http://docs.aws.amazon.com/ja_̲jp/AmazonCloudFront/latest/DeveloperGuide/
CreateURLPerl.html
• PHP
http://docs.aws.amazon.com/ja_̲jp/AmazonCloudFront/latest/DeveloperGuide/
CreateURL_̲PHP.html
• C#および.NET Framework
http://docs.aws.amazon.com/ja_̲jp/AmazonCloudFront/latest/DeveloperGuide/
CreateSignatureInCSharp.html
• Java
http://docs.aws.amazon.com/ja_̲jp/AmazonCloudFront/latest/DeveloperGuide/
CFPrivateDistJavaDevelopment.html
• その他ツール
http://docs.aws.amazon.com/ja_̲jp/AmazonCloudFront/latest/DeveloperGuide/
WhereGoFromHere.html#DistributingPrivateContent
© 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. ロギング
! CloudFrontアクセスログ
• 任意のS3 Bucketに出⼒力力可能
• 出⼒力力先Bucketのアクセス権設定に注意
• アクセスログの出⼒力力はタイムラグあり
S3 Bucketを指定
Bucket下のフォルダを指定可能
アクセスログフォーマット
項目 説明
date アクセス日(UTC)
time アクセス時間(UTC)
x-edge-location エッジロケーションID
sc-bytes 配信Byte数(ヘッダー含む)
c-ip クライアントIPアドレス
cs-method HTTPアクセスMethod
cs-uri-stem リクエストURI
sc-status レスポンスコード
cs(Referer) リファラ
cs(User-Agent) クライアントユーザエージェント
項目 説明
cs-uri-query リクエストQuery Strings
cs(Cookie) リクエストCookieヘッダー
x-edge-result-type Hit:キャッシュヒット
RefreshHit:キャッシュがExpireされていた
Miss:キャッシュミス
LimitExceeded: CloudFrontのリミットオーバ
CapacityExceeeded: エッジのキャパシティ不足
Error:クライアントもしくはオリジンによるエラー
x-edge-request-id CloudFrontのリクエストID
x-host-header リクエストHost Header
cs-protocol リクエストプロトコル(http / https)
cs-bytes リクエストByte数(ヘッダー含む)
© 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. CloudFront TIPS
! キャッシュコントロール
• キャッシュへのオフロード率率率をあげることが重要
• 静的ページ、画像、ファイルに関しては可能な限りキャッシュさせ
るとともに、キャッシュ期間も⻑⾧長くする
• オリジン側でのコンテンツ更更新時は、ファイル名やQueryStringを
変えるなどの⼯工夫により、効率率率的にキャッシュの差し替えを⾏行行う
– 頻繁なキャッシュの無効化処理理は⾮非効率率率
! ストリーミング配信
• HTTPベースのストリーミングを活⽤用することで、効率率率的にマル
チデバイス配信を実現
• オリジンの台数を削減することで、運⽤用も含めたコスト削減が可能
© 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. Amazon Elastic Transcoderとは
© 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. トランスコード
! ⾼高いスケーラビリティ、使いやすさ、経済性を実現し、
様々なデバイスに対応した動画ファイルをトランスコー
ドできるフルマネージドサービス
! トランスコード
• デジタル化された映像を別のフォーマット、解像度度などに変換する技術
• スマートフォン向けに動画ファイルの画⾯面サイズ、解像度度を変換するな
ど、再⽣生デバイスに合わせたコンテンツの変換を⾏行行う
© 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. Amazon Elastic Transcoderの特徴
低コスト
(ライセンスなし/初期費⽤用不不要の完全従量量課⾦金金)
フルマネージド
(トランスコーダーSW/ストレージ管理理不不要)
スケーラブル
(トランスコードの並列列処理理)
シンプル
(簡単に利利⽤用できるGUI/APIによるプログラム連携)
⼿手間のかかるトランスコードインフラリソースを
フルマネージドで提供
© 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. Amazon Elastic Transcoderの特徴
デジタルコンテンツ
のアップロード
Amazon S3
(Input Bucket)
デジタルコンテンツの
ダウンロード/配信
Amazon S3
(Output Bucket)
AWS SDK/
API
Management
Console
オペレーション/管理理
Amazon Elastic Transcoder
処理理結果通知Amazon SNS
© 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. Amazon Elastic Transcoderの特徴
! 変換処理理
• ファイルベーストランスコーダー
• 映像・⾳音声
• マルチフォーマットへの同時変換
• HLS(HTTP Live Streaming)でのAdaptive Bitrate Streaming
! オプション機能
• 時間指定によるクリップ作成
• サムネイル⽣生成
• Watermark差し込み
! 管理理機能
• IAMによるアクセス管理理
• AmazonS3をINPUT/OUTPUTコンテンツストレージとして利利⽤用
• 低冗⻑⾧長化ストレージも選択可能
• Amazon SNSと連携した処理理結果通知
© 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. サポートフォーマット
! 変換元ファイル
• 変換元ファイル
• ⼀一般的なウェブ、コンシューマ、プロフェッショナルのメディア
フォーマットをサポート
(例例:3GP, AAC, AVI, FLV, MP4, MPEG-‐‑‒2 など)
! 変換先ファイル
• Video codec : H.264, vp8
• Audio codec : AAC, vorbis, mp3
• Container : mp4, MPEG-‐‑‒TS, webm, mp3, Ogg
© 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. Amazon Elastic Transcoderの機能
© 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. アーキテクチャ
! Pipeline
• トランスコードJobの実⾏行行キューを管理理
• Pipelineを分けることで処理理の並列列化が可能
• 実⾏行行中Jobの検索索およびステータス確認が可能
! Job
• 各コンテンツの変換処理理を管理理
• Presetと組み合わせPipelineに
投⼊入される
! Preset
• 変換パラメータ定義の管理理
• カスタムPresetの作成も可能
© 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. Pipeline
! Pipelineの作成
• デフォルトで4つまで作成可能
• ファイルの取得元と出⼒力力先S3 Bucketの
指定
• サムネイルの出⼒力力先S3 Bucketの指定
• 出⼒力力先オブジェクトはStorage Classを
指定可能(Standard/RRS)
• 出⼒力力オブジェクトのパーミッションも
指定可能
• SNS Topicを利利⽤用したNotificationの指定
• 実⾏行行イベント
• ワーニング
• 完了了
• エラー
Management ConsoleのPipeline設定画⾯面
© 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. Job
! 映像変換Jobの作成
• Pipelineを選択
• INPUTファイルの選択
• OUTPUTフォルダ(Prefix)とファイル名の
指定(拡張⼦子も含める)
• Presetの選択(映像変換Presetを選択)
• 「Add Another Output」で別のフォー
マットにも同時出⼒力力
• 1Jobで最⼤大30個まで
• オプション
• サムネイル出⼒力力ファイル名の指定
• クリップ作成開始点およびDurationを指定
• Watermark画像の選択および差し込み位置
の指定
Management ConsoleのJob登録画⾯面
© 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. Job
! 映像変換Jobの作成(HLS)
• 標準パラメータは通常の映像変換同様
! 固有パラメータ
• セグメントファイルのDuration
• Adaptive Bitrateを⾏行行う場合
1. 異異なるBitrateでOutput Detailsを準備
2. Playlistで準備したOutputを選択
Management ConsoleのJob登録画⾯面
(HLS固有パラメータ)
HLSの映像ファイル構造
Master Playlist(マニフェストファイルm3u8)
Playlist(m3u8): 例例1Mpsにトランスコードした映像
セグメントファイル01(ts): 分割された1Mbpsの映像ファイル
セグメントファイル02(ts): 分割された1Mbpsの映像ファイル
:
Playlist(m3u8): 例例512kpsにトランスコードした映像
セグメントファイル01(ts): 分割された512kbpsの映像ファイル
セグメントファイル02(ts): 分割された512kbpsの映像ファイル
:
© 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. Job
! ⾳音声変換Jobの作成
• Pipelineを選択
• INPUTファイルの選択
• OUTPUTフォルダ(Prefix)とファイル名の
指定(拡張⼦子も含める)
• Presetの選択(⾳音声変換Presetを選択)
• 「Add Another Output」で別のフォー
マットにも同時出⼒力力
• 1Jobで最⼤大30個まで
• オプション
• Album Artの指定
– Replace:指定したファイルに差し替え
– Prepend:先頭に指定ファイルを差し込み
– Append:⼀一番後ろに指定ファイルを差し込み
– Fallback:元⾳音声ファイルの中にすでに設定され
Management ConsoleのJob登録画⾯面
(Audio)
ていれば変更更しない。設定されていな
ければ指定ファイルを差し込み
© 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. Preset
! カスタムPresetの作成
• デフォルトのプリセットをベースに作成
• デフォルトプリセットを除き50個まで登録
可能
• Video
• コンテナ、コーデック、ビットレート、解像
度度、FrameRate、Watermarksなどを定義
• Audio
• コンテナ、コーデック、Sample Rate、ビッ
トレート、チャンネルなどを定義
• Thumbnails
• ファイルフォーマット、取得インターバル、
画⾯面サイズなどを定義
Management ConsoleのPreset作成画⾯面
© 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. Elastic Transcoder TIPS
! トランスコーディング環境の実装
• PipelineおよびPresetに関してはManagement Consoleで準備
• コンテンツ格納先のS3とElastic Transcoderのリージョンは合
わせることを推奨
• Jobの実⾏行行部分のみをAPI / SDK / CLIで実装し⾃自動化を実現
• 変換元コンテンツは、S3のLifeCycleポリシーを利利⽤用して削除も
しくはGlaceirに退避
• 低冗⻑⾧長化ストレージを活⽤用してストレージコストの削減
サポートSDK / CLI
Java PHP .NET Python nodeJS CLI
© 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. Elastic Transcoderの利利⽤用
! サンプルソースコード(Java)
• 映像変換Jobの実⾏行行
Java
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider;
import com.amazonaws.services.elastictranscoder.*;
import com.amazonaws.services.elastictranscoder.model.*;
public class createEtsJob {
static AmazonElasticTranscoder transCode;
public static void main (String[] args) throws Exception {
AWSCredentials credentials = new ClasspathPropertiesFileCredentialsProvider().getCredentials();
transCode = new AmazonElasticTranscoderClient(credentials);
transCode.setEndpoint(https://elastictranscoder.ap-northeast-1.amazonaws.com);
JobInput jobinput = new JobInput()
.withKey(“ORIGINAL.mpeg”)
.withAspectRatio(auto)
.withResolution(auto)
.withContainer(auto)
.withInterlaced(auto)
.withFrameRate(auto”);
CreateJobOutput joboutput = new CreateJobOutput()
.withKey(“TRANSCODE.mp4)
.withPresetId(”PresetID)
.withRotate(auto”);
CreateJobRequest req = new CreateJobRequest()
.withPipelineId(”PipelineID)
.withInput(jobinput)
.withOutput(joboutput);
transCode.createJob(req);
}
Elastic Transcoder Endpoint指定
変換元ファイル名指定
(Pipelineの指定Bucket内に存在している必要あり)
変換先ファイル名指定
(Pipelineの指定Bucketに出力される)
Presetの指定
Job投入Pipelineの指定
© 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. 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.
- 50. Amazon CloudFront活⽤用パターン
! Webサイト⾼高速化
クライアントクライアント
ページ全体を簡単
• POST対応により簡易易的
Amazon
CloudFront
な動的ページは
CloudFront経由で配信
Webサーバー
に⾼高速化
静的ページ中⼼心
Webサイト
Webサーバー
ページの⼤大半を占める
静的ファイルを⾼高速配信
Amazon
CloudFront
• 静的ファイルのパスを
• Webサーバの機能(mod_̲rewrite
動的ページ中⼼心
Webサイト
CloudFront経由に変更更
など)で静的ファイルのパスを
CloudFront経由に強制書換え
© 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. Amazon CloudFront活⽤用パターン
! Webサイト⾼高速化
⾼高速化とスケーラ
ビリティの確保
or
クライアント
動的ページ⽣生成
Amazon
CloudFront
Webサーバー画像配信サーバーAmazon S3
動的ページ中⼼心に
• S3と連携することで、
⼤大量量の静的コンテンツを扱う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.
- 52. Amazon CloudFront活⽤用パターン
! 動画配信(オンデマンド配信)
クライアント
配信プラットフォーム
(コンテンツがクライア
ント側に残らない)
Amazon
CloudFront
(Streaming)
Amazon S3
フルマネージド
RTMP
オンデマンド動画の
ストリーミング配信
クライアント
配信プラットフォーム
Progressive DL / HLS
(コンテンツがクライアント
Amazon
CloudFront
(Download)
Amazon S3
フルマネージド
オンデマンド動画の
HTTP配信
側に残る)
© 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. Amazon CloudFront活⽤用パターン
! 動画配信(オンデマンド配信/ライブ配信)
HLS/HDS/
クライアントIIS Smoothに対応
Template
AWS
Cloud
Forma2on
LIVE
⼤大規模配信をスポット
Amazon
CloudFront
(Download)
Amazon EC2
利利⽤用で可能
ライブ動画の
Internet
HTTPストリーミング配信
LiveEncoder
クライアントHLS/HDS/
マルチデバイスに対応
IIS Smoothに対応
Amazon
CloudFront
(Download)
Amazon EC2
した⼤大規模配信
オンデマンド動画の
HTTPストリーミング配信
© 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. CloudFrontとElastic Transcoderの連携
! AWSによるAll-‐‑‒in-‐‑‒One配信プラットフォーム
マルチデバイスへの配信
アップロードStreaming配信
Input
Bucket
アーカイブ
Output
Bucket
配信ストレージ
アップロード
ストレージ
トランスコード
マスタコンテンツの
⾃自動アーカイブ
フルマネージド配信インフラ
Download配信
© 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. プライシングモデル
© 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. CloudFront プライスモデル
①データ転送アウト
②リクエスト
③独⾃自SSL証明書
⑥無効リクエスト
Amazon CloudFront
④オリジンへのデータ転送アウト
⑤データ転送アウト
オンプレ EC2 S3
ラリアインド予約容量量
⾹香港、韓国、
シンガポール⽇日本南⽶米オースト
の価格
①データ転送アウト(GBあたり)
最初の10TB/⽉月$0.120$0.120$0.190$0.201$0.250$0.190$0.170問い合わせ
次の40TB/⽉月$0.080$0.080$0.140$0.148$0.200$0.140$0.130問い合わせ
次の100TB/⽉月$0.060$0.060$0.120$0.127$0.180$0.120$0.110問い合わせ
次の350TB/⽉月$0.040$0.040$0.100$0.106$0.160$0.100$0.100問い合わせ
次の524TB/⽉月$0.030$0.030$0.080$0.085$0.140$0.095問い合わせ問い合わせ
次の4PB/⽉月$0.025$0.025$0.070$0.075$0.130$0.090問い合わせ問い合わせ
次の5PB/⽉月以上$0.020$0.020$0.060$0.065$0.125$0.085問い合わせ問い合わせ
ラリアインド予約容量量
⾹香港、韓国、
シンガポール⽇日本南⽶米オースト
の価格
②リクエスト(10,000件あたり)
HTTPリクエスト$0.0075$0.0090$0.0090$0.0095$0.0160$0.0090$0.0090問い合わせ
HTTPSリクエスト$0.0100$0.0120$0.0120$0.0130$0.0220$0.0125$0.0120問い合わせ
ラリアインド予約容量量
④オリジンへのデータ転送アウト(GBあたり)
⾹香港、韓国、
シンガポール⽇日本南⽶米オースト
の価格
All Data Transfer$0.020$0.020$0.060$0.065$0.125$0.100$0.160問い合わせ
2013年11月時点の東京リージョン
⽶米国ヨーロッ
パ
⽶米国ヨーロッ
パ
③独⾃自SSL証明書
Distributionに関連付けられた証明書1通につき、⽉月$600
⽶米国ヨーロッ
パ
⑤ CloudFrontへのデータ転送アウト(GBあたり)
別のAWSリージョンまたはAmazon CloudFront、$0.090
⑥無効リクエスト
最初の1,000ファイルまで追加料料⾦金金なし。それ以上はリクエスト毎に$0.005
© 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. Elastic Transcoderプライスモデル
①トランスコード処理理
①トランスコード処理理
②ストレージ格納
複数フォーマットへの同時変換を行った際は、Outputコンテンツ数課金されることに注意
②ストレージ格納
2013年11月時点の東京リージョン
© 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. まとめ
© 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. まとめ
! Amazon CloudFront
Webサイトの⾼高速化とスケーラビリティが簡単に実現
• キャッシュのオフロード率率率の向上が有効活⽤用のキーポイント
• 流流量量ベースの従量量課⾦金金により、⼩小規模から⼤大規模なサイト全て
で活⽤用が可能
• アクセス数などのキャパシティプランからの開放
! Amazon Elastic Transcoder
様々なデバイスに、より簡単に⾼高品質な動画を提供可能
• ⼿手間のかかるインフラ運⽤用からの完全脱却
• 必要なときに必要なだけ低コストで利利⽤用可能
© 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. Appendix
! 参考資料料
• Amazon CloudFront Developer Guide
http://docs.aws.amazon.com/ja_̲jp/AmazonCloudFront/latest/DeveloperGuide/Introduction.html
• Amazon CloudFront FAQ
http://aws.amazon.com/jp/cloudfront/faqs/
• Amazon CloudFront Pricing
http://aws.amazon.com/jp/cloudfront/pricing/
• Amazon Elastic Transcoder Developer Guide
http://docs.aws.amazon.com/elastictranscoder/latest/developerguide/introduction.html
• Amazon Elastic Transcoder FAQ
http://aws.amazon.com/jp/elastictranscoder/faqs/
• Amazon Elastic Transcoder Pricing
http://aws.amazon.com/jp/elastictranscoder/pricing/
© 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.