LoginSignup
4
5

More than 5 years have passed since last update.

AWS Media ServicesをCLIから操作する

Last updated at Posted at 2017-12-04

最近、AWSメディアサービスやってみています! https://qiita.com/tin-machine/items/73d1564eeeeda49a3f6c

でも、動画配信のパラメータを変更して検証するの... :tired_face: 超面倒なんですけど。おっさん辛い。

:persevere: そもそも、都度チャンネル作らなきゃならない設定はなんなの。辛み。
CLIから作りたくなってきた。aws-cliをアップデートするとメディアサービスも使えるようになります!

最初に aws-cliをアップデートする

pip install -U awscli

チャンネルidを取得する

先にチャンネルのIDを確認します。WebUIだと
[ MediaLive ]->[ Channels ]->作成したチャンネルのラジオボタンをクリック->[ ID ]の所の数字をメモ

CLIからだと

aws medialive list-channels | jq -r '.Channels[].Id'

で取得できます

チャンネルの設定情報を取得します

aws medialive describe-channel --channel-id チャンネルid > channel_sample.json

チャンネル設定を変更する :relaxed:

上記の describe-channel はユニークであるべきidやチャンネルごとに振られるIPアドレス、ステータスなども出力されてしまいますので削除します。
* PipelinesRunningCount
* EgressEndpoints
* State
* Id
* Arn

他のアカウントから設定をコピーする場合は
* RoleArn
も修正しましょう

既にある設定を削除する :smiling_imp:

注) 下記を実行すると、既にあるチャンネル設定が一つ消えます。高速に検証するため、チャンネル設定を消して作ってを行っていますが、サービスするようになったら変更する必要があるでしょう。

上記のチャンネルidを取得する方法を利用して、既存のチャンネル設定を削除しています。

aws medialive delete-channel --channel-id $(aws medialive list-channels | jq -r '.Channels[].Id')

jsonからチャンネルを作る :kissing_heart:

aws medialive create-channel  --region ap-southeast-1  --cli-input-json file://channel_sample.json

チャンネルをスタートする :movie_camera:

aws medialive start-channel --channel-id $(aws medialive list-channels | jq -r '.Channels[].Id')

チャンネルをストップする :no_entry_sign:

aws medialive stop-channel --channel-id (aws medialive list-channels | jq -r '.Channels[].Id')
4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5