文件 AWS 開發套件範例 GitHub 儲存庫中有更多可用的 AWS SDK 範例
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用 的 Elastic Transcoder 範例 AWS CLI
下列程式碼範例示範如何使用 AWS Command Line Interface 搭配 Elastic Transcoder 來執行動作和實作常見案例。
Actions 是大型程式的程式碼摘錄,必須在內容中執行。雖然動作會告訴您如何呼叫個別服務函數,但您可以在其相關情境中查看內容中的動作。
每個範例都包含完整原始程式碼的連結,您可以在其中找到如何在內容中設定和執行程式碼的指示。
主題
動作
下列程式碼範例示範如何使用 cancel-job
。
- AWS CLI
-
取消 ElasticTranscoder 的任務
這會取消 ElasticTranscoder 的指定任務。
命令:
aws elastictranscoder cancel-job --id
3333333333333-abcde3
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CancelJob
。
-
下列程式碼範例示範如何使用 create-job
。
- AWS CLI
-
為 ElasticTranscoder 建立任務
下列
create-job
範例會建立 ElasticTranscoder 的任務。aws elastictranscoder create-job \ --pipeline-id
1111111111111-abcde1
\ --inputsfile://inputs.json
\ --outputsfile://outputs.json
\ --output-key-prefix"recipes/"
\ --user-metadatafile://user-metadata.json
inputs.json
的內容:[{ "Key":"ETS_example_file.mp4", "FrameRate":"auto", "Resolution":"auto", "AspectRatio":"auto", "Interlaced":"auto", "Container":"mp4" }]
output.json 的內容:
[ { "Key":"webm/ETS_example_file-kindlefirehd.webm", "Rotate":"0", "PresetId":"1351620000001-100250" } ]
user-metadata.json
的內容:{ "Food type":"Italian", "Cook book":"recipe notebook" }
輸出:
{ "Job": { "Status": "Submitted", "Inputs": [ { "Container": "mp4", "FrameRate": "auto", "Key": "ETS_example_file.mp4", "AspectRatio": "auto", "Resolution": "auto", "Interlaced": "auto" } ], "Playlists": [], "Outputs": [ { "Status": "Submitted", "Rotate": "0", "PresetId": "1351620000001-100250", "Watermarks": [], "Key": "webm/ETS_example_file-kindlefirehd.webm", "Id": "1" } ], "PipelineId": "3333333333333-abcde3", "OutputKeyPrefix": "recipes/", "UserMetadata": { "Cook book": "recipe notebook", "Food type": "Italian" }, "Output": { "Status": "Submitted", "Rotate": "0", "PresetId": "1351620000001-100250", "Watermarks": [], "Key": "webm/ETS_example_file-kindlefirehd.webm", "Id": "1" }, "Timing": { "SubmitTimeMillis": 1533838012298 }, "Input": { "Container": "mp4", "FrameRate": "auto", "Key": "ETS_example_file.mp4", "AspectRatio": "auto", "Resolution": "auto", "Interlaced": "auto" }, "Id": "1533838012294-example", "Arn": "arn:aws:elastictranscoder:us-west-2:123456789012:job/1533838012294-example" } }
-
如需 API 詳細資訊,請參閱《AWS CLI 命令參考》中的 CreateJob
。
-
下列程式碼範例示範如何使用 create-pipeline
。
- AWS CLI
-
建立 ElasticTranscoder 的管道
下列
create-pipeline
範例會建立 ElasticTranscoder 的管道。aws elastictranscoder create-pipeline \ --name
Default
\ --input-bucketsalesoffice.example.com-source
\ --rolearn:aws:iam::123456789012:role/Elastic_Transcoder_Default_Role
\ --notifications Progressing="",Completed="",Warning="",Error=arn:aws:sns:us-east-1:111222333444:ETS_Errors \ --content-configfile://content-config.json
\ --thumbnail-configfile://thumbnail-config.json
content-config.json
的內容:{ "Bucket":"salesoffice.example.com-public-promos", "Permissions":[ { "GranteeType":"Email", "Grantee":"marketing-promos@example.com", "Access":[ "FullControl" ] } ], "StorageClass":"Standard" }
thumbnail-config.json
的內容:{ "Bucket":"salesoffice.example.com-public-promos-thumbnails", "Permissions":[ { "GranteeType":"Email", "Grantee":"marketing-promos@example.com", "Access":[ "FullControl" ] } ], "StorageClass":"ReducedRedundancy" }
輸出:
{ "Pipeline": { "Status": "Active", "ContentConfig": { "Bucket": "salesoffice.example.com-public-promos", "StorageClass": "Standard", "Permissions": [ { "Access": [ "FullControl" ], "Grantee": "marketing-promos@example.com", "GranteeType": "Email" } ] }, "Name": "Default", "ThumbnailConfig": { "Bucket": "salesoffice.example.com-public-promos-thumbnails", "StorageClass": "ReducedRedundancy", "Permissions": [ { "Access": [ "FullControl" ], "Grantee": "marketing-promos@example.com", "GranteeType": "Email" } ] }, "Notifications": { "Completed": "", "Warning": "", "Progressing": "", "Error": "arn:aws:sns:us-east-1:123456789012:ETS_Errors" }, "Role": "arn:aws:iam::123456789012:role/Elastic_Transcoder_Default_Role", "InputBucket": "salesoffice.example.com-source", "Id": "1533765810590-example", "Arn": "arn:aws:elastictranscoder:us-west-2:123456789012:pipeline/1533765810590-example" }, "Warnings": [ { "Message": "The SNS notification topic for Error events and the pipeline are in different regions, which increases processing time for jobs in the pipeline and can incur additional charges. To decrease processing time and prevent cross-regional charges, use the same region for the SNS notification topic and the pipeline.", "Code": "6006" } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CreatePipeline
。
-
下列程式碼範例示範如何使用 create-preset
。
- AWS CLI
-
為 ElasticTranscoder 建立預設集
下列
create-preset
範例會建立 ElasticTranscoder 的預設集。aws elastictranscoder create-preset \ --name
DefaultPreset
\ --description"Use for published videos"
\ --containermp4
\ --videofile://video.json
\ --audiofile://audio.json
\ --thumbnailsfile://thumbnails.json
video.json
的內容:{ "Codec":"H.264", "CodecOptions":{ "Profile":"main", "Level":"2.2", "MaxReferenceFrames":"3", "MaxBitRate":"", "BufferSize":"", "InterlacedMode":"Progressive", "ColorSpaceConversionMode":"None" }, "KeyframesMaxDist":"240", "FixedGOP":"false", "BitRate":"1600", "FrameRate":"auto", "MaxFrameRate":"30", "MaxWidth":"auto", "MaxHeight":"auto", "SizingPolicy":"Fit", "PaddingPolicy":"Pad", "DisplayAspectRatio":"auto", "Watermarks":[ { "Id":"company logo", "MaxWidth":"20%", "MaxHeight":"20%", "SizingPolicy":"ShrinkToFit", "HorizontalAlign":"Right", "HorizontalOffset":"10px", "VerticalAlign":"Bottom", "VerticalOffset":"10px", "Opacity":"55.5", "Target":"Content" } ] }
audio.json
的內容:{ "Codec":"AAC", "CodecOptions":{ "Profile":"AAC-LC" }, "SampleRate":"44100", "BitRate":"96", "Channels":"2" }
thumbnails.json
的內容:{ "Format":"png", "Interval":"120", "MaxWidth":"auto", "MaxHeight":"auto", "SizingPolicy":"Fit", "PaddingPolicy":"Pad" }
輸出:
{ "Preset": { "Thumbnails": { "SizingPolicy": "Fit", "MaxWidth": "auto", "Format": "png", "PaddingPolicy": "Pad", "Interval": "120", "MaxHeight": "auto" }, "Container": "mp4", "Description": "Use for published videos", "Video": { "SizingPolicy": "Fit", "MaxWidth": "auto", "PaddingPolicy": "Pad", "MaxFrameRate": "30", "FrameRate": "auto", "MaxHeight": "auto", "KeyframesMaxDist": "240", "FixedGOP": "false", "Codec": "H.264", "Watermarks": [ { "SizingPolicy": "ShrinkToFit", "VerticalOffset": "10px", "VerticalAlign": "Bottom", "Target": "Content", "MaxWidth": "20%", "MaxHeight": "20%", "HorizontalAlign": "Right", "HorizontalOffset": "10px", "Opacity": "55.5", "Id": "company logo" } ], "CodecOptions": { "Profile": "main", "MaxBitRate": "32", "InterlacedMode": "Progressive", "Level": "2.2", "ColorSpaceConversionMode": "None", "MaxReferenceFrames": "3", "BufferSize": "5" }, "BitRate": "1600", "DisplayAspectRatio": "auto" }, "Audio": { "Channels": "2", "CodecOptions": { "Profile": "AAC-LC" }, "SampleRate": "44100", "Codec": "AAC", "BitRate": "96" }, "Type": "Custom", "Id": "1533765290724-example" "Arn": "arn:aws:elastictranscoder:us-west-2:123456789012:preset/1533765290724-example", "Name": "DefaultPreset" }, "Warning": "" }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CreatePreset
。
-
下列程式碼範例示範如何使用 delete-pipeline
。
- AWS CLI
-
刪除指定的 ElasticTranscoder 管道
這會刪除指定的 ElasticTranscoder 管道。
命令:
aws elastictranscoder delete-pipeline --id
1111111111111-abcde1
輸出:
{ "Success":"true" }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeletePipeline
。
-
下列程式碼範例示範如何使用 delete-preset
。
- AWS CLI
-
刪除指定的 ElasticTranscoder 預設集
這會刪除指定的 ElasticTranscoder 預設集。
命令:
aws elastictranscoder delete-preset --id
5555555555555-abcde5
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeletePreset
。
-
下列程式碼範例示範如何使用 list-jobs-by-pipeline
。
- AWS CLI
-
在指定的管道中擷取 ElasticTranscoder 任務清單
此範例會擷取指定管道中的 ElasticTranscoder 任務清單。
命令:
aws elastictranscoder list-jobs-by-pipeline --pipeline-id
1111111111111-abcde1
輸出:
{ "Jobs": [] }
-
如需 API 詳細資訊,請參閱《 AWS CLI 命令參考》中的 ListJobsByPipeline
。
-
下列程式碼範例示範如何使用 list-jobs-by-status
。
- AWS CLI
-
擷取狀態為完成的 ElasticTranscoder 任務清單
此範例會擷取狀態為完成的 ElasticTranscoder 任務清單。
命令:
aws elastictranscoder list-jobs-by-status --status
Complete
輸出:
{ "Jobs": [] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 ListJobsByStatus
。
-
下列程式碼範例示範如何使用 list-pipelines
。
- AWS CLI
-
擷取 ElasticTranscoder 管道的清單
此範例會擷取 ElasticTranscoder 管道的清單。
命令:
aws elastictranscoder list-pipelines
輸出:
{ "Pipelines": [ { "Status": "Active", "ContentConfig": { "Bucket": "ets-example", "Permissions": [] }, "Name": "example-pipeline", "ThumbnailConfig": { "Bucket": "ets-example", "Permissions": [] }, "Notifications": { "Completed": "arn:aws:sns:us-west-2:123456789012:ets_example", "Warning": "", "Progressing": "", "Error": "" }, "Role": "arn:aws:iam::123456789012:role/Elastic_Transcoder_Default_Role", "InputBucket": "ets-example", "OutputBucket": "ets-example", "Id": "3333333333333-abcde3", "Arn": "arn:aws:elastictranscoder:us-west-2:123456789012:pipeline/3333333333333-abcde3" }, { "Status": "Paused", "ContentConfig": { "Bucket": "ets-example", "Permissions": [] }, "Name": "example-php-test", "ThumbnailConfig": { "Bucket": "ets-example", "Permissions": [] }, "Notifications": { "Completed": "", "Warning": "", "Progressing": "", "Error": "" }, "Role": "arn:aws:iam::123456789012:role/Elastic_Transcoder_Default_Role", "InputBucket": "ets-example", "OutputBucket": "ets-example", "Id": "3333333333333-abcde2", "Arn": "arn:aws:elastictranscoder:us-west-2:123456789012:pipeline/3333333333333-abcde2" }, { "Status": "Active", "ContentConfig": { "Bucket": "ets-west-output", "Permissions": [] }, "Name": "pipeline-west", "ThumbnailConfig": { "Bucket": "ets-west-output", "Permissions": [] }, "Notifications": { "Completed": "arn:aws:sns:us-west-2:123456789012:ets-notifications", "Warning": "", "Progressing": "", "Error": "" }, "Role": "arn:aws:iam::123456789012:role/Elastic_Transcoder_Default_Role", "InputBucket": "ets-west-input", "OutputBucket": "ets-west-output", "Id": "3333333333333-abcde1", "Arn": "arn:aws:elastictranscoder:us-west-2:123456789012:pipeline/3333333333333-abcde1" } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 ListPipelines
。
-
下列程式碼範例示範如何使用 list-presets
。
- AWS CLI
-
擷取 ElasticTranscoder 預設集的清單
此範例會擷取 ElasticTranscoder 預設集的清單。
命令:
aws elastictranscoder list-presets --max-items
2
輸出:
{ "Presets": [ { "Container": "mp4", "Name": "KindleFireHD-preset", "Video": { "Resolution": "1280x720", "FrameRate": "30", "KeyframesMaxDist": "90", "FixedGOP": "false", "Codec": "H.264", "Watermarks": [], "CodecOptions": { "Profile": "main", "MaxReferenceFrames": "3", "ColorSpaceConversionMode": "None", "InterlacedMode": "Progressive", "Level": "4" }, "AspectRatio": "16:9", "BitRate": "2200" }, "Audio": { "Channels": "2", "CodecOptions": { "Profile": "AAC-LC" }, "SampleRate": "48000", "Codec": "AAC", "BitRate": "160" }, "Type": "Custom", "Id": "3333333333333-abcde2", "Arn": "arn:aws:elastictranscoder:us-west-2:123456789012:preset/3333333333333-abcde2", "Thumbnails": { "AspectRatio": "16:9", "Interval": "60", "Resolution": "192x108", "Format": "png" } }, { "Thumbnails": { "AspectRatio": "16:9", "Interval": "60", "Resolution": "192x108", "Format": "png" }, "Container": "mp4", "Description": "Custom preset for transcoding jobs", "Video": { "Resolution": "1280x720", "FrameRate": "30", "KeyframesMaxDist": "90", "FixedGOP": "false", "Codec": "H.264", "Watermarks": [], "CodecOptions": { "Profile": "main", "MaxReferenceFrames": "3", "ColorSpaceConversionMode": "None", "InterlacedMode": "Progressive", "Level": "3.1" }, "AspectRatio": "16:9", "BitRate": "2200" }, "Audio": { "Channels": "2", "CodecOptions": { "Profile": "AAC-LC" }, "SampleRate": "44100", "Codec": "AAC", "BitRate": "160" }, "Type": "Custom", "Id": "3333333333333-abcde3", "Arn": "arn:aws:elastictranscoder:us-west-2:123456789012:preset/3333333333333-abcde3", "Name": "Roman's Preset" } ], "NextToken": "eyJQYWdlVG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAyfQ==" }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 ListPresets
。
-
下列程式碼範例示範如何使用 read-job
。
- AWS CLI
-
擷取 ElasticTranscoder 任務
此範例會擷取指定的 ElasticTranscoder 任務。
命令:
aws elastictranscoder read-job --id
1533838012294-example
輸出:
{ "Job": { "Status": "Progressing", "Inputs": [ { "Container": "mp4", "FrameRate": "auto", "Key": "ETS_example_file.mp4", "AspectRatio": "auto", "Resolution": "auto", "Interlaced": "auto" } ], "Playlists": [], "Outputs": [ { "Status": "Progressing", "Rotate": "0", "PresetId": "1351620000001-100250", "Watermarks": [], "Key": "webm/ETS_example_file-kindlefirehd.webm", "Id": "1" } ], "PipelineId": "3333333333333-abcde3", "OutputKeyPrefix": "recipes/", "UserMetadata": { "Cook book": "recipe notebook", "Food type": "Italian" }, "Output": { "Status": "Progressing", "Rotate": "0", "PresetId": "1351620000001-100250", "Watermarks": [], "Key": "webm/ETS_example_file-kindlefirehd.webm", "Id": "1" }, "Timing": { "SubmitTimeMillis": 1533838012298, "StartTimeMillis": 1533838013786 }, "Input": { "Container": "mp4", "FrameRate": "auto", "Key": "ETS_example_file.mp4", "AspectRatio": "auto", "Resolution": "auto", "Interlaced": "auto" }, "Id": "1533838012294-example", "Arn": "arn:aws:elastictranscoder:us-west-2:123456789012:job/1533838012294-example" } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 ReadJob
。
-
下列程式碼範例示範如何使用 read-pipeline
。
- AWS CLI
-
擷取 ElasticTranscoder 管道
此範例會擷取指定的 ElasticTranscoder 管道。
命令:
aws elastictranscoder read-pipeline --id
3333333333333-abcde3
輸出:
{ "Pipeline": { "Status": "Active", "ContentConfig": { "Bucket": "ets-example", "StorageClass": "Standard", "Permissions": [ { "Access": [ "FullControl" ], "Grantee": "marketing-promos@example.com", "GranteeType": "Email" } ] }, "Name": "Default", "ThumbnailConfig": { "Bucket": "ets-example", "StorageClass": "ReducedRedundancy", "Permissions": [ { "Access": [ "FullControl" ], "Grantee": "marketing-promos@example.com", "GranteeType": "Email" } ] }, "Notifications": { "Completed": "", "Warning": "", "Progressing": "", "Error": "arn:aws:sns:us-east-1:123456789012:ETS_Errors" }, "Role": "arn:aws:iam::123456789012:role/Elastic_Transcoder_Default_Role", "InputBucket": "ets-example", "Id": "3333333333333-abcde3", "Arn": "arn:aws:elastictranscoder:us-west-2:123456789012:pipeline/3333333333333-abcde3" }, "Warnings": [ { "Message": "The SNS notification topic for Error events and the pipeline are in different regions, which increases processing time for jobs in the pipeline and can incur additional charges. To decrease processing time and prevent cross-regional charges, use the same region for the SNS notification topic and the pipeline.", "Code": "6006" } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 ReadPipeline
。
-
下列程式碼範例示範如何使用 read-preset
。
- AWS CLI
-
擷取 ElasticTranscoder 預設集
此範例會擷取指定的 ElasticTranscoder 預設集。
命令:
aws elastictranscoder read-preset --id
1351620000001-500020
輸出:
{ "Preset": { "Thumbnails": { "SizingPolicy": "ShrinkToFit", "MaxWidth": "192", "Format": "png", "PaddingPolicy": "NoPad", "Interval": "300", "MaxHeight": "108" }, "Container": "fmp4", "Description": "System preset: MPEG-Dash Video - 4.8M", "Video": { "SizingPolicy": "ShrinkToFit", "MaxWidth": "1280", "PaddingPolicy": "NoPad", "FrameRate": "30", "MaxHeight": "720", "KeyframesMaxDist": "60", "FixedGOP": "true", "Codec": "H.264", "Watermarks": [ { "SizingPolicy": "ShrinkToFit", "VerticalOffset": "10%", "VerticalAlign": "Top", "Target": "Content", "MaxWidth": "10%", "MaxHeight": "10%", "HorizontalAlign": "Left", "HorizontalOffset": "10%", "Opacity": "100", "Id": "TopLeft" }, { "SizingPolicy": "ShrinkToFit", "VerticalOffset": "10%", "VerticalAlign": "Top", "Target": "Content", "MaxWidth": "10%", "MaxHeight": "10%", "HorizontalAlign": "Right", "HorizontalOffset": "10%", "Opacity": "100", "Id": "TopRight" }, { "SizingPolicy": "ShrinkToFit", "VerticalOffset": "10%", "VerticalAlign": "Bottom", "Target": "Content", "MaxWidth": "10%", "MaxHeight": "10%", "HorizontalAlign": "Left", "HorizontalOffset": "10%", "Opacity": "100", "Id": "BottomLeft" }, { "SizingPolicy": "ShrinkToFit", "VerticalOffset": "10%", "VerticalAlign": "Bottom", "Target": "Content", "MaxWidth": "10%", "MaxHeight": "10%", "HorizontalAlign": "Right", "HorizontalOffset": "10%", "Opacity": "100", "Id": "BottomRight" } ], "CodecOptions": { "Profile": "main", "MaxBitRate": "4800", "InterlacedMode": "Progressive", "Level": "3.1", "ColorSpaceConversionMode": "None", "MaxReferenceFrames": "3", "BufferSize": "9600" }, "BitRate": "4800", "DisplayAspectRatio": "auto" }, "Type": "System", "Id": "1351620000001-500020", "Arn": "arn:aws:elastictranscoder:us-west-2:123456789012:preset/1351620000001-500020", "Name": "System preset: MPEG-Dash Video - 4.8M" } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 ReadPreset
。
-
下列程式碼範例示範如何使用 update-pipeline-notifications
。
- AWS CLI
-
更新 ElasticTranscoder 管道的通知
此範例會更新指定 ElasticTranscoder 管道的通知。
命令:
aws elastictranscoder update-pipeline-notifications --id
1111111111111-abcde1
--notificationsProgressing=arn:aws:sns:us-west-2:0123456789012:my-topic,Completed=arn:aws:sns:us-west-2:0123456789012:my-topic,Warning=arn:aws:sns:us-west-2:0123456789012:my-topic,Error=arn:aws:sns:us-east-1:111222333444:ETS_Errors
輸出:
{ "Pipeline": { "Status": "Active", "ContentConfig": { "Bucket": "ets-example", "StorageClass": "Standard", "Permissions": [ { "Access": [ "FullControl" ], "Grantee": "marketing-promos@example.com", "GranteeType": "Email" } ] }, "Name": "Default", "ThumbnailConfig": { "Bucket": "ets-example", "StorageClass": "ReducedRedundancy", "Permissions": [ { "Access": [ "FullControl" ], "Grantee": "marketing-promos@example.com", "GranteeType": "Email" } ] }, "Notifications": { "Completed": "arn:aws:sns:us-west-2:0123456789012:my-topic", "Warning": "arn:aws:sns:us-west-2:0123456789012:my-topic", "Progressing": "arn:aws:sns:us-west-2:0123456789012:my-topic", "Error": "arn:aws:sns:us-east-1:111222333444:ETS_Errors" }, "Role": "arn:aws:iam::123456789012:role/Elastic_Transcoder_Default_Role", "InputBucket": "ets-example", "Id": "1111111111111-abcde1", "Arn": "arn:aws:elastictranscoder:us-west-2:123456789012:pipeline/1111111111111-abcde1" } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 UpdatePipelineNotifications
。
-
下列程式碼範例示範如何使用 update-pipeline-status
。
- AWS CLI
-
更新 ElasticTranscoder 管道的狀態
此範例會更新指定 ElasticTranscoder 管道的狀態。
命令:
aws elastictranscoder update-pipeline-status --id
1111111111111-abcde1
--statusPaused
輸出:
{ "Pipeline": { "Status": "Paused", "ContentConfig": { "Bucket": "ets-example", "StorageClass": "Standard", "Permissions": [ { "Access": [ "FullControl" ], "Grantee": "marketing-promos@example.com", "GranteeType": "Email" } ] }, "Name": "Default", "ThumbnailConfig": { "Bucket": "ets-example", "StorageClass": "ReducedRedundancy", "Permissions": [ { "Access": [ "FullControl" ], "Grantee": "marketing-promos@example.com", "GranteeType": "Email" } ] }, "Notifications": { "Completed": "", "Warning": "", "Progressing": "", "Error": "arn:aws:sns:us-east-1:803981987763:ETS_Errors" }, "Role": "arn:aws:iam::123456789012:role/Elastic_Transcoder_Default_Role", "InputBucket": "ets-example", "Id": "1111111111111-abcde1", "Arn": "arn:aws:elastictranscoder:us-west-2:123456789012:pipeline/1111111111111-abcde1" } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 UpdatePipelineStatus
。
-
下列程式碼範例示範如何使用 update-pipeline
。
- AWS CLI
-
更新 ElasticTranscoder 管道
下列
update-pipeline
範例會更新指定的 ElasticTranscoder 管道。aws elastictranscoder update-pipeline \ --id
1111111111111-abcde1
--nameDefaultExample
\ --input-bucketsalesoffice.example.com-source
\ --rolearn:aws:iam::123456789012:role/Elastic_Transcoder_Default_Role
\ --notifications Progressing="",Completed="",Warning="",Error=arn:aws:sns:us-east-1:111222333444:ETS_Errors \ --content-configfile://content-config.json
\ --thumbnail-configfile://thumbnail-config.json
content-config.json
的內容:{ "Bucket":"salesoffice.example.com-public-promos", "Permissions":[ { "GranteeType":"Email", "Grantee":"marketing-promos@example.com", "Access":[ "FullControl" ] } ], "StorageClass":"Standard" }
thumbnail-config.json
的內容:{ "Bucket":"salesoffice.example.com-public-promos-thumbnails", "Permissions":[ { "GranteeType":"Email", "Grantee":"marketing-promos@example.com", "Access":[ "FullControl" ] } ], "StorageClass":"ReducedRedundancy" }
輸出:
{ "Pipeline": { "Status": "Active", "ContentConfig": { "Bucket": "ets-example", "StorageClass": "Standard", "Permissions": [ { "Access": [ "FullControl" ], "Grantee": "marketing-promos@example.com", "GranteeType": "Email" } ] }, "Name": "DefaultExample", "ThumbnailConfig": { "Bucket": "ets-example", "StorageClass": "ReducedRedundancy", "Permissions": [ { "Access": [ "FullControl" ], "Grantee": "marketing-promos@example.com", "GranteeType": "Email" } ] }, "Notifications": { "Completed": "", "Warning": "", "Progressing": "", "Error": "arn:aws:sns:us-east-1:111222333444:ETS_Errors" }, "Role": "arn:aws:iam::123456789012:role/Elastic_Transcoder_Default_Role", "InputBucket": "ets-example", "Id": "3333333333333-abcde3", "Arn": "arn:aws:elastictranscoder:us-west-2:123456789012:pipeline/3333333333333-abcde3" }, "Warnings": [ { "Message": "The SNS notification topic for Error events and the pipeline are in different regions, which increases processing time for jobs in the pipeline and can incur additional charges. To decrease processing time and prevent cross-regional charges, use the same region for the SNS notification topic and the pipeline.", "Code": "6006" } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 UpdatePipeline
。
-