はじめに
清水です。AWSのリニアチャネルアセンブリとパーソナライズされた広告挿入サービスであるAWS Elemental MediaTailorのAd insertion(広告挿入)機能について、基本的な操作をAWS CLIでやってみました。なお「基本的な操作」については以下ブログエントリで扱ったような、プリロール広告付きVOD動画配信を行うまでの操作を想定しています。
MediaTailor Ad insertionのベースとなる Configuration
リソースに対して、その表示や作成、更新や削除をしていくようなイメージですね。またセッションログ設定に関しても扱います。
MediaTailor Ad insertionのAWS CLIでの操作はaws mediatailor
コマンドを使用することとなりますが、このサブコマンド群がChannel assembly機能と独立しておらず、どちらもaws mediatailor
ではじまります。そのため、Ad insertion用のサブコマンドをきちんと把握することがひとつのポイントかと思います。また、リソースの作成と変更がaws mediatailor put-playback-configuration
の1つのサブコマンドにまとめられている点にも注意しましょう。(てっきりcreate-playback-configuration
とupdate-playback-configuration
のように2種類のサブコマンドがあるかと思っていました。)セッションログ設定については専用のサブコマンドが準備されています。
なお、本エントリでは以下のAWS CLI環境で動作確認を行いました。
% aws --version
aws-cli/2.16.11 Python/3.11.8 Darwin/22.6.0 exe/x86_64
MediaTailor Ad insertion用のサブコマンドの確認
MediaTailro Ad insertionの操作用コマンドを実行する前に、まずはAWS CLIのmediatailor
コマンドのうちAd insertion機能用のサブコマンドを確認しておきましょう。
AWS CLI Command ReferenceのページをみてみるとMediaTailorについてのコマンドは1つだけ、mediatailor
が存在していることが確認できます。(以下、本エントリでは動作検証にAWS CLI version 2を使用したため、参照先についてもversion 2のページをリンクとして掲載します。)
2024/06/20現在44個のサブコマンドがありますが、以下のように(1) Ad insertion機能用サブコマンド、(2) Channel assembly機能用サブコマンド、(3) タグ操作用サブコマンドの3つにわけることができます。それぞれ一覧にしてみました。
Ad insertion機能用サブコマンド
Ad insertion機能用のサブコマンドは以下の9つです。
- configure-logs-for-playback-configuration
- create-prefetch-schedule
- delete-playback-configuration
- delete-prefetch-schedule
- get-playback-configuration
- get-prefetch-schedule
- list-playback-configurations
- list-prefetch-schedules
- put-playback-configuration
Channel Assembly機能用サブコマンド
以下の26個がChannel Assembly機能用のサブコマンドです。
- configure-logs-for-channel
- create-channel
- create-live-source
- create-program
- create-source-location
- create-vod-source
- delete-channel
- delete-channel-policy
- delete-live-source
- delete-program
- delete-source-location
- delete-vod-source
- describe-channel
- describe-live-source
- describe-program
- describe-source-location
- describe-vod-source
- get-channel-policy
- get-channel-schedule
- list-alerts
- list-channels
- list-live-sources
- list-source-locations
- list-vod-sources
- put-channel-policy
- start-channel
- stop-channel
- update-channel
- update-live-source
- update-program
- update-source-location
- update-vod-source
タグ操作用サブコマンド
以下の3つはタグ操作用のサブコマンドです。MediaTailorでタグ付けがサポートされているリソースは、Ad insertionではConfigurations
、Channel assemblyではChannels
、SourceLocations
、VodSources
となっています。(Tagging AWS Elemental MediaTailor resources - AWS Elemental MediaTailor)
Configurationの表示(ListとGet)
aws mediatailor
コマンドの機能ごとのサブコマンドについて整理ができたところで、実際にAd insertion機能用のサブコマンドを確認していきましょう。まずはリソースの参照系のサブコマンドです。aws mediatailor list-playback-configurations
サブコマンド、ならびにaws mediatailor get-playback-configuration
サブコマンドを使用します。
- list-playback-configurations — AWS CLI 2.16.11 Command Reference
- get-playback-configuration — AWS CLI 2.16.11 Command Reference
一覧表示のlist-playback-configurations
aws mediatailor list-playback-configurations
サブコマンドはオプションなしで実行可能です。
% aws mediatailor list-playback-configurations
以下のような実行結果となります。存在しているConfigurationsリソースを一覧表示するかたちですね。
% aws mediatailor list-playback-configurations
{
"Items": [
{
"AdDecisionServerUrl": "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/111111111/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpost&cmsid=496&vid=short_onecue&correlator=[avail.random]",
"AvailSuppression": {
"Mode": "OFF"
},
"Bumper": {},
"CdnConfiguration": {},
"DashConfiguration": {
"ManifestEndpointPrefix": "https://e726xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/dash/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/MyTestCampaign/",
"MpdLocation": "EMT_DEFAULT",
"OriginManifestType": "MULTI_PERIOD"
},
"HlsConfiguration": {
"ManifestEndpointPrefix": "https://e726xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/master/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/MyTestCampaign/"
},
"InsertionMode": "STITCHED_ONLY",
"LivePreRollConfiguration": {},
"ManifestProcessingRules": {
"AdMarkerPassthrough": {
"Enabled": false
}
},
"Name": "MyTestCampaign",
"PlaybackConfigurationArn": "arn:aws:mediatailor:us-west-2:123456789012:playbackConfiguration/MyTestCampaign",
"PlaybackEndpointPrefix": "https://e726xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com",
"SessionInitializationEndpointPrefix": "https://e726xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/session/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/MyTestCampaign/",
"Tags": {},
"VideoContentSourceUrl": "https://ab29xxxxxxxxxxxxxxxxxxxxxxxxxxxx.egress.mediapackage-vod.ap-northeast-1.amazonaws.com/out/v1/edf3xxxxxxxxxxxxxxxxxxxxxxxxxxxx/4efexxxxxxxxxxxxxxxxxxxxxxxxxxxx/abaexxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
{
"AdDecisionServerUrl": "https://ad-decision-xxxxxxxx.s3.ap-northeast-1.amazonaws.com/ads/static-vast-demo.xml",
"AvailSuppression": {
"FillPolicy": "FULL_AVAIL_ONLY",
"Mode": "OFF"
},
"Bumper": {},
"CdnConfiguration": {},
"ConfigurationAliases": {},
"DashConfiguration": {
"ManifestEndpointPrefix": "https://d25cxxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/dash/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-2/",
"MpdLocation": "EMT_DEFAULT",
"OriginManifestType": "MULTI_PERIOD"
},
"HlsConfiguration": {
"ManifestEndpointPrefix": "https://d25cxxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/master/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-2/"
},
"InsertionMode": "STITCHED_ONLY",
"LivePreRollConfiguration": {},
"ManifestProcessingRules": {
"AdMarkerPassthrough": {
"Enabled": false
}
},
"Name": "vod-preroll-2",
"PlaybackConfigurationArn": "arn:aws:mediatailor:us-west-2:123456789012:playbackConfiguration/vod-preroll-2",
"PlaybackEndpointPrefix": "https://d25cxxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com",
"SessionInitializationEndpointPrefix": "https://d25cxxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/session/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-2/",
"Tags": {},
"VideoContentSourceUrl": "https://content-source-xxxxxxxx.s3.ap-northeast-1.amazonaws.com"
}
]
}
ConfigurationのNameのみ一覧表示したいといった場合は、--query "Items[*].Name"
などのオプションをつけましょう。
% aws mediatailor list-playback-configurations \
--query "Items[*].Name"
[
"MyTestCampaign",
"vod-preroll-2"
]
個別表示のget-playback-configuration
aws mediatailor get-playback-configuration
サブコマンドは単一のConfigurationの情報を表示します。--name
オプションでConfigurationのNameを指定します。
% aws mediatailor get-playback-configuration \
--name <value>
出力から得られる情報はlist-playback-configurations
サブコマンドと同等のようです。複数のconfigurationの情報が欲しい場合はlist-playback-configurations
サブコマンド、Configuration Nameがわかっていて単一のConfigurationの情報のみが欲しい場合はget-playback-configuration
サブコマンドと使いわけましょう。
% aws mediatailor get-playback-configuration \
--name vod-preroll-2
{
"AdDecisionServerUrl": "https://ad-decision-xxxxxxxx.s3.ap-northeast-1.amazonaws.com/ads/static-vast-demo.xml",
"AvailSuppression": {
"FillPolicy": "FULL_AVAIL_ONLY",
"Mode": "OFF"
},
"Bumper": {},
"CdnConfiguration": {},
"ConfigurationAliases": {},
"DashConfiguration": {
"ManifestEndpointPrefix": "https://d25cxxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/dash/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-2/",
"MpdLocation": "EMT_DEFAULT",
"OriginManifestType": "MULTI_PERIOD"
},
"HlsConfiguration": {
"ManifestEndpointPrefix": "https://d25cxxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/master/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-2/"
},
"InsertionMode": "STITCHED_ONLY",
"LivePreRollConfiguration": {},
"ManifestProcessingRules": {
"AdMarkerPassthrough": {
"Enabled": false
}
},
"Name": "vod-preroll-2",
"PlaybackConfigurationArn": "arn:aws:mediatailor:us-west-2:123456789012:playbackConfiguration/vod-preroll-2",
"PlaybackEndpointPrefix": "https://d25cxxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com",
"SessionInitializationEndpointPrefix": "https://d25cxxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/session/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-2/",
"Tags": {},
"VideoContentSourceUrl": "https://content-source-xxxxxxxx.s3.ap-northeast-1.amazonaws.com"
}
Configurationの作成(Put)
リソース参照系のコマンドが確認できました。続いてはリソース作成のコマンドです。
存在しないcreate-playback-configuration
リソース作成についてはcreate
ではじまるサブコマンド(API)があるのかな、と思いきやcreate-palyback-configuration
というサブコマンドはありません。Command Referenceのaws mediatailor put-playback-configuration
サブコマンドのページを確認するとわかるのですが、このput-playback-configuration
サブコマンドを使用してconfigurationリソースを作成する(Creates a playback configuration.
)、とのことです。
新規作成はput-playback-configuration
aws mediatailor put-playback-configuration
サブコマンド、Command ReferenceのSynopsisからは--name
オプションのみ必須かなとも思ったのですが、--name
に加えて--ad-decision-server-url
と--video-content-source-url
は必須なようです。マネジメントコンソールでのConfigurationリソース作成時と同じですね。
% aws mediatailor put-playback-configuration \
--name <value> \
--ad-decision-server-url <value> \
--video-content-source-url <value>
以下が実際の実行例です。put-playback-configuration
の実行の前にlist-playback-configurations
で既存のConfigurationリソースを確認しておきます。2つ存在している状態ですね。
% aws mediatailor list-playback-configurations \
--query "Items[*].Name"
[
"MyTestCampaign",
"vod-preroll-2"
]
いざ、put-playback-configuration
を実行して新規にConfigurationリソースを作成します。サブコマンド実行のレスポンスとして作成したConfigurationリソースの情報が返ります。
% aws mediatailor put-playback-configuration \
--name vod-preroll-cli \
--ad-decision-server-url "https://ad-decision-xxxxxxxx.s3.ap-northeast-1.amazonaws.com/ads/static-vast-demo.xml" \
--video-content-source-url "https://content-source-xxxxxxxx.s3.ap-northeast-1.amazonaws.com"
{
"AdDecisionServerUrl": "https://ad-decision-xxxxxxxx.s3.ap-northeast-1.amazonaws.com/ads/static-vast-demo.xml",
"AvailSuppression": {
"Mode": "OFF"
},
"Bumper": {},
"CdnConfiguration": {},
"DashConfiguration": {
"ManifestEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/dash/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/",
"MpdLocation": "EMT_DEFAULT",
"OriginManifestType": "MULTI_PERIOD"
},
"HlsConfiguration": {
"ManifestEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/master/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/"
},
"InsertionMode": "STITCHED_ONLY",
"LivePreRollConfiguration": {},
"ManifestProcessingRules": {
"AdMarkerPassthrough": {
"Enabled": false
}
},
"Name": "vod-preroll-cli",
"PlaybackConfigurationArn": "arn:aws:mediatailor:us-west-2:123456789012:playbackConfiguration/vod-preroll-cli",
"PlaybackEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com",
"SessionInitializationEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/session/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/",
"Tags": {},
"VideoContentSourceUrl": "https://content-source-xxxxxxxx.s3.ap-northeast-1.amazonaws.com"
}
もういちどlist-playback-configurations
でConfigurationの一覧を確認しておきます。3つになっていますね。
% aws mediatailor list-playback-configurations
[
"MyTestCampaign",
"vod-preroll-2",
"vod-preroll-cli"
]
put-playback-configuration
は--name
オプションのほかに--ad-decision-server-url
と--video-content-source-url
も必須である、と先ほど述べました。これらを指定しなかった場合についても確認しておきましょう。
まずは--ad-decision-server-url
を指定しなかった場合です。AdDecisionServerUrl
を指定せよ、とエラーとなっていしまいますね。
% aws mediatailor put-playback-configuration \
--name vod-preroll-cli-no-ads \
--video-content-source-url "https://content-source-xxxxxxxx.s3.ap-northeast-1.amazonaws.com"
An error occurred (BadRequestException) when calling the PutPlaybackConfiguration operation: AdDecisionServerUrl must be provided
続いては--video-content-source-url
を指定しなかった場合です。こちらもエラーとなり、VideoContentSourceUrl
をするようメッセージが返されます。
% aws mediatailor put-playback-configuration \
--name vod-preroll-cli-no-source \
--ad-decision-server-url "https://ad-decision-xxxxxxxx.s3.ap-northeast-1.amazonaws.com/ads/static-vast-demo.xml"
An error occurred (BadRequestException) when calling the PutPlaybackConfiguration operation: VideoContentSourceUrl must be provided
Configurationの更新(Put)
Configurationリソースの作成についてはput-playback-configuration
サブコマンドで実行することが確認できました。Configurationリソースの更新についても、同じくこのput-playback-configuration
サブコマンドで実行します。(更新専用のupdate-playback-configuration
といったサブコマンドはありません。)
注意点として、コマンド実行時には変更したい項目のみをオプションで指定するのではなく、その他の変更対象ではない項目についてもオプションで指定する必要があります。
設定変更もput-playback-configuration
実際に確認してみましょう。先ほどput-playback-configuration
サブコマンドで作成したConfigurationに、CDN設定を加える設定更新をしてみます。以下のように各オプションを指定してサブコマンドを実行します。
% aws mediatailor put-playback-configuration \
--name <value> \
--ad-decision-server-url <value> \
--video-content-source-url <value> \
--cdn-configuration <value>
--cdn-configuration
オプションはAdSegmentUrlPrefix=string,ContentSegmentUrlPrefix=string
のように指定します。実際に実行して確認してみましょう。まずはCDN設定を加える前のConfigurationの出力をget-playback-configuration
サブコマンドで確認しておきます。
% aws mediatailor get-playback-configuration \
--name vod-preroll-cli
{
"AdDecisionServerUrl": "https://ad-decision-xxxxxxxx.s3.ap-northeast-1.amazonaws.com/ads/static-vast-demo.xml",
"AvailSuppression": {
"Mode": "OFF"
},
"Bumper": {},
"CdnConfiguration": {},
"DashConfiguration": {
"ManifestEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/dash/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/",
"MpdLocation": "EMT_DEFAULT",
"OriginManifestType": "MULTI_PERIOD"
},
"HlsConfiguration": {
"ManifestEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/master/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/"
},
"InsertionMode": "STITCHED_ONLY",
"LivePreRollConfiguration": {},
"ManifestProcessingRules": {
"AdMarkerPassthrough": {
"Enabled": false
}
},
"Name": "vod-preroll-cli",
"PlaybackConfigurationArn": "arn:aws:mediatailor:us-west-2:123456789012:playbackConfiguration/vod-preroll-cli",
"PlaybackEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com",
"SessionInitializationEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/session/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/",
"Tags": {},
"VideoContentSourceUrl": "https://content-source-xxxxxxxx.s3.ap-northeast-1.amazonaws.com"
}
CDN設定を加えたい、ということで以下のようにput-playback-configuration
サブコマンドに--name
と--cdn-configuration
オプションのみを指定した場合、エラーとなってしまいます。
% aws mediatailor put-playback-configuration \
--name vod-preroll-cli \
--cdn-configuration AdSegmentUrlPrefix="https://d2p0zy0qeyjyuw.cloudfront.net",ContentSegmentUrlPrefix="https://d2p0zy0qeyjyuw.cloudfront.net"
An error occurred (BadRequestException) when calling the PutPlaybackConfiguration operation: AdDecisionServerUrl must be provided
今回の実行例では、--name
と--cdn-configuration
に加え、 --ad-decision-server-url
と--video-content-source-url
が必須のオプションとなります。
% aws mediatailor put-playback-configuration \
--name vod-preroll-cli \
--ad-decision-server-url "https://ad-decision-xxxxxxxx.s3.ap-northeast-1.amazonaws.com/ads/static-vast-demo.xml" \
--cdn-configuration AdSegmentUrlPrefix="https://d2p0xxxxxxxxxx.cloudfront.net",ContentSegmentUrlPrefix="https://d2p0xxxxxxxxxx.cloudfront.net"
An error occurred (BadRequestException) when calling the PutPlaybackConfiguration operation: VideoContentSourceUrl must be provided
以下がすべての必須オプションをそろえてput-playback-configuration
サブコマンドを実行した例です。レスポンスとして設定内容が返り、CdnConfiguration
が設定されていることが確認できますね。
% aws mediatailor put-playback-configuration \
--name vod-preroll-cli \
--ad-decision-server-url "https://ad-decision-xxxxxxxx.s3.ap-northeast-1.amazonaws.com/ads/static-vast-demo.xml" \
--video-content-source-url "https://content-source-xxxxxxxx.s3.ap-northeast-1.amazonaws.com" \
--cdn-configuration AdSegmentUrlPrefix="https://d2p0xxxxxxxxxx.cloudfront.net",ContentSegmentUrlPrefix="https://d2p0xxxxxxxxxx.cloudfront.net"
{
"AdDecisionServerUrl": "https://ad-decision-xxxxxxxx.s3.ap-northeast-1.amazonaws.com/ads/static-vast-demo.xml",
"AvailSuppression": {
"Mode": "OFF"
},
"Bumper": {},
"CdnConfiguration": {
"AdSegmentUrlPrefix": "https://d2p0xxxxxxxxxx.cloudfront.net",
"ContentSegmentUrlPrefix": "https://d2p0xxxxxxxxxx.cloudfront.net"
},
"DashConfiguration": {
"ManifestEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/dash/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/",
"MpdLocation": "EMT_DEFAULT",
"OriginManifestType": "MULTI_PERIOD"
},
"HlsConfiguration": {
"ManifestEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/master/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/"
},
"InsertionMode": "STITCHED_ONLY",
"LivePreRollConfiguration": {},
"ManifestProcessingRules": {
"AdMarkerPassthrough": {
"Enabled": false
}
},
"Name": "vod-preroll-cli",
"PlaybackConfigurationArn": "arn:aws:mediatailor:us-west-2:123456789012:playbackConfiguration/vod-preroll-cli",
"PlaybackEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com",
"SessionInitializationEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/session/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/",
"Tags": {},
"VideoContentSourceUrl": "https://content-source-xxxxxxxx.s3.ap-northeast-1.amazonaws.com"
}
CDN設定を加えるためのput-playback-configuration
サブコマンド実行後、もう一度get-playback-configuration
サブコマンドでConfiguration情報を確認してみます。きちんとCDN設定CdnConfiguration
が更新されていますね。
% aws mediatailor get-playback-configuration \
--name vod-preroll-cli
{
"AdDecisionServerUrl": "https://ad-decision-xxxxxxxx.s3.ap-northeast-1.amazonaws.com/ads/static-vast-demo.xml",
"AvailSuppression": {
"Mode": "OFF"
},
"Bumper": {},
"CdnConfiguration": {
"AdSegmentUrlPrefix": "https://d2p0xxxxxxxxxx.cloudfront.net",
"ContentSegmentUrlPrefix": "https://d2p0xxxxxxxxxx.cloudfront.net"
},
"DashConfiguration": {
"ManifestEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/dash/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/",
"MpdLocation": "EMT_DEFAULT",
"OriginManifestType": "MULTI_PERIOD"
},
"HlsConfiguration": {
"ManifestEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/master/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/"
},
"InsertionMode": "STITCHED_ONLY",
"LivePreRollConfiguration": {},
"ManifestProcessingRules": {
"AdMarkerPassthrough": {
"Enabled": false
}
},
"Name": "vod-preroll-cli",
"PlaybackConfigurationArn": "arn:aws:mediatailor:us-west-2:123456789012:playbackConfiguration/vod-preroll-cli",
"PlaybackEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com",
"SessionInitializationEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/session/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/",
"Tags": {},
"VideoContentSourceUrl": "https://content-source-xxxxxxxx.s3.ap-northeast-1.amazonaws.com"
}
セッションログ設定
Configurationリソースの設定変更についてはリソース作成と同様にput-playback-configuration
サブコマンドを利用、その際には変更しない項目についてもオプションで指定する必要がある、という使い方でした。さてConfigurationリソースに関する設定項目のうち、セッションログ設定についてはこの規則が当てはまりません。put-playback-configuration
サブコマンドのオプションで指定するかたちではなく、専用のサブコマンドconfigure-logs-for-playback-configuration
で設定を行います。
なおセッションログについてはCloudWatch Logsに出力され、MediaTailor Configuration側でこのCloudWatch Logsに送信するログ出力の量を割合で指定可能というものでした。詳細は以下ブログエントリを参照ください。
セッションログ設定専用のconfigure-logs-for-playback-configuration
aws mediatailor configure-logs-for-playback-configuration
サブコマンドについては以下の書式で使用します。オプションとして、--playback-configuration-name
でConfigurationのNameを、また--percent-enabled
でCloudWatch Logsに送信するログの量の割合を指定します。
% aws mediatailor configure-logs-for-playback-configuration \
--playback-configuration-name <value> \
--percent-enabled <value>
以下、実際の実行例です。先ほどput-playback-configuration
サブコマンドで作成ならびに設定変更を行ったConfigurationですが、ログについては設定していない状況でした。get-playback-configuration
サブコマンドで確認しても、ログに関する項目はありませんね。
% aws mediatailor get-playback-configuration \
--name vod-preroll-cli
{
"AdDecisionServerUrl": "https://ad-decision-xxxxxxxx.s3.ap-northeast-1.amazonaws.com/ads/static-vast-demo.xml",
"AvailSuppression": {
"Mode": "OFF"
},
"Bumper": {},
"CdnConfiguration": {
"AdSegmentUrlPrefix": "https://d2p0xxxxxxxxxx.cloudfront.net",
"ContentSegmentUrlPrefix": "https://d2p0xxxxxxxxxx.cloudfront.net"
},
"DashConfiguration": {
"ManifestEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/dash/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/",
"MpdLocation": "EMT_DEFAULT",
"OriginManifestType": "MULTI_PERIOD"
},
"HlsConfiguration": {
"ManifestEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/master/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/"
},
"InsertionMode": "STITCHED_ONLY",
"LivePreRollConfiguration": {},
"ManifestProcessingRules": {
"AdMarkerPassthrough": {
"Enabled": false
}
},
"Name": "vod-preroll-cli",
"PlaybackConfigurationArn": "arn:aws:mediatailor:us-west-2:123456789012:playbackConfiguration/vod-preroll-cli",
"PlaybackEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com",
"SessionInitializationEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/session/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/",
"Tags": {},
"VideoContentSourceUrl": "https://content-source-xxxxxxxx.s3.ap-northeast-1.amazonaws.com"
}
configure-logs-for-playback-configuration
サブコマンドでセッションログ出力を設定してみます。ログ出力の割合は100
(%)としました。コマンドの返り値で設定項目が確認できますね。
% aws mediatailor configure-logs-for-playback-configuration \
--playback-configuration-name vod-preroll-cli \
--percent-enabled 100
{
"PercentEnabled": 100,
"PlaybackConfigurationName": "vod-preroll-cli"
}
get-playback-configuration
サブコマンドでも確認してみましょう。"LogConfiguration"
という項目が追加されていることがわかります。
% aws mediatailor get-playback-configuration \
--name vod-preroll-cli
{
"AdDecisionServerUrl": "https://ad-decision-xxxxxxxx.s3.ap-northeast-1.amazonaws.com/ads/static-vast-demo.xml",
"AvailSuppression": {
"Mode": "OFF"
},
"Bumper": {},
"CdnConfiguration": {
"AdSegmentUrlPrefix": "https://d2p0xxxxxxxxxx.cloudfront.net",
"ContentSegmentUrlPrefix": "https://d2p0xxxxxxxxxx.cloudfront.net"
},
"DashConfiguration": {
"ManifestEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/dash/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/",
"MpdLocation": "EMT_DEFAULT",
"OriginManifestType": "MULTI_PERIOD"
},
"HlsConfiguration": {
"ManifestEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/master/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/"
},
"InsertionMode": "STITCHED_ONLY",
"LivePreRollConfiguration": {},
"LogConfiguration": {
"PercentEnabled": 100
},
"ManifestProcessingRules": {
"AdMarkerPassthrough": {
"Enabled": false
}
},
"Name": "vod-preroll-cli",
"PlaybackConfigurationArn": "arn:aws:mediatailor:us-west-2:123456789012:playbackConfiguration/vod-preroll-cli",
"PlaybackEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com",
"SessionInitializationEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/session/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/",
"Tags": {},
"VideoContentSourceUrl": "https://content-source-xxxxxxxx.s3.ap-northeast-1.amazonaws.com"
}
ログ出力割合の変更についても確認してみます。まずは60
(%)にしてみます。
% aws mediatailor configure-logs-for-playback-configuration \
--playback-configuration-name vod-preroll-cli \
--percent-enabled 60
{
"PercentEnabled": 60,
"PlaybackConfigurationName": "vod-preroll-cli"
}
get-playback-configuration
サブコマンドの実行結果でも、ログ出力の割合が変更されていることが確認できます。
% aws mediatailor get-playback-configuration \
--name vod-preroll-cli
{
"AdDecisionServerUrl": "https://ad-decision-xxxxxxxx.s3.ap-northeast-1.amazonaws.com/ads/static-vast-demo.xml",
"AvailSuppression": {
"Mode": "OFF"
},
"Bumper": {},
"CdnConfiguration": {
"AdSegmentUrlPrefix": "https://d2p0xxxxxxxxxx.cloudfront.net",
"ContentSegmentUrlPrefix": "https://d2p0xxxxxxxxxx.cloudfront.net"
},
"DashConfiguration": {
"ManifestEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/dash/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/",
"MpdLocation": "EMT_DEFAULT",
"OriginManifestType": "MULTI_PERIOD"
},
"HlsConfiguration": {
"ManifestEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/master/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/"
},
"InsertionMode": "STITCHED_ONLY",
"LivePreRollConfiguration": {},
"LogConfiguration": {
"PercentEnabled": 60
},
"ManifestProcessingRules": {
"AdMarkerPassthrough": {
"Enabled": false
}
},
"Name": "vod-preroll-cli",
"PlaybackConfigurationArn": "arn:aws:mediatailor:us-west-2:123456789012:playbackConfiguration/vod-preroll-cli",
"PlaybackEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com",
"SessionInitializationEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/session/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/",
"Tags": {},
"VideoContentSourceUrl": "https://content-source-xxxxxxxx.s3.ap-northeast-1.amazonaws.com"
}
セッションログ出力を無効(オフ)にする場合は、出力する割合を0
(%)に設定するという認識です。こちらも実行してみます。
% aws mediatailor configure-logs-for-playback-configuration \
--playback-configuration-name vod-preroll-cli \
--percent-enabled 0
{
"PercentEnabled": 0,
"PlaybackConfigurationName": "vod-preroll-cli"
}
% aws mediatailor get-playback-configuration \
--name vod-preroll-cli
{
"AdDecisionServerUrl": "https://ad-decision-xxxxxxxx.s3.ap-northeast-1.amazonaws.com/ads/static-vast-demo.xml",
"AvailSuppression": {
"Mode": "OFF"
},
"Bumper": {},
"CdnConfiguration": {
"AdSegmentUrlPrefix": "https://d2p0xxxxxxxxxx.cloudfront.net",
"ContentSegmentUrlPrefix": "https://d2p0xxxxxxxxxx.cloudfront.net"
},
"DashConfiguration": {
"ManifestEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/dash/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/",
"MpdLocation": "EMT_DEFAULT",
"OriginManifestType": "MULTI_PERIOD"
},
"HlsConfiguration": {
"ManifestEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/master/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/"
},
"InsertionMode": "STITCHED_ONLY",
"LivePreRollConfiguration": {},
"LogConfiguration": {
"PercentEnabled": 0
},
"ManifestProcessingRules": {
"AdMarkerPassthrough": {
"Enabled": false
}
},
"Name": "vod-preroll-cli",
"PlaybackConfigurationArn": "arn:aws:mediatailor:us-west-2:123456789012:playbackConfiguration/vod-preroll-cli",
"PlaybackEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com",
"SessionInitializationEndpointPrefix": "https://f5d9xxxxxxxxxxxxxxxxxxxxxxxxxxxx.mediatailor.us-west-2.amazonaws.com/v1/session/75e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/vod-preroll-cli/",
"Tags": {},
"VideoContentSourceUrl": "https://content-source-xxxxxxxx.s3.ap-northeast-1.amazonaws.com"
}
Configurationの削除(Delete)
Configurationリソースの表示、新規作成と更新、そしてセッションログ設定の各サブコマンドについて確認してきました。最後にConfigurationリソースの削除について確認しましょう。Configurationリソースの削除はdelete-playback-configuration
サブコマンドで行います。
削除はdelete-playback-configuration
aws mediatailor delete-playback-configuration
の書式は以下となります。--name
オプションでConfigurationリソースのNameのみ指定するかたちですね。
% aws mediatailor delete-playback-configuration \
--name <value>
以下が実行例となります。コマンド実行時の返り値は特にありませんので、実行前後でlist-playback-configurations
サブコマンドなどを使って確認するようにしましょう。
% aws mediatailor list-playback-configurations \
--query "Items[*].Name"
[
"MyTestCampaign",
"vod-preroll-2",
"vod-preroll-cli"
]
% aws mediatailor delete-playback-configuration \
--name vod-preroll-cli
% aws mediatailor list-playback-configurations \
--query "Items[*].Name"
[
"MyTestCampaign",
"vod-preroll-2"
]
まとめ
AWS Elemental MediaTailor Ad insertion(広告挿入)機能の基本的な操作をAWS CLIでやってみました。aws mediatailor
コマンドの一覧を確認するとサブコマンドが少し多くびっくりしますが、Channel assembly機能のサブコマンドも含まれています。まずはAd insertionの操作用サブコマンドを確認しましょう。(AWSサービスによって、例えばMediaPackageやAmazon IVSのように機能ごとコマンド自体がわかれているものもあります。対して、今回のMediaTailorやMediaLive、さらにEC2など1つのコマンド内に複数機能のサブコマンド群が含まれているものも多いですね。)
Ad insertionでは操作対象のリソースがConfigurationと(今回は扱いませんでしたが)Prefetch schedule、そしてログ設定用サブコマンドというかたちで、AWS CLIでの操作も基本をおさえておけばシンプルに操作が実現できるかと思います。またConfigurationについては新規作成と設定変更、いずれもput
ではじまるサブコマンドではじまる点が要注意かなと思いました。(aws mediatailor
コマンドでも、Channel assemblyのChannelリソースなどはcreate
とupdate
ではじまるサブコマンドが準備されています。リソースによって異なる点が興味深いですね。)