MediaPackage VOD examples using Amazon CLI
The following code examples show you how to perform actions and implement common scenarios by using the Amazon Command Line Interface with MediaPackage VOD.
Actions are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios.
Each example includes a link to the complete source code, where you can find instructions on how to set up and run the code in context.
Topics
Actions
The following code example shows how to use create-asset.
- Amazon CLI
- 
             
                    To create an asset The following create-assetexample creates an asset namedChicken_Assetin the current Amazon account. The asset ingests the file30sec_chicken.smilto MediaPackage.aws mediapackage-vod create-asset \ --idchicken_asset\ --packaging-group-idhls_chicken_gp\ --source-role-arnarn:aws:iam::111122223333:role/EMP_Vod\ --source-arnarn:aws:s3::111122223333:video-bucket/A/30sec_chicken.smilOutput: { "Arn":"arn:aws:mediapackage-vod:us-west-2:111122223333:assets/chicken_asset", "Id":"chicken_asset", "PackagingGroupId":"hls_chicken_gp", "SourceArn":"arn:aws:s3::111122223333:video-bucket/A/30sec_chicken.smil", "SourceRoleArn":"arn:aws:iam::111122223333:role/EMP_Vod", "EgressEndpoints":[ { "PackagingConfigurationId":"New_config_1", "Url":"https://c75ea2668ab49d02bca7ae10ef31c59e.egress.mediapackage-vod.us-west-2.amazonaws.com/out/v1/6644b55df1744261ab3732a8e5cdaf07/904b06a58c7645e08d57d40d064216ac/f5b2e633ff4942228095d164c10074f3/index.m3u8" }, { "PackagingConfigurationId":"new_hls", "Url":" https://c75ea2668ab49d02bca7ae10ef31c59e.egress.mediapackage-vod.us-west-2.amazonaws.com/out/v1/6644b55df1744261ab3732a8e5cdaf07/fe8f1f00a80e424cb4f8da4095835e9e/7370ec57432343af816332356d2bd5c6/string.m3u8" } ] }For more information, see Ingest an Asset in the Amazon Elemental MediaPackage User Guide. - 
                    For API details, see CreateAsset in Amazon CLI Command Reference. 
 
- 
                    
The following code example shows how to use create-packaging-configuration.
- Amazon CLI
- 
             
                    To create a packaging configuration The following create-packaging-configurationexample creates a packaging configuration namednew_hlsin the packaging group namedhls_chicken. This example uses a file on disk namedhls_pc.jsonto provide the details.aws mediapackage-vod create-packaging-configuration \ --idnew_hls\ --packaging-group-idhls_chicken\ --hls-packagefile://hls_pc.jsonContents of hls_pc.json:{ "HlsManifests":[ { "AdMarkers":"NONE", "IncludeIframeOnlyStream":false, "ManifestName":"string", "ProgramDateTimeIntervalSeconds":60, "RepeatExtXKey":true, "StreamSelection":{ "MaxVideoBitsPerSecond":1000, "MinVideoBitsPerSecond":0, "StreamOrder":"ORIGINAL" } } ], "SegmentDurationSeconds":6, "UseAudioRenditionGroup":false }Output: { "Arn":"arn:aws:mediapackage-vod:us-west-2:111122223333:packaging-configurations/new_hls", "Id":"new_hls", "PackagingGroupId":"hls_chicken", "HlsManifests":{ "SegmentDurationSeconds":6, "UseAudioRenditionGroup":false, "HlsMarkers":[ { "AdMarkers":"NONE", "IncludeIframeOnlyStream":false, "ManifestName":"string", "ProgramDateTimeIntervalSeconds":60, "RepeatExtXKey":true, "StreamSelection":{ "MaxVideoBitsPerSecond":1000, "MinVideoBitsPerSecond":0, "StreamOrder":"ORIGINAL" } } ] } }For more information, see Creating a Packaging Configuration in the Amazon Elemental MediaPackage User Guide. - 
                    For API details, see CreatePackagingConfiguration in Amazon CLI Command Reference. 
 
- 
                    
The following code example shows how to use create-packaging-group.
- Amazon CLI
- 
             
                    To create a packaging group The following create-packaging-groupexample lists all of the packaging groups that are configured in the current Amazon account.aws mediapackage-vod create-packaging-group \ --idhls_chickenOutput: { "Arn": "arn:aws:mediapackage-vod:us-west-2:111122223333:packaging-groups/hls_chicken", "Id": "hls_chicken" }For more information, see Creating a Packaging Group in the Amazon Elemental MediaPackage User Guide. - 
                    For API details, see CreatePackagingGroup in Amazon CLI Command Reference. 
 
- 
                    
