

# 使用 AWS CLI 的 Amazon IVS 示例
<a name="cli_ivs_code_examples"></a>

以下代码示例演示如何通过将 AWS Command Line Interface与 Amazon IVS 结合使用，来执行操作和实现常见场景。

*操作是大型程序的代码摘录*，必须在上下文中运行。您可以通过操作了解如何调用单个服务函数，还可以通过函数相关场景的上下文查看操作。

每个示例都包含一个指向完整源代码的链接，您可以从中找到有关如何在上下文中设置和运行代码的说明。

**Topics**
+ [操作](#actions)

## 操作
<a name="actions"></a>

### `batch-get-channel`
<a name="ivs_BatchGetChannel_cli_topic"></a>

以下代码示例演示了如何使用 `batch-get-channel`。

**AWS CLI**  
**获取有关多个通道的通道配置信息**  
以下 `batch-get-channel` 示例列出有关指定通道的信息。  

```
aws ivs batch-get-channel \
    --arns arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh \
        arn:aws:ivs:us-west-2:123456789012:channel/efghEFGHijkl
```
输出：  

```
{
    "channels": [
        {
            "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
            "authorized": false,
            "containerFormat": "TS",
            "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
            "insecureIngest": false,
            "latencyMode": "LOW",
            "multitrackInputConfiguration": {
                "enabled": false,
                "maximumResolution": "FULL_HD",
                "policy": "ALLOW"
            },
            "name": "channel-1",
            "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel-1.abcdEFGH.m3u8",
            "preset": "",
            "playbackRestrictionPolicyArn": "",
            "recordingConfigurationArn": "arn:aws:ivs:us-west-2:123456789012:recording-configuration/ABCD12cdEFgh",
            "srt": {
                "endpoint": "a1b2c3d4e5f6.srt.live-video.net",
                "passphrase": "AB1C2defGHijkLMNo3PqQRstUvwxyzaBCDEfghh4ijklMN5opqrStuVWxyzAbCDEfghIJ"
            },
            "tags": {},
            "type": "STANDARD"
        },
        {
            "arn": "arn:aws:ivs:us-west-2:123456789012:channel/efghEFGHijkl",
            "authorized": false,
            "containerFormat": "FRAGMENTED_MP4",
            "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
            "insecureIngest": false,
            "latencyMode": "LOW",
            "multitrackInputConfiguration": {
                "enabled": true,
                "maximumResolution": "FULL_HD",
                "policy": "ALLOW"
            },
            "name": "channel-2",
            "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel-2.abcdEFGH.m3u8",
            "preset": "",
            "playbackRestrictionPolicyArn": "arn:aws:ivs:us-west-2:123456789012:playback-restriction-policy/ABcdef34ghIJ"",
            "recordingConfigurationArn": "",
            "srt": {
                "endpoint": "a1b2c3d4e5f6.srt.live-video.net",
                "passphrase": "BA1C2defGHijkLMNo3PqQRstUvwxyzaBCDEfghh4ijklMN5opqrStuVWxyzAbCDEfghIJ"
            },
            "tags": {},
            "type": "STANDARD"
        }
    ]
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [BatchGetChannel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/batch-get-channel.html)。

### `batch-get-stream-key`
<a name="ivs_BatchGetStreamKey_cli_topic"></a>

以下代码示例演示了如何使用 `batch-get-stream-key`。

**AWS CLI**  
**获取有关多个直播密钥的信息**  
以下 `batch-get-stream-key` 示例获取有关指定直播密钥的信息。  

```
aws ivs batch-get-stream-key \
    --arns arn:aws:ivs:us-west-2:123456789012:stream-key/skSKABCDefgh \
       arn:aws:ivs:us-west-2:123456789012:stream-key/skSKIJKLmnop
```
输出：  

```
{
    "streamKeys": [
        {
            "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/skSKABCDefgh",
            "value": "sk_us-west-2_abcdABCDefgh_567890abcdef",
            "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
            "tags": {}
        },
        {
            "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/skSKIJKLmnop",
            "value": "sk_us-west-2_abcdABCDefgh_567890ghijkl",
            "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
            "tags": {}
        }
     ]
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [BatchGetStreamKey](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/batch-get-stream-key.html)。

### `batch-start-viewer-session-revocation`
<a name="ivs_BatchStartViewerSessionRevocation_cli_topic"></a>

以下代码示例演示了如何使用 `batch-start-viewer-session-revocation`。

**AWS CLI**  
**撤消多个 channel-ARN 和 viewer-ID 对的观看者会话**  
以下 `batch-start-viewer-session-revocation` 示例同时对多个 channel-ARN 和 viewer-ID 对执行会话撤销。如果调用者无权撤消指定会话，则请求可能正常完成，但会在错误字段中返回值。  

```
aws ivs batch-start-viewer-session-revocation \
    --viewer-sessions '[{"channelArn":"arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh1","viewerId":"abcdefg1","viewerSessionVersionsLessThanOrEqualTo":1234567890}, \
      {"channelArn":"arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh2","viewerId":"abcdefg2","viewerSessionVersionsLessThanOrEqualTo":1234567890}]'
```
输出：  

```
{
    "errors": [
        {
            "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh1",
            "viewerId": "abcdefg1",
            "code": "403",
            "message": "not authorized",
        },
        {
            "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh2",
            "viewerId": "abcdefg2",
            "code": "403",
            "message": "not authorized",
        }
    ]
}
```
有关更多信息，请参阅《Amazon Interactive Video Service 用户指南》**中的[设置私有通道](https://docs.aws.amazon.com/ivs/latest/userguide/private-channels.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》中的 [BatchStartViewerSessionRevocation](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/batch-start-viewer-session-revocation.html)。**

### `create-channel`
<a name="ivs_CreateChannel_cli_topic"></a>

以下代码示例演示了如何使用 `create-channel`。

**AWS CLI**  
**示例 1：创建没有录制的通道**  
以下 `create-channel` 示例创建了一个新通道和关联的直播流密钥以启动直播。  

```
aws ivs create-channel \
    --name 'test-channel' \
    --no-insecure-ingest
```
输出：  

```
{
    "channel": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "authorized": false,
        "containerFormat": "TS",
        "name": "test-channel",
        "latencyMode": "LOW",
        "multitrackInputConfiguration": {
            "enabled": false,
            "maximumResolution": "FULL_HD",
            "policy": "ALLOW"
        },
        "playbackRestrictionPolicyArn": "",
        "recordingConfigurationArn": "",
        "srt": {
            "endpoint": "a1b2c3d4e5f6.srt.live-video.net",
            "passphrase": "AB1C2defGHijkLMNo3PqQRstUvwxyzaBCDEfghh4ijklMN5opqrStuVWxyzAbCDEfghIJ"
        },
        "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
        "insecureIngest": false,
        "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8",
        "preset": "",
        "tags": {},
        "type": "STANDARD"
    },
    "streamKey": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/g1H2I3j4k5L6",
        "value": "sk_us-west-2_abcdABCDefgh_567890abcdef",
        "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "tags": {}
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
**示例 2：使用通过 ARN 指定的 RecordingConfiguration 资源来创建启动了录制的通道**  
以下 `create-channel` 示例创建一个新通道和关联的直播密钥来启动直播，并为通道设置了录制：  

```
aws ivs create-channel \
    --name test-channel-with-recording \
    --insecure-ingest \
    --recording-configuration-arn 'arn:aws:ivs:us-west-2:123456789012:recording-configuration/ABCD12cdEFgh'
```
输出：  

```
{
    "channel": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "containerFormat": "TS",
        "name": "test-channel-with-recording",
        "latencyMode": "LOW",
        "multitrackInputConfiguration": {
            "enabled": false,
            "maximumResolution": "FULL_HD",
            "policy": "ALLOW"
        },
        "type": "STANDARD",
        "playbackRestrictionPolicyArn": "",
        "recordingConfigurationArn": "arn:aws:ivs:us-west-2:123456789012:recording-configuration/ABCD12cdEFgh",
        "srt": {
            "endpoint": "a1b2c3d4e5f6.srt.live-video.net",
            "passphrase": "BA1C2defGHijkLMNo3PqQRstUvwxyzaBCDEfghh4ijklMN5opqrStuVWxyzAbCDEfghIJ"
        },
        "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
        "insecureIngest": true,
        "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8",
        "preset": "",
        "authorized": false,
        "tags": {},
        "type": "STANDARD"
    },
    "streamKey": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/abcdABCDefgh",
        "value": "sk_us-west-2_abcdABCDefgh_567890abcdef",
        "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "tags": {}
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[录制到 Amazon S3](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/record-to-s3.html)。  
**示例 3：使用通过 ARN 指定的播放限制策略创建通道**  
以下 `create-channel` 示例创建一个新通道和关联的直播密钥来启动直播，并为通道设置了播放限制策略：  

```
aws ivs create-channel \
    --name test-channel-with-playback-restriction-policy\
    --insecure-ingest \
    --playback-restriction-policy-arn 'arn:aws:ivs:us-west-2:123456789012:playback-restriction-policy/ABcdef34ghIJ'
```
输出：  

```
{
    "channel": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "containerFormat": "TS",
        "name": "test-channel-with-playback-restriction-policy",
        "latencyMode": "LOW",
        "multitrackInputConfiguration": {
            "enabled": false,
            "maximumResolution": "FULL_HD",
            "policy": "ALLOW"
        },
        "type": "STANDARD",
        "playbackRestrictionPolicyArn": "arn:aws:ivs:us-west-2:123456789012:playback-restriction-policy/ABcdef34ghIJ",
        "recordingConfigurationArn": "",
        "srt": {
            "endpoint": "a1b2c3d4e5f6.srt.live-video.net",
            "passphrase": "AB1C2edfGHijkLMNo3PqQRstUvwxyzaBCDEfghh4ijklMN5opqrStuVWxyzAbCDEfghIJ"
        },
        "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
        "insecureIngest": true,
        "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8",
        "preset": "",
        "authorized": false,
        "tags": {},
        "type": "STANDARD"
    },
    "streamKey": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/abcdABCDefgh",
        "value": "sk_us-west-2_abcdABCDefgh_567890abcdef",
        "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "tags": {}
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[不想要的内容和观看者](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/undesired-content.html)。  
**示例 4：创建启用了多轨道的通道**  
以下 `create-channel` 示例创建一个新通道和关联的直播流密钥以启动直播，并启用多轨道。  

```
aws ivs create-channel \
    --name 'test-channel' \
    --no-insecure-ingest \
    --container-format 'FRAGMENTED_MP4' \
    --multitrack-input-configuration '{"enabled": true,"maximumResolution": "FULL_HD","policy": "ALLOW"}'
```
输出：  

```
{
    "channel": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "authorized": false,
        "containerFormat": "FRAGMENTED_MP4",
        "name": "test-channel",
        "latencyMode": "LOW",
        "multitrackInputConfiguration": {
            "enabled": true,
            "maximumResolution": "FULL_HD",
            "policy": "ALLOW"
        },
        "playbackRestrictionPolicyArn": "",
        "recordingConfigurationArn": "",
        "srt": {
            "endpoint": "a1b2c3d4e5f6.srt.live-video.net",
            "passphrase": "AB1C2defGHijkLMNo3PqQRstUvwxyzaBCDEfghh4ijklMN5opqrStuVWxyzAbCDEfghIJ"
        },
        "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
        "insecureIngest": false,
        "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8",
        "preset": "",
        "tags": {},
        "type": "STANDARD"
    },
    "streamKey": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/g1H2I3j4k5L6",
        "value": "sk_us-west-2_abcdABCDefgh_567890abcdef",
        "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "tags": {}
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/multitrack-video.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [CreateChannel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/create-channel.html)。

### `create-playback-restriction-policy`
<a name="ivs_CreatePlaybackRestrictionPolicy_cli_topic"></a>

以下代码示例演示了如何使用 `create-playback-restriction-policy`。

**AWS CLI**  
**创建播放限制策略**  
以下 `create-playback-restriction-policy` 示例创建新的播放限制策略。  

```
aws ivs create-playback-restriction-policy \
    --name "test-playback-restriction-policy" \
    --enable-strict-origin-enforcement \
    --tags "key1=value1, key2=value2" \
    --allowed-countries US MX \
    --allowed-origins https://www.website1.com https://www.website2.com
```
输出：  

```
{
    "playbackRestrictionPolicy": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:playback-restriction-policy/ABcdef34ghIJ",
        "allowedCountries": [
            "US",
            "MX"
        ],
        "allowedOrigins": [
            "https://www.website1.com",
            "https://www.website2.com"
        ],
        "enableStrictOriginEnforcement": true,
        "name": "test-playback-restriction-policy",
        "tags": {
            "key1": "value1",
            "key2": "value2"
        }
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[不想要的内容和观看者](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/undesired-content.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [CreatePlaybackRestrictionPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/create-playback-restriction-policy.html)。

### `create-recording-configuration`
<a name="ivs_CreateRecordingConfiguration_cli_topic"></a>

以下代码示例演示了如何使用 `create-recording-configuration`。

**AWS CLI**  
**创建 RecordingConfiguration 资源**  
以下 `create-recording-configuration` 示例创建 RecordingConfiguration 资源以启用录制到 Amazon S3。  

```
aws ivs create-recording-configuration \
    --name "test-recording-config" \
    --recording-reconnect-window-seconds 60 \
    --tags "key1=value1, key2=value2" \
    --rendition-configuration renditionSelection="CUSTOM",renditions="HD" \
    --thumbnail-configuration recordingMode="INTERVAL",targetIntervalSeconds=1,storage="LATEST",resolution="LOWEST_RESOLUTION" \
    --destination-configuration s3={bucketName=demo-recording-bucket}
```
输出：  

```
{
    "recordingConfiguration": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:recording-configuration/ABcdef34ghIJ",
        "name": "test-recording-config",
        "destinationConfiguration": {
            "s3": {
                "bucketName": "demo-recording-bucket"
            }
        },
        "state": "CREATING",
        "tags": {
            "key1": "value1",
            "key2": "value2"
        },
        "thumbnailConfiguration": {
            "recordingMode": "INTERVAL",
            "targetIntervalSeconds": 1,
            "resolution": "LOWEST_RESOLUTION",
            "storage": [
                "LATEST"
            ]
        },
        "recordingReconnectWindowSeconds": 60,
        "renditionConfiguration": {
            "renditionSelection": "CUSTOM",
            "renditions": [
                "HD"
            ]
        }
    }
}
```
有关更多信息，请参阅《Amazon Interactive Video Service 用户指南》**中的[录制到 Amazon S3](https://docs.aws.amazon.com/ivs/latest/userguide/record-to-s3.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [CreateRecordingConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/create-recording-configuration.html)。

### `create-stream-key`
<a name="ivs_CreateStreamKey_cli_topic"></a>

以下代码示例演示了如何使用 `create-stream-key`。

**AWS CLI**  
**创建直播密钥**  
以下 `create-stream-key` 示例为指定 ARN（Amazon 资源名称）创建直播密钥。  

```
aws ivs create-stream-key \
    --channel-arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh
```
输出：  

```
{
    "streamKey": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/abcdABCDefgh",
        "value": "sk_us-west-2_abcdABCDefgh_567890abcdef",
        "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "tags": {}
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [CreateStreamKey](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/create-stream-key.html)。

### `delete-channel`
<a name="ivs_DeleteChannel_cli_topic"></a>

以下代码示例演示了如何使用 `delete-channel`。

**AWS CLI**  
**删除通道及其关联的直播密钥**  
以下 `delete-channel` 示例删除具有指定 ARN（Amazon 资源名称）的通道。  

```
aws ivs delete-channel \
    --arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh
```
此命令不生成任何输出。  
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [DeleteChannel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/delete-channel.html)。

### `delete-playback-key-pair`
<a name="ivs_DeletePlaybackKeyPair_cli_topic"></a>

以下代码示例演示了如何使用 `delete-playback-key-pair`。

**AWS CLI**  
**删除指定的播放密钥对**  
以下 `delete-playback-key-pair` 示例返回指定密钥对的指纹。  

```
aws ivs delete-playback-key-pair \
    --arn arn:aws:ivs:us-west-2:123456789012:playback-key/abcd1234efgh
```
此命令不生成任何输出。  
有关更多信息，请参阅《Amazon Interactive Video Service 用户指南》**中的[设置私有通道](https://docs.aws.amazon.com/ivs/latest/userguide/private-channels.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [DeletePlaybackKeyPair](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/delete-playback-key-pair.html)。

### `delete-playback-restriction-policy`
<a name="ivs_DeletePlaybackRestrictionPolicy_cli_topic"></a>

以下代码示例演示了如何使用 `delete-playback-restriction-policy`。

**AWS CLI**  
**删除播放限制策略**  
以下 `delete-playback-restriction-policy` 示例删除具有指定策略 ARN（Amazon 资源名称）的播放限制策略。  

```
aws ivs delete-playback-restriction-policy \
    --arn "arn:aws:ivs:us-west-2:123456789012:playback-restriction-policy/ABcdef34ghIJ"
```
此命令不生成任何输出。  
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[不想要的内容和观看者](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/undesired-content.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [DeletePlaybackRestrictionPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/delete-playback-restriction-policy.html)。

### `delete-recording-configuration`
<a name="ivs_DeleteRecordingConfiguration_cli_topic"></a>

以下代码示例演示了如何使用 `delete-recording-configuration`。

**AWS CLI**  
**删除通过 ARN 指定的 RecordingConfiguration 资源**  
以下 `delete-recording-configuration` 示例删除具有指定 ARN 的 RecordingConfiguration 资源。  

```
aws ivs delete-recording-configuration \
    --arn "arn:aws:ivs:us-west-2:123456789012:recording-configuration/ABcdef34ghIJ"
```
此命令不生成任何输出。  
有关更多信息，请参阅《Amazon Interactive Video Service 用户指南》**中的[录制到 Amazon S3](https://docs.aws.amazon.com/ivs/latest/userguide/record-to-s3.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [DeleteRecordingConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/delete-recording-configuration.html)。

### `delete-stream-key`
<a name="ivs_DeleteStreamKey_cli_topic"></a>

以下代码示例演示了如何使用 `delete-stream-key`。

**AWS CLI**  
**删除直播密钥**  
以下 `delete-stream-key` 示例删除了指定 ARN（Amazon 资源名称）的直播密钥，因此该密钥不能再用于直播。  

```
aws ivs delete-stream-key \
    --arn arn:aws:ivs:us-west-2:123456789012:stream-key/g1H2I3j4k5L6
```
此命令不生成任何输出。  
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [DeleteStreamKey](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/delete-stream-key.html)。

### `get-channel`
<a name="ivs_GetChannel_cli_topic"></a>

以下代码示例演示了如何使用 `get-channel`。

**AWS CLI**  
**获取通道的配置信息**  
以下 `get-channel` 示例获取指定通道 ARN（Amazon 资源名称）的通道配置。  

```
aws ivs get-channel \
    --arn 'arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh'
```
输出：  

```
{
    "channel": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "authorized": false,
        "containerFormat": "TS",
        "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
        "insecureIngest": false,
        "latencyMode": "LOW",
        "multitrackInputConfiguration": {
            "enabled": false,
            "maximumResolution": "FULL_HD",
            "policy": "ALLOW"
        },
        "name": "channel-1",
        "playbackRestrictionPolicyArn": "",
        "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8",
        "preset": "",
        "recordingConfigurationArn": "",
        "srt": {
            "endpoint": "a1b2c3d4e5f6.srt.live-video.net",
            "passphrase": "AB1C2defGHijkLMNo3PqQRstUvwxyzaBCDEfghh4ijklMN5opqrStuVWxyzAbCDEfghIJ"
        },
        "tags": {}
        "type": "STANDARD",
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [GetChannel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/get-channel.html)。

### `get-playback-key-pair`
<a name="ivs_GetPlaybackKeyPair_cli_topic"></a>

以下代码示例演示了如何使用 `get-playback-key-pair`。

**AWS CLI**  
**获取指定的播放密钥对**  
以下 `get-playback-key-pair` 示例返回指定密钥对的指纹。  

```
aws ivs get-playback-key-pair \
    --arn arn:aws:ivs:us-west-2:123456789012:playback-key/abcd1234efgh
```
输出：  

```
{
    "keyPair": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:playback-key/abcd1234efgh",
        "name": "my-playback-key",
        "fingerprint": "0a:1b:2c:ab:cd:ef:34:56:70:b1:b2:71:01:2a:a3:72",
        "tags": {}
    }
}
```
有关更多信息，请参阅《Amazon Interactive Video Service 用户指南》**中的[设置私有通道](https://docs.aws.amazon.com/ivs/latest/userguide//private-channels.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [GetPlaybackKeyPair](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/get-playback-key-pair.html)。

### `get-playback-restriction-policy`
<a name="ivs_GetPlaybackRestrictionPolicy_cli_topic"></a>

以下代码示例演示了如何使用 `get-playback-restriction-policy`。

**AWS CLI**  
**获取播放限制策略的配置信息**  
以下 `get-playback-restriction-policy` 示例获取具有指定策略 ARN（Amazon 资源名称）的播放限制策略配置。  

```
aws ivs get-playback-restriction-policy \
    --arn "arn:aws:ivs:us-west-2:123456789012:playback-restriction-policy/ABcdef34ghIJ"
```
输出：  

```
{
    "playbackRestrictionPolicy": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:playback-restriction-policy/ABcdef34ghIJ",
        "allowedCountries": [
            "US",
            "MX"
        ],
        "allowedOrigins": [
            "https://www.website1.com",
            "https://www.website2.com"
        ],
        "enableStrictOriginEnforcement": true,
        "name": "test-playback-restriction-policy",
        "tags": {
            "key1": "value1",
            "key2": "value2"
        }
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[不想要的内容和观看者](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/undesired-content.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [GetPlaybackRestrictionPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/get-playback-restriction-policy.html)。

### `get-recording-configuration`
<a name="ivs_GetRecordingConfiguration_cli_topic"></a>

以下代码示例演示了如何使用 `get-recording-configuration`。

**AWS CLI**  
**获取有关 RecordingConfiguration 资源的信息**  
以下 `get-recording-configuration` 示例获取指定 ARN 的 RecordingConfiguration 资源信息。  

```
aws ivs get-recording-configuration \
    --arn "arn:aws:ivs:us-west-2:123456789012:recording-configuration/ABcdef34ghIJ"
```
输出：  

```
{
    "recordingConfiguration": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:recording-configuration/ABcdef34ghIJ",
        "destinationConfiguration": {
            "s3": {
                "bucketName": "demo-recording-bucket"
            }
        },
        "name": "test-recording-config",
        "recordingReconnectWindowSeconds": 60,
        "state": "ACTIVE",
        "tags": {
            "key1" : "value1",
            "key2" : "value2"
        },
        "thumbnailConfiguration": {
            "recordingMode": "INTERVAL",
            "targetIntervalSeconds": 1,
            "resolution": "LOWEST_RESOLUTION",
            "storage": [
                "LATEST"
            ]
        },
        "renditionConfiguration": {
            "renditionSelection": "CUSTOM",
            "renditions": [
                "HD"
            ]
        }
    }
}
```
有关更多信息，请参阅《Amazon Interactive Video Service 用户指南》**中的[录制到 Amazon S3](https://docs.aws.amazon.com/ivs/latest/userguide/record-to-s3.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [GetRecordingConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/get-recording-configuration.html)。

### `get-stream-key`
<a name="ivs_GetStreamKey_cli_topic"></a>

以下代码示例演示了如何使用 `get-stream-key`。

**AWS CLI**  
**获取有关直播的信息**  
以下 `get-stream-key` 示例获取有关指定直播密钥的信息。  

```
aws ivs get-stream-key \
    --arn arn:aws:ivs:us-west-2:123456789012:stream-key/skSKABCDefgh --region=us-west-2
```
输出：  

```
{
    "streamKey": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/skSKABCDefgh",
        "value": "sk_us-west-2_abcdABCDefgh_567890abcdef",
        "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "tags": {}
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [GetStreamKey](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/get-stream-key.html)。

### `get-stream-session`
<a name="ivs_GetStreamSession_cli_topic"></a>

以下代码示例演示了如何使用 `get-stream-session`。

**AWS CLI**  
**获取指定直播的元数据**  
以下 `get-stream-session` 示例获取指定通道 ARN（Amazon 资源名称）和指定直播的元数据配置；如果未提供 `streamId`，则会选择通道的最近直播。  

```
aws ivs get-stream-session \
    --channel-arn 'arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh' \
    --stream-id 'mystream'
```
输出：  

```
{
    "streamSession": {
        "streamId": "mystream1",
        "startTime": "2023-06-26T19:09:28+00:00",
        "channel": {
            "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
            "name": "mychannel",
            "latencyMode": "LOW",
            "type": "STANDARD",
            "recordingConfigurationArn": "arn:aws:ivs:us-west-2:123456789012:recording-configuration/ABcdef34ghIJ",
            "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
            "playbackUrl": "url-string",
            "authorized": false,
            "insecureIngest": false,
            "preset": ""
        },
        "ingestConfiguration": {
            "audio": {
                "channels": 2,
                "codec": "mp4a.40.2",
                "sampleRate": 8000,
                "targetBitrate": 46875,
                "track": "Track0"
            },
            "video": {
                "avcProfile": "Baseline",
                "avcLevel": "4.2",
                "codec": "avc1.42C02A",
                "encoder": "Lavf58.45.100",
                "level": "4.2",
                "profile": "Baseline",
                "targetBitrate": 8789062,
                "targetFramerate": 60,
                "track": "Track0",
                "videoHeight": 1080,
                "videoWidth": 1920
            }
        },
        "ingestConfigurations": {
            "audioConfigurations": [
                {
                    "channels": 2,
                    "codec": "mp4a.40.2",
                    "sampleRate": 8000,
                    "targetBitrate": 46875,
                    "track": "Track0"
                }
            ],
            "videoConfigurations": [
                {
                    "codec": "avc1.42C02A",
                    "encoder": "Lavf58.45.100",
                    "level": "4.2",
                    "profile": "Baseline",
                    "targetBitrate": 8789062,
                    "targetFramerate": 60,
                    "track": "Track0",
                    "videoHeight": 1080,
                    "videoWidth": 1920
                }
            ]
        },
        "recordingConfiguration": {
            "arn": "arn:aws:ivs:us-west-2:123456789012:recording-configuration/ABcdef34ghIJ",
            "name": "test-recording-config",
            "destinationConfiguration": {
                "s3": {
                    "bucketName": "demo-recording-bucket"
                }
            },
            "state": "ACTIVE",
            "tags": {
                "key1": "value1",
                "key2": "value2"
            },
            "thumbnailConfiguration": {
                "recordingMode": "INTERVAL",
                "targetIntervalSeconds": 1,
                "resolution": "LOWEST_RESOLUTION",
                "storage": [
                    "LATEST"
                ]
            },
            "recordingReconnectWindowSeconds": 60,
            "renditionConfiguration": {
                "renditionSelection": "CUSTOM",
                "renditions": [
                    "HD"
                ]
            }
        },
        "truncatedEvents": [
            {
                "code": "StreamTakeoverInvalidPriority",
                "name": "Stream Takeover Failure",
                "type": "IVS Stream State Change",
                "eventTime": "2023-06-26T19:09:48+00:00"
            },
            {
                "name": "Stream Takeover",
                "type": "IVS Stream State Change",
                "eventTime": "2023-06-26T19:09:47+00:00"
            },
            {
                "name": "Recording Start",
                "type": "IVS Recording State Change",
                "eventTime": "2023-06-26T19:09:35+00:00"
            },
            {
                "name": "Stream Start",
                "type": "IVS Stream State Change",
                "eventTime": "2023-06-26T19:09:34+00:00"
            },
            {
                "name": "Session Created",
                "type": "IVS Stream State Change",
                "eventTime": "2023-06-26T19:09:28+00:00"
            }
        ]
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [GetStreamSession](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/get-stream-session.html)。

### `get-stream`
<a name="ivs_GetStream_cli_topic"></a>

以下代码示例演示了如何使用 `get-stream`。

**AWS CLI**  
**获取有关直播的信息**  
以下 `get-stream` 示例获取有关指定通道的直播的信息。  

```
aws ivs get-stream \
    --channel-arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh
```
输出：  

```
{
    "stream": {
        "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8",
        "startTime": "2020-05-05T21:55:38Z",
        "state": "LIVE",
        "health": "HEALTHY",
        "streamId": "st-ABCDEfghij01234KLMN5678",
        "viewerCount": 1
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [GetStream](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/get-stream.html)。

### `import-playback-key-pair`
<a name="ivs_ImportPlaybackKeyPair_cli_topic"></a>

以下代码示例演示了如何使用 `import-playback-key-pair`。

**AWS CLI**  
**导入新密钥对的公共部分**  
以下 `import-playback-key-pair` 示例导入指定公钥（以 PEM 格式指定的字符串），并返回新密钥对的 arn 和指纹。  

```
aws ivs import-playback-key-pair \
    --name "my-playback-key" \
    --public-key-material "G1lbnQxOTA3BgNVBAMMMFdoeSBhcmUgeW91IGRl..."
```
输出：  

```
{
    "keyPair": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:playback-key/abcd1234efgh",
        "name": "my-playback-key",
        "fingerprint": "0a:1b:2c:ab:cd:ef:34:56:70:b1:b2:71:01:2a:a3:72",
        "tags": {}
    }
}
```
有关更多信息，请参阅《Amazon Interactive Video Service 用户指南》**中的[设置私有通道](https://docs.aws.amazon.com/ivs/latest/userguide//private-channels.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [ImportPlaybackKeyPair](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/import-playback-key-pair.html)。

### `list-channels`
<a name="ivs_ListChannels_cli_topic"></a>

以下代码示例演示了如何使用 `list-channels`。

**AWS CLI**  
**示例 1：获取所有通道的摘要信息**  
以下 `list-channels` 示例列出您的 AWS 账户的所有通道。  

```
aws ivs list-channels
```
输出：  

```
{
    "channels": [
        {
            "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
            "name": "channel-1",
            "latencyMode": "LOW",
            "authorized": false,
            "insecureIngest": false,
            "preset": "",
            "playbackRestrictionPolicyArn": "",
            "recordingConfigurationArn": "arn:aws:ivs:us-west-2:123456789012:recording-configuration/ABCD12cdEFgh",
            "tags": {},
            "type": "STANDARD"
        },
        {
            "arn": "arn:aws:ivs:us-west-2:123456789012:channel/efghEFGHijkl",
            "name": "channel-2",
            "latencyMode": "LOW",
            "authorized": false,
            "preset": "",
            "playbackRestrictionPolicyArn": "arn:aws:ivs:us-west-2:123456789012:playback-restriction-policy/ABcdef34ghIJ",
            "recordingConfigurationArn": "",
            "tags": {},
            "type": "STANDARD"
        }
    ]
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
**示例 2：获取按指定 RecordingConfiguration ARN 筛选的所有通道的摘要信息**  
以下 `list-channels` 示例列出您的 AWS 账户中与指定 RecordingConfiguration ARN 关联的所有通道。  

```
aws ivs list-channels \
    --filter-by-recording-configuration-arn "arn:aws:ivs:us-west-2:123456789012:recording-configuration/ABCD12cdEFgh"
```
输出：  

```
{
    "channels": [
        {
            "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
            "name": "channel-1",
            "latencyMode": "LOW",
            "authorized": false,
            "insecureIngest": false,
            "preset": "",
            "playbackRestrictionPolicyArn": "",
            "recordingConfigurationArn": "arn:aws:ivs:us-west-2:123456789012:recording-configuration/ABCD12cdEFgh",
            "tags": {},
            "type": "STANDARD"
        }
    ]
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[录制到 Amazon S3](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/record-to-s3.html)。  
**示例 3：获取按指定 PlaybackRestrictionPolicy ARN 筛选的所有通道的摘要信息**  
以下 `list-channels` 示例列出您的 AWS 账户中与指定 PlaybackRestrictionPolicy ARN 关联的所有通道。  

```
aws ivs list-channels \
    --filter-by-playback-restriction-policy-arn "arn:aws:ivs:us-west-2:123456789012:playback-restriction-policy/ABcdef34ghIJ"
```
输出：  

```
{
    "channels": [
        {
            "arn": "arn:aws:ivs:us-west-2:123456789012:channel/efghEFGHijkl",
            "name": "channel-2",
            "latencyMode": "LOW",
            "authorized": false,
            "preset": "",
            "playbackRestrictionPolicyArn": "arn:aws:ivs:us-west-2:123456789012:playback-restriction-policy/ABcdef34ghIJ",
            "recordingConfigurationArn": "",
            "tags": {},
            "type": "STANDARD"
        }
    ]
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[不想要的内容和观看者](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/undesired-content.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [ListChannels](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/list-channels.html)。

### `list-playback-key-pairs`
<a name="ivs_ListPlaybackKeyPairs_cli_topic"></a>

以下代码示例演示了如何使用 `list-playback-key-pairs`。

**AWS CLI**  
**获取有关所有播放密钥对的摘要信息**  
以下 `list-playback-key-pairs` 示例返回所有密钥对的信息。  

```
aws ivs list-playback-key-pairs
```
输出：  

```
{
    "keyPairs": [
        {
            "arn": "arn:aws:ivs:us-west-2:123456789012:playback-key/abcd1234efgh",
            "name": "test-key-0",
            "tags": {}
        },
        {
            "arn": "arn:aws:ivs:us-west-2:123456789012:playback-key/ijkl5678mnop",
            "name": "test-key-1",
            "tags": {}
        }
    ]
}
```
有关更多信息，请参阅《Amazon Interactive Video Service 用户指南》**中的[设置私有通道](https://docs.aws.amazon.com/ivs/latest/userguide//private-channels.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [ListPlaybackKeyPairs](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/list-playback-key-pairs.html)。

### `list-playback-restriction-policies`
<a name="ivs_ListPlaybackRestrictionPolicies_cli_topic"></a>

以下代码示例演示了如何使用 `list-playback-restriction-policies`。

**AWS CLI**  
**获取有关所有播放限制策略的摘要信息**  
以下 `list-playback-restriction-policies` 示例列出您的 AWS 账户的所有播放限制策略。  

```
aws ivs list-playback-restriction-policies
```
输出：  

```
{
    "playbackRestrictionPolicies": [
        {
            "arn": "arn:aws:ivs:us-west-2:123456789012:playback-restriction-policy/ABcdef34ghIJ",
            "allowedCountries": [
                "US",
                "MX"
            ],
            "allowedOrigins": [
                "https://www.website1.com",
                "https://www.website2.com"
            ],
            "enableStrictOriginEnforcement": true,
            "name": "test-playback-restriction-policy",
            "tags": {
                "key1": "value1",
                "key2": "value2"
            }
        }
    ]
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[不想要的内容和观看者](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/undesired-content.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [ListPlaybackRestrictionPolicies](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/list-playback-restriction-policies.html)。

### `list-recording-configurations`
<a name="ivs_ListRecordingConfigurations_cli_topic"></a>

以下代码示例演示了如何使用 `list-recording-configurations`。

**AWS CLI**  
**列出在此账户中创建的所 RecordingConfiguration 资源**  
以下 `list-recording-configurations` 示例获取您的账户中所有 RecordingConfiguration 资源的信息。  

```
aws ivs list-recording-configurations
```
输出：  

```
{
    "recordingConfigurations": [
        {
            "arn": "arn:aws:ivs:us-west-2:123456789012:recording-configuration/ABcdef34ghIJ",
            "name": "test-recording-config-1",
            "destinationConfiguration": {
                "s3": {
                    "bucketName": "demo-recording-bucket-1"
                }
            },
            "state": "ACTIVE",
            "tags": {}
        },
        {
            "arn": "arn:aws:ivs:us-west-2:123456789012:recording-configuration/CD12abcdGHIJ",
            "name": "test-recording-config-2",
            "destinationConfiguration": {
                "s3": {
                    "bucketName": "demo-recording-bucket-2"
                }
            },
            "state": "ACTIVE",
            "tags": {}
        }
    ]
}
```
有关更多信息，请参阅《Amazon Interactive Video Service 用户指南》**中的[录制到 Amazon S3](https://docs.aws.amazon.com/ivs/latest/userguide/record-to-s3.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [ListRecordingConfigurations](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/list-recording-configurations.html)。

### `list-stream-keys`
<a name="ivs_ListStreamKeys_cli_topic"></a>

以下代码示例演示了如何使用 `list-stream-keys`。

**AWS CLI**  
**获取直播密钥列表**  
以下 `list-stream-keys` 示例列出指定 ARN（Amazon 资源名称）的所有直播密钥。  

```
aws ivs list-stream-keys \
    --channel-arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh
```
输出：  

```
{
    "streamKeys": [
        {
            "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/abcdABCDefgh",
            "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
            "tags": {}
        }
    ]
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [ListStreamKeys](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/list-stream-keys.html)。

### `list-stream-sessions`
<a name="ivs_ListStreamSessions_cli_topic"></a>

以下代码示例演示了如何使用 `list-stream-sessions`。

**AWS CLI**  
**获取当前 AWS 区域中指定通道的当前和之前直播的摘要**  
以下 `list-stream-sessions` 示例报告指定通道 ARN（Amazon 资源名称）的直播的摘要信息。  

```
aws ivs list-stream-sessions \
    --channel-arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh \
    --max-results 25 \
    --next-token ""
```
输出：  

```
{
    "nextToken": "set-2",
    "streamSessions": [
        {
            "startTime": 1641578182,
            "endTime": 1641579982,
            "hasErrorEvent": false,
            "streamId": "mystream"
        }
        ...
    ]
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》中的 [ListStreamSessions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/list-stream-sessions.html)**。

### `list-streams`
<a name="ivs_ListStreams_cli_topic"></a>

以下代码示例演示了如何使用 `list-streams`。

**AWS CLI**  
**获取直播列表及其状态**  
以下 `list-streams` 示例列出您的 AWS 账户的所有直播。  

```
aws ivs list-streams
```
输出：  

```
{
   "streams": [
        {
            "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
            "state": "LIVE",
            "health": "HEALTHY",
            "streamId": "st-ABCDEfghij01234KLMN5678",
            "viewerCount": 1
        }
    ]
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [ListStreams](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/list-streams.html)。

### `list-tags-for-resource`
<a name="ivs_ListTagsForResource_cli_topic"></a>

以下代码示例演示了如何使用 `list-tags-for-resource`。

**AWS CLI**  
**列出 AWS 资源（如通道、直播密钥）的所有标签**  
以下 `list-tags-for-resource` 示例列出指定资源 ARN（Amazon 资源名称）的所有标签。  

```
aws ivs list-tags-for-resource \
    --resource-arn arn:aws:ivs:us-west-2:12345689012:channel/abcdABCDefgh
```
输出：  

```
{
    "tags":
    {
        "key1": "value1",
        "key2": "value2"
    }
}
```
有关更多信息，请参阅《Amazon Interactive Video Service API 参考》**中的[标记](https://docs.aws.amazon.com/ivs/latest/APIReference/Welcome.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [ListTagsForResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/list-tags-for-resource.html)。

### `put-metadata`
<a name="ivs_PutMetadata_cli_topic"></a>

以下代码示例演示了如何使用 `put-metadata`。

**AWS CLI**  
**将元数据插入到指定通道的活跃直播中**  
以下 `put-metadata` 示例将给定元数据插入到指定通道的直播中。  

```
aws ivs put-metadata \
    --channel-arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh \
    --metadata '{"my": "metadata"}'
```
此命令不生成任何输出。  
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [PutMetadata](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/put-metadata.html)。

### `start-viewer-session-revocation`
<a name="ivs_StartViewerSessionRevocation_cli_topic"></a>

以下代码示例演示了如何使用 `start-viewer-session-revocation`。

**AWS CLI**  
**撤消给定多 channel-ARN 和 viewer-ID 对的观看者会话**  
以下 `start-viewer-session-revocation` 示例启动撤销与指定通道 ARN 和观看者 ID 相关联的观看者会话的过程，撤销的会话直至且包括指定版本号。如果未提供版本，则默认值为 0。  

```
aws ivs batch-start-viewer-session-revocation \
    --channel-arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh \
    --viewer-id abcdefg \
    --viewer-session-versions-less-than-or-equal-to 1234567890
```
此命令不生成任何输出。  
有关更多信息，请参阅《Amazon Interactive Video Service 用户指南》**中的[设置私有通道](https://docs.aws.amazon.com/ivs/latest/userguide/private-channels.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [StartViewerSessionRevocation](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/start-viewer-session-revocation.html)。

### `stop-stream`
<a name="ivs_StopStream_cli_topic"></a>

以下代码示例演示了如何使用 `stop-stream`。

**AWS CLI**  
**停止指定直播**  
以下 `stop-stream` 示例停止指定通道上的直播。  

```
aws ivs stop-stream \
    --channel-arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh
```
此命令不生成任何输出。  
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [StopStream](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/stop-stream.html)。

### `tag-resource`
<a name="ivs_TagResource_cli_topic"></a>

以下代码示例演示了如何使用 `tag-resource`。

**AWS CLI**  
**为 AWS 资源（如通道、直播密钥）添加或更新标签**  
以下 `tag-resource` 示例为指定资源 ARN（Amazon 资源名称）添加或更新标签。  

```
aws ivs tag-resource \
    --resource-arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh \
    --tags "tagkey1=tagvalue1, tagkey2=tagvalue2"
```
此命令不生成任何输出。  
有关更多信息，请参阅《Amazon Interactive Video Service API 参考》**中的[标记](https://docs.aws.amazon.com/ivs/latest/APIReference/Welcome.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [TagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/tag-resource.html)。

### `untag-resource`
<a name="ivs_UntagResource_cli_topic"></a>

以下代码示例演示了如何使用 `untag-resource`。

**AWS CLI**  
**移除 AWS 资源（如通道、直播密钥）的标签**  
以下 `untag-resource` 示例移除指定资源 ARN（Amazon 资源名称）的指定标签。  

```
aws ivs untag-resource \
    --resource-arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh \
    --tag-keys "tagkey1, tagkey2"
```
此命令不生成任何输出。  
有关更多信息，请参阅《Amazon Interactive Video Service API 参考》**中的[标记](https://docs.aws.amazon.com/ivs/latest/APIReference/Welcome.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [UntagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/untag-resource.html)。

### `update-channel`
<a name="ivs_UpdateChannel_cli_topic"></a>

以下代码示例演示了如何使用 `update-channel`。

**AWS CLI**  
**示例 1：更新通道的配置信息**  
以下 `update-channel` 示例更新了指定通道 ARN 的通道配置以更改通道名称。这不会影响此通道正在进行的直播；您必须停止并重新启动直播才能使更改生效。  

```
aws ivs update-channel \
    --arn 'arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh' \
    --name 'channel-1' \
    --insecure-ingest
```
输出：  

```
{
    "channel": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "name": "channel-1",
        "latencyMode": "LOW",
        "containerFormat": "TS",
        "multitrackInputConfiguration": {
            "enabled": false,
            "maximumResolution": "FULL_HD",
            "policy": "ALLOW"
        },
        "type": "STANDARD",
        "playbackRestrictionPolicyArn": "",
        "recordingConfigurationArn": "",
        "srt": {
            "endpoint": "a1b2c3d4e5f6.srt.live-video.net",
            "passphrase": "AB1C2defGHijkLMNo3PqQRstUvwxyzaBCDEfghh4ijklMN5opqrStuVWxyzAbCDEfghIJ"
        },
        "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
        "insecureIngest": true,
        "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8",
        "preset": "",
        "authorized": false,
        "tags": {}
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[创建通道](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/getting-started-create-channel.html)。  
**示例 2：更新通道配置以启用录制**  
以下 `update-channel` 示例更新了指定通道 ARN 的通道配置以启用录制。这不会影响此通道正在进行的直播；您必须停止并重新启动直播才能使更改生效。  

```
aws ivs update-channel \
    --arn 'arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh' \
    --no-insecure-ingest \
    --recording-configuration-arn 'arn:aws:ivs:us-west-2:123456789012:recording-configuration/ABCD12cdEFgh'
```
输出：  

```
{
    "channel": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "name": "test-channel-with-recording",
        "latencyMode": "LOW",
        "containerFormat": "TS",
        "multitrackInputConfiguration": {
            "enabled": false,
            "maximumResolution": "FULL_HD",
            "policy": "ALLOW"
        },
        "type": "STANDARD",
        "playbackRestrictionPolicyArn": "",
        "recordingConfigurationArn": "arn:aws:ivs:us-west-2:123456789012:recording-configuration/ABCD12cdEFgh",
        "srt": {
            "endpoint": "a1b2c3d4e5f6.srt.live-video.net",
            "passphrase": "BA1C2defGHijkLMNo3PqQRstUvwxyzaBCDEfghh4ijklMN5opqrStuVWxyzAbCDEfghIJ"
        },
        "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
        "insecureIngest": false,
        "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8",
        "preset": "",
        "authorized": false,
        "tags": {}
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[录制到 Amazon S3](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/record-to-s3.html)。  
**示例 3：更新通道配置以禁用录制**  
以下 `update-channel` 示例更新了指定通道 ARN 的通道配置以禁用录制。这不会影响此通道正在进行的直播；您必须停止并重新启动直播才能使更改生效。  

```
aws ivs update-channel \
    --arn 'arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh' \
    --recording-configuration-arn ''
```
输出：  

```
{
    "channel": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "name": "test-channel-with-recording",
        "latencyMode": "LOW",
        "containerFormat": "TS",
        "multitrackInputConfiguration": {
            "enabled": false,
            "maximumResolution": "FULL_HD",
            "policy": "ALLOW"
        },
        "type": "STANDARD",
        "playbackRestrictionPolicyArn": "",
        "recordingConfigurationArn": "",
        "srt": {
            "endpoint": "a1b2c3d4e5f6.srt.live-video.net",
            "passphrase": "AB1C2edfGHijkLMNo3PqQRstUvwxyzaBCDEfghh4ijklMN5opqrStuVWxyzAbCDEfghIJ"
        },
        "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
        "insecureIngest": false,
        "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8",
        "preset": "",
        "authorized": false,
        "tags": {}
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[录制到 Amazon S3](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/record-to-s3.html)。  
**示例 4：更新通道配置以启用播放限制**  
以下 `update-channel` 示例更新了指定通道 ARN 的通道配置以应用播放限制策略。这不会影响此通道正在进行的直播；您必须停止并重新启动直播才能使更改生效。  

```
aws ivs update-channel \
    --arn 'arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh' \
    --no-insecure-ingest \
    --playback-restriction-policy-arn 'arn:aws:ivs:us-west-2:123456789012:playback-restriction-policy/ABcdef34ghIJ'
```
输出：  

```
{
    "channel": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "name": "test-channel-with-playback-restriction-policy",
        "latencyMode": "LOW",
        "containerFormat": "TS",
        "multitrackInputConfiguration": {
            "enabled": false,
            "maximumResolution": "FULL_HD",
            "policy": "ALLOW"
        },
        "type": "STANDARD",
        "playbackRestrictionPolicyArn": "arn:aws:ivs:us-west-2:123456789012:playback-restriction-policy/ABcdef34ghIJ",
        "recordingConfigurationArn": "",
        "srt": {
            "endpoint": "a1b2c3d4e5f6.srt.live-video.net",
            "passphrase": "AB1C2defGHijkLMNo3PqQRstUvwxyzaCBDEfghh4ijklMN5opqrStuVWxyzAbCDEfghIJ"
        },
        "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
        "insecureIngest": false,
        "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8",
        "preset": "",
        "authorized": false,
        "tags": {}
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[不想要的内容和观看者](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/undesired-content.html)。  
**示例 5：更新通道配置以禁用播放限制**  
以下 `update-channel` 示例更新了指定通道 ARN 的通道配置以禁用播放限制。这不会影响此通道正在进行的直播；您必须停止并重新启动直播才能使更改生效。  

```
aws ivs update-channel \
    --arn 'arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh' \
    --playback-restriction-policy-arn ''
```
输出：  

```
{
    "channel": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "name": "test-channel-with-playback-restriction-policy",
        "latencyMode": "LOW",
        "containerFormat": "TS",
        "multitrackInputConfiguration": {
            "enabled": false,
            "maximumResolution": "FULL_HD",
            "policy": "ALLOW"
        },
        "type": "STANDARD",
        "playbackRestrictionPolicyArn": "",
        "recordingConfigurationArn": "",
        "srt": {
            "endpoint": "a1b2c3d4e5f6.srt.live-video.net",
            "passphrase": "AB1C2defGHijkLMNo3PqQRstUvwxyzaBCDeFghh4ijklMN5opqrStuVWxyzAbCDEfghIJ"
        },
        "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
        "insecureIngest": false,
        "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8",
        "preset": "",
        "authorized": false,
        "tags": {}
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[不想要的内容和观看者](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/undesired-content.html)。  
**示例 6：更新通道配置以启用多轨道**  
以下 `update-channel` 示例更新指定通道 ARN 的通道配置以启用多轨道。这不会影响此通道正在进行的直播；您必须停止并重新启动直播才能使更改生效。  

```
aws ivs update-channel \
    --arn 'arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh' \
    --container-format 'FRAGMENTED_MP4' \
    --multitrack-input-configuration '{"enabled": true,"maximumResolution": "FULL_HD","policy": "ALLOW"}'
```
输出：  

```
{
    "channel": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "containerFormat": "FRAGMENTED_MP4",
        "name": "test-channel-with-multitrack",
        "latencyMode": "LOW",
        "multitrackInputConfiguration": {
            "enabled": true,
            "maximumResolution": "FULL_HD",
            "policy": "ALLOW"
        },
        "type": "STANDARD",
        "playbackRestrictionPolicyArn": "",
        "recordingConfigurationArn": "",
        "srt": {
            "endpoint": "a1b2c3d4e5f6.srt.live-video.net",
            "passphrase": "AB1C2defGHijkLMNo3PqQRstUvwxyzaCBDEfghh4ijklMN5opqrStuVWxyzAbCDEfghIJ"
        },
        "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
        "insecureIngest": false,
        "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8",
        "preset": "",
        "authorized": false,
        "tags": {}
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[不想要的内容和观看者](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/multitrack-video.html)。  
**示例 7：更新通道配置以禁用播放限制**  
以下 `update-channel` 示例更新指定通道 ARN 的通道配置以禁用多轨道。这不会影响此通道正在进行的直播；您必须停止并重新启动直播才能使更改生效。  

```
aws ivs update-channel \
    --arn 'arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh' \
    --container-format 'TS' \
    --multitrack-input-configuration '{"enabled": false}'
```
输出：  

```
{
    "channel": {
        ""arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
        "containerFormat": "TS",
        "name": "test-channel-with-multitrack",
        "latencyMode": "LOW",
        "multitrackInputConfiguration": {
            "enabled": false,
            "maximumResolution": "FULL_HD",
            "policy": "ALLOW"
        },
        "type": "STANDARD",
        "playbackRestrictionPolicyArn": "",
        "recordingConfigurationArn": "",
        "srt": {
            "endpoint": "a1b2c3d4e5f6.srt.live-video.net",
            "passphrase": "AB1C2defGHijkLMNo3PqQRstUvwxyzaCBDEfghh4ijklMN5opqrStuVWxyzAbCDEfghIJ"
        },
        "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
        "insecureIngest": false,
        "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8",
        "preset": "",
        "authorized": false,
        "tags": {}
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[不想要的内容和观看者](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/multitrack-video.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [UpdateChannel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/update-channel.html)。

### `update-playback-restriction-policy`
<a name="ivs_UpdatePlaybackRestrictionPolicy_cli_topic"></a>

以下代码示例演示了如何使用 `update-playback-restriction-policy`。

**AWS CLI**  
**更新播放限制策略**  
以下 `update-playback-restriction-policy` 示例使用指定的策略 ARN 更新播放限制策略，以禁用严格的来源强制执行。这不会影响关联通道正在进行的直播；您必须停止并重新启动直播才能使更改生效。  

```
aws ivs update-playback-restriction-policy \
    --arn "arn:aws:ivs:us-west-2:123456789012:playback-restriction-policy/ABcdef34ghIJ" \
    --no-enable-strict-origin-enforcement
```
输出：  

```
{
    "playbackRestrictionPolicy": {
        "arn": "arn:aws:ivs:us-west-2:123456789012:playback-restriction-policy/ABcdef34ghIJ",
        "allowedCountries": [
            "US",
            "MX"
        ],
        "allowedOrigins": [
            "https://www.website1.com",
            "https://www.website2.com"
        ],
        "enableStrictOriginEnforcement": false,
        "name": "test-playback-restriction-policy",
        "tags": {
            "key1": "value1",
            "key2": "value2"
        }
    }
}
```
有关更多信息，请参阅《IVS Low-Latency 用户指南》**中的[不想要的内容和观看者](https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/undesired-content.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [UpdatePlaybackRestrictionPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ivs/update-playback-restriction-policy.html)。