The following code example shows how to use delete-asset.
- Amazon CLI
- 
             
                    To delete an asset The following delete-assetexample deletes the asset named30sec_chicken.aws mediapackage-vod delete-asset \ --id30sec_chickenThis command produces no output. For more information, see Deleting an Asset in the Amazon Elemental MediaPackage User Guide. - 
                    For API details, see DeleteAsset in Amazon CLI Command Reference. 
 
- 
                    
The following code example shows how to use delete-packaging-configuration.
- Amazon CLI
- 
             
                    To delete a packaging configuration The following delete-packaging-configurationexample deletes the packaging configuration namedCMAF.aws mediapackage-vod delete-packaging-configuration \ --idCMAFThis command produces no output. For more information, see Deleting a Packaging Configuration in the Amazon Elemental MediaPackage User Guide. - 
                    For API details, see DeletePackagingConfiguration in Amazon CLI Command Reference. 
 
- 
                    
The following code example shows how to use delete-packaging-group.
- Amazon CLI
- 
             
                    To delete a packaging group The following delete-packaging-groupexample deletes the packaging group namedDash_widevine.aws mediapackage-vod delete-packaging-group \ --idDash_widevineThis command produces no output. For more information, see Deleting a Packaging Group in the Amazon Elemental MediaPackage User Guide. - 
                    For API details, see DeletePackagingGroup in Amazon CLI Command Reference. 
 
- 
                    
The following code example shows how to use describe-asset.
- Amazon CLI
- 
             
                    To describe an asset The following describe-assetexample displays all of the details of the asset named30sec_chicken.aws mediapackage-vod describe-asset \ --id30sec_chickenOutput: { "Arn":"arn:aws:mediapackage-vod:us-west-2:111122223333:assets/30sec_chicken", "Id":"30sec_chicken", "PackagingGroupId":"Packaging_group_1", "SourceArn":"arn:aws:s3::111122223333:video-bucket/A/30sec_chicken.smil", "SourceRoleArn":"arn:aws:iam::111122223333:role/EMP_Vod", "EgressEndpoints":[ { "PackagingConfigurationId":"DASH", "Url":"https://a5f46a44118ba3e3724ef39ef532e701.egress.mediapackage-vod.us-west-2.amazonaws.com/out/v1/aad7962c569946119c2d5a691be5663c/66c25aff456d463aae0855172b3beb27/4ddfda6da17c4c279a1b8401cba31892/index.mpd" }, { "PackagingConfigurationId":"HLS", "Url":"https://a5f46a44118ba3e3724ef39ef532e701.egress.mediapackage-vod.us-west-2.amazonaws.com/out/v1/aad7962c569946119c2d5a691be5663c/6e5bf286a3414254a2bf0d22ae148d7e/06b5875b4d004c3cbdc4da2dc4d14638/index.m3u8" }, { "PackagingConfigurationId":"CMAF", "Url":"https://a5f46a44118ba3e3724ef39ef532e701.egress.mediapackage-vod.us-west-2.amazonaws.com/out/v1/aad7962c569946119c2d5a691be5663c/628fb5d8d89e4702958b020af27fde0e/05eb062214064238ad6330a443aff7f7/index.m3u8" } ] }For more information, see Viewing Asset Details in the Amazon Elemental MediaPackage User Guide. - 
                    For API details, see DescribeAsset in Amazon CLI Command Reference. 
 
- 
                    
The following code example shows how to use describe-packaging-configuration.
- Amazon CLI
- 
             
                    To describe a packaging configuration The following describe-packaging-configurationexample displays all of the details of the packaging configuration namedDASH.aws mediapackage-vod describe-packaging-configuration \ --idDASHOutput: { "Arn":"arn:aws:mediapackage-vod:us-west-2:111122223333:packaging-configurations/DASH", "Id":"DASH", "PackagingGroupId":"Packaging_group_1", "DashPackage":[ { "SegmentDurationSeconds":"2" }, { "DashManifests":{ "ManifestName":"index", "MinBufferTimeSeconds":"30", "Profile":"NONE" } } ] }For more information, see Viewing Packaging Configuration Details in the Amazon Elemental MediaPackage User Guide. - 
                    For API details, see DescribePackagingConfiguration in Amazon CLI Command Reference. 
 
- 
                    
The following code example shows how to use describe-packaging-group.
- Amazon CLI
- 
             
                    To describe a packaging group The following describe-packaging-groupexample displays all of the details of the packaging group namedPackaging_group_1.aws mediapackage-vod describe-packaging-group \ --idPackaging_group_1Output: { "Arn": "arn:aws:mediapackage-vod:us-west-2:111122223333:packaging-groups/Packaging_group_1", "Id": "Packaging_group_1" }For more information, see Viewing Packaging Group Details in the Amazon Elemental MediaPackage User Guide. - 
                    For API details, see DescribePackagingGroup in Amazon CLI Command Reference. 
 
- 
                    
The following code example shows how to use list-assets.
- Amazon CLI
- 
             
                    To list all assets The following list-assetsexample lists all of the assets that are configured in the current Amazon account.aws mediapackage-vod list-assetsOutput: { "Assets": [ "Arn": "arn:aws:mediapackage-vod:us-west-2:111122223333:assets/30sec_chicken", "Id": "30sec_chicken", "PackagingGroupId": "Packaging_group_1", "SourceArn": "arn:aws:s3::111122223333:video-bucket/A/30sec_chicken.smil", "SourceRoleArn": "arn:aws:iam::111122223333:role/EMP_Vod" ] }For more information, see Viewing Asset Details in the Amazon Elemental MediaPackage User Guide. - 
                    For API details, see ListAssets in Amazon CLI Command Reference. 
 
- 
                    
The following code example shows how to use list-packaging-configurations.
- Amazon CLI
- 
             
                    To list all packaging configurations The following list-packaging-configurationsexample lists all of the packaging configurations that are configured on the packaging group namedPackaging_group_1.aws mediapackage-vod list-packaging-configurations \ --packaging-group-idPackaging_group_1Output: { "PackagingConfigurations":[ { "Arn":"arn:aws:mediapackage-vod:us-west-2:111122223333:packaging-configurations/CMAF", "Id":"CMAF", "PackagingGroupId":"Packaging_group_1", "CmafPackage":[ { "SegmentDurationSeconds":"2" }, { "HlsManifests":{ "AdMarkers":"NONE", "RepeatExtXKey":"False", "ManifestName":"index", "ProgramDateTimeIntervalSeconds":"0", "IncludeIframeOnlyStream":"False" } } ] }, { "Arn":"arn:aws:mediapackage-vod:us-west-2:111122223333:packaging-configurations/DASH", "Id":"DASH", "PackagingGroupId":"Packaging_group_1", "DashPackage":[ { "SegmentDurationSeconds":"2" }, { "DashManifests":{ "ManifestName":"index", "MinBufferTimeSeconds":"30", "Profile":"NONE" } } ] }, { "Arn":"arn:aws:mediapackage-vod:us-west-2:111122223333:packaging-configurations/HLS", "Id":"HLS", "PackagingGroupId":"Packaging_group_1", "HlsPackage":[ { "SegmentDurationSeconds":"6", "UseAudioRenditionGroup":"False" }, { "HlsManifests":{ "AdMarkers":"NONE", "RepeatExtXKey":"False", "ManifestName":"index", "ProgramDateTimeIntervalSeconds":"0", "IncludeIframeOnlyStream":"False" } } ] }, { "Arn":"arn:aws:mediapackage-vod:us-west-2:111122223333:packaging-configurations/New_config_0_copy", "Id":"New_config_0_copy", "PackagingGroupId":"Packaging_group_1", "HlsPackage":[ { "SegmentDurationSeconds":"6", "UseAudioRenditionGroup":"False" }, { "Encryption":{ "EncryptionMethod":"AWS_128", "SpekeKeyProvider":{ "RoleArn":"arn:aws:iam:111122223333::role/SPEKERole", "Url":"https://lfgubdvs97.execute-api.us-west-2.amazonaws.com/EkeStage/copyProtection/", "SystemIds":[ "81376844-f976-481e-a84e-cc25d39b0b33" ] } } }, { "HlsManifests":{ "AdMarkers":"NONE", "RepeatExtXKey":"False", "ManifestName":"index", "ProgramDateTimeIntervalSeconds":"0", "IncludeIframeOnlyStream":"False" } } ] } ] }For more information, see Viewing Packaging Configuration Details in the Amazon Elemental MediaPackage User Guide. - 
                    For API details, see ListPackagingConfigurations in Amazon CLI Command Reference. 
 
- 
                    
The following code example shows how to use list-packaging-groups.
- Amazon CLI
- 
             
                    To list all packaging groups The following list-packaging-groupsexample lists all of the packaging groups that are configured in the current Amazon account.aws mediapackage-vod list-packaging-groupsOutput: { "PackagingGroups": [ { "Arn": "arn:aws:mediapackage-vod:us-west-2:111122223333:packaging-groups/Dash_widevine", "Id": "Dash_widevine" }, { "Arn": "arn:aws:mediapackage-vod:us-west-2:111122223333:packaging-groups/Encrypted_HLS", "Id": "Encrypted_HLS" }, { "Arn": "arn:aws:mediapackage-vod:us-west-2:111122223333:packaging-groups/Packaging_group_1", "Id": "Packaging_group_1" } ] }For more information, see Viewing Packaging Group Details in the Amazon Elemental MediaPackage User Guide. - 
                    For API details, see ListPackagingGroups in Amazon CLI Command Reference. 
 
-