

# Getting Started with IVS Low-Latency Streaming
<a name="getting-started"></a>

This document takes you through the steps to set up your first Amazon Interactive Video Service (IVS) live stream.

**Topics**
+ [

# Step 1: Create an AWS Account
](getting-started-create-account.md)
+ [

# Step 2: Set Up Root and Administrative Users
](getting-started-setup-users.md)
+ [

# Step 3: Set Up IAM Permissions
](getting-started-iam-permissions.md)
+ [

# Step 4: Create a Channel with Optional Recording
](getting-started-create-channel.md)
+ [

# Step 5: Set Up Streaming Software
](getting-started-set-up-streaming.md)
+ [

# Step 6: View Your Live Stream
](getting-started-view-stream.md)
+ [

# Step 7: Check Your Service-Quota Limits (Optional)
](getting-started-check-service-quota.md)
+ [

# Step 8: Prevent Undesired Content and Viewers (Recommended)
](getting-started-prevent-undesired-content.md)

# Step 1: Create an AWS Account
<a name="getting-started-create-account"></a>

To use Amazon IVS, you need an AWS account. If you don't already have one, you are prompted to create it when you sign up. To create an AWS account:

1. Open [https://portal.aws.amazon.com/billing/signup](https://portal.aws.amazon.com/billing/signup).

1. Follow the online instructions.

   Part of the sign-up procedure involves receiving a phone call or text message and entering a verification code. Also, you will have to provide billing information, although the basic tier of service is free. You are not charged for any AWS services that you sign up for unless you use them. 

1. After creating the account, you will get one email with your **Sign-in URL** and **User Name** and another email (from your AWS account administrator) with your password. You must change the password during your first sign-in.

If you want to use an existing AWS account, ensure that it uses an AWS region that is supported for Amazon IVS:

1. Navigate to the [Amazon IVS Console](https://console.aws.amazon.com/ivs). If you see the usual IVS console page (showing "Global Solution, regional content"), you’re fine; skip to [Step 2: Set Up Root and Administrative Users](getting-started-setup-users.md). If you are redirected to an AWS "unsupported region" page, you need to select a new region.

1. Select the appropriate tab (**Live streaming**, for IVS; **Stream chat**, for IVS Chat), then select one of the listed regions. *Note which region you choose; you will need it later*. 

At any time, you can view your AWS account activity and manage your account by going to [https://aws.amazon.com/](https://aws.amazon.com/) and choosing **My Account**.

# Step 2: Set Up Root and Administrative Users
<a name="getting-started-setup-users"></a>

When you sign up for an AWS account, an AWS account root user is created. The root user has access to all AWS services and resources in the account. As a security best practice, [assign administrative access to an administrative user](https://docs.aws.amazon.com/singlesignon/latest/userguide/useraccess.html) and use the root user only to perform [tasks that require root user access](https://docs.aws.amazon.com/IAM/latest/UserGuide/root-user-tasks.html).

## Secure Your AWS Account Root User
<a name="setup-users-secure-root-user"></a>

1. To sign in as the administrative user in the IAM Identity Center, use the sign-in URL that was sent to your email address when you created the IAM Identity Center user. For help signing in using an IAM Identity Center user, see [Signing in to the AWS access portal](https://docs.aws.amazon.com/signin/latest/userguide/iam-id-center-sign-in-tutorial.html) in the *AWS Sign-In User Guide*.

   For help signing in using root user, see [Signing in as the root user](https://docs.aws.amazon.com/signin/latest/userguide/console-sign-in-tutorials.html#introduction-to-root-user-sign-in-tutorial) in the *AWS Sign-In User Guide*.

1. Turn on multi-factor authentication (MFA) for your root user.

   For instructions, see [Enable a virtual MFA device for your AWS account root user (console)](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_enable_virtual.html#enable-virt-mfa-for-root) in the *IAM User Guide*.

## Create an Administrative User
<a name="setup-users-create-admin-user"></a>

You should create an administrative user so that you do not use the root user for everyday tasks.
+ For your daily administrative tasks, assign administrative access to an administrative user in AWS IAM Identity Center (successor to AWS Single Sign-On). For instructions, see [Getting started](https://docs.aws.amazon.com/singlesignon/latest/userguide/getting-started.html) in the *AWS IAM Identity Center (successor to AWS Single Sign-On) User Guide*.
+ To sign in as the administrative user in the IAM Identity Center, use the sign-in URL that was sent to your email address when you created the IAM Identity Center user. For help signing in using an IAM Identity Center user, see [Signing in to the AWS access portal](https://docs.aws.amazon.com/signin/latest/userguide/iam-id-center-sign-in-tutorial.html) in the *AWS Sign-In User Guide*.

# Step 3: Set Up IAM Permissions
<a name="getting-started-iam-permissions"></a>

Next, you must create an AWS Identity and Access Management (IAM) policy that gives users a basic set of permissions (e.g., to create an Amazon IVS channel, get streaming information, and auto-record-to-S3) and assign that policy to users. You can either assign the permissions when creating a [new user](#iam-permissions-new-user) or add permissions to an [existing user](#iam-permissions-existing-user). Both procedures are given below.

For more information (for example, to learn about IAM users and policies, how to attach a policy to a user, and how to constrain what users can do with Amazon IVS), see:
+ [Creating an IAM User](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html#Using_CreateUser_console) in the *IAM User Guide*
+ The information in [Amazon IVS Security](security.md) on IAM and "Managed Policies for IVS." 
+ For record-to-S3 functionality: [Using Service-Linked Roles](security-service-linked-roles.md) and [Auto-Record to Amazon S3](record-to-s3.md) in the *Amazon IVS User Guide*

You can either use an existing AWS managed policy for Amazon IVS or create a new policy that customizes the permissions you want to grant to a set of users, groups, or roles. Both approaches are described below.

## Use an Existing Policy for IVS Permissions
<a name="iam-permissions-existing-policy"></a>

In most cases, you will want to use an AWS managed policy for Amazon IVS. They are described fully in the [Managed Policies for IVS](security-iam-awsmanpol.md) section of *IVS Security*.
+ Use the `IVSReadOnlyAccess` AWS managed policy to give your application developers access to all IVS Get and List API operations (for both low-latency and real-time streaming).
+ Use the `IVSFullAccess` AWS managed policy to give your application developers access to all IVS API operations (for both low-latency and real-time streaming).

## Optional: Create a Custom Policy for Amazon IVS Permissions
<a name="iam-permissions-new-policy"></a>

Follow these steps:

1. Sign in to the AWS Management Console and open the IAM console at [https://console.aws.amazon.com/iam/](https://console.aws.amazon.com/iam/).

1. In the navigation pane, choose **Policies**, then choose **Create policy**. A** Specify permissions** window opens..

1. In the **Specify permissions** window, choose the **JSON** tab, and copy and paste the following IVS policy to the **Policy editor** text area. (The policy does not include all Amazon IVS actions. You can add/delete (Allow/Deny) operation access permissions as needed. See [IVS Low-Latency Streaming API Reference](https://docs.aws.amazon.com//ivs/latest/LowLatencyAPIReference/Welcome.html) for details on IVS operations.)

------
#### [ JSON ]

****  

   ```
   {
      "Version":"2012-10-17",		 	 	 
      "Statement": [
         {
            "Effect": "Allow",
            "Action": [
               "ivs:CreateChannel",
               "ivs:CreateRecordingConfiguration",
               "ivs:GetChannel",
               "ivs:GetRecordingConfiguration",
               "ivs:GetStream",
               "ivs:GetStreamKey",
               "ivs:GetStreamSession",
               "ivs:ListChannels",
               "ivs:ListRecordingConfigurations",
               "ivs:ListStreamKeys",
               "ivs:ListStreams",
               "ivs:ListStreamSessions"
             ],
             "Resource": "*"
         },
         {
            "Effect": "Allow",
            "Action": [
               "cloudwatch:DescribeAlarms",
               "cloudwatch:GetMetricData",
               "s3:CreateBucket",
               "s3:GetBucketLocation",
               "s3:ListAllMyBuckets",
               "servicequotas:ListAWSDefaultServiceQuotas",
               "servicequotas:ListRequestedServiceQuotaChangeHistoryByQuota",
               "servicequotas:ListServiceQuotas",
               "servicequotas:ListServices",
               "servicequotas:ListTagsForResource"
            ],
            "Resource": "*"
         },
         {
            "Effect": "Allow",
            "Action": [
               "iam:AttachRolePolicy",
               "iam:CreateServiceLinkedRole",
               "iam:PutRolePolicy"
            ],
            "Resource": 
   "arn:aws:iam::*:role/aws-service-role/ivs.amazonaws.com/AWSServiceRoleForIVSRecordToS3*"
         }
      ]
   }
   ```

------

1. Still in the **Specify permissions** window, choose **Next** (scroll to the bottom of the window to see this). A **Review and create** window opens. 

1. On the **Review and create** window, enter a **Policy name** and optionally add a **Description**. Make a note of the policy name, as you will need it when creating users (below). Choose **Create policy** (at the bottom of the window).

1. You are returned to the IAM console window, where you should see a banner confirming that your new policy was created.

## Create a New User and Add Permissions
<a name="iam-permissions-new-user"></a>

### IAM User Access Keys
<a name="iam-permissions-new-user-access-keys"></a>

IAM Access keys consist of an access key ID and a secret access key. They are used to sign programmatic requests that you make to AWS. If you don't have access keys, you can create them from the AWS Management Console. As a best practice, do not create root-user access keys.

*The only time that you can view or download a secret access key is when you create access keys. You cannot recover them later.* However, you can create new access keys at any time; you must have permissions to perform the required IAM actions.

Always store access keys securely. Never share them with third parties (even if an inquiry seems to come from Amazon). For more information, see [Managing access keys for IAM users](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html) in the *IAM User Guide*.

### Procedure
<a name="iam-permissions-new-user-procedure"></a>

Follow these steps:

1. In the navigation pane, choose **Users**, then choose **Create user**. A **Specify user details** window opens. 

1. In the **Specify user details** window:

   1. Under **User details**, type the new **User name** to be created.

   1. Check **Provide user access to the AWS Management Console**.

   1. When prompted, select **I want to create an IAM user**.

   1. Under **Console password**, select **Autogenerated password**.

   1. Check **Users must create a new password at next sign-in**.

   1. Choose **Next**. A **Set permissions** window opens.

1. Under **Set permissions**, select **Attach policies directly**. A **Permissions policies** window opens.

1. In the search box, enter an IVS policy name (either an AWS managed policy or your previously created custom policy). When it is found, check the box to select the policy.

1. Choose **Next** (at the bottom of the window). A **Review and create** window opens.

1. On the **Review and create** window, confirm that all user details are correct, then choose **Create user** (at the bottom of the window).

1. The **Retrieve password** window opens, containing your **Console sign-in details**. *Save this information securely for future reference*. When you are done, choose **Return to users list**.

## Add Permissions to an Existing User
<a name="iam-permissions-existing-user"></a>

Follow these steps:

1. Sign in to the AWS Management Console and open the IAM console at [https://console.aws.amazon.com/iam/](https://console.aws.amazon.com/iam/).

1. In the navigation pane, choose **Users**, then choose an existing user name to be updated. (Choose the name by clicking on it; do not check the selection box.)

1. On the **Summary** page, on the **Permissions** tab, choose **Add permissions**. An **Add permissions** window opens.

1. Select **Attach existing policies directly**. A **Permissions policies** window opens.

1. In the search box, enter an IVS policy name (either an AWS managed policy or your previously created custom policy). When the policy is found, check the box to select the policy.

1. Choose **Next** (at the bottom of the window). A **Review** window opens.

1. On the **Review** window, select **Add permissions** (at the bottom of the window).

1. On the **Summary** page, confirm that the IVS policy was added.

# Step 4: Create a Channel with Optional Recording
<a name="getting-started-create-channel"></a>

An Amazon IVS channel stores configuration information related to your live stream. You first create a channel and then contribute video to it using the channel’s stream key to start your live stream.

As part of channel creation, the following items are assigned:
+ An *ingest server* identifies a specific Amazon IVS component that receives the stream, along with an ingestion protocol (RTMPS or RTMP).
+ Amazon IVS assigns a *stream key* when you create a channel and uses it to authorize streaming. ***Treat the stream key like a secret, since it allows anyone to stream to the channel***.
+ A *playback URL* identifies the endpoint to start playback for a specific channel. This endpoint can be used globally. It automatically selects the best location from the Amazon IVS global content delivery network for a viewer to stream the video. (Note that Amazon IVS does not support custom domains for playback. *Do not proxy the playback URL with your own domain; that does not work and will cause issues.*)

 You can create a channel — with or without recording — through the Amazon IVS console or the AWS CLI. Channel creation and recording are discussed below.

# Auto-Record to Amazon S3
<a name="create-channel-auto-r2s3"></a>

You have the option of enabling recording for a channel. If the auto-record to S3 feature is enabled, all streams on the channel are recorded and saved to an Amazon S3 storage bucket that you own. Subsequently, the recording is available for on-demand playback.

*Setting this up is an advanced option.* By default, recording is disabled when a channel is created.

Before you can set up a channel for recording, you must create a *recording-configuration*. This is a resource which specifies an Amazon S3 location where the recorded streams for the channel are stored. You can create and manage recording configurations using the console or CLI; both procedures are given below. After you create the recording configuration, you associate it with a channel either when you create the channel (as described below) or later, by updating an existing channel. (In the API, see [CreateChannel](https://docs.aws.amazon.com//ivs/latest/LowLatencyAPIReference/API_CreateChannel.html) and [UpdateChannel](https://docs.aws.amazon.com//ivs/latest/LowLatencyAPIReference/API_UpdateChannel.html).) You can associate multiple channels with the same recording configuration. You can delete a recording configuration that is no longer associated with any channels.

Keep in mind the following constraints:
+ You must own the S3 bucket. That is, the account that sets up a channel to be recorded must own the S3 bucket where recordings will be stored.
+ The channel, recording configuration, and S3 location must be in the same AWS region. If you create channels in other regions and want to record them, you must also set up recording configurations and S3 buckets in those regions.

Recording to your S3 bucket requires authorization with your AWS credentials. To give IVS the required access, an AWS IAM [Service-Linked Role](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html) (SLR) is created automatically when the recording configuration is created: the SLR is limited to give IVS write permission only on the specific bucket.

Note that network issues between the streaming location and AWS or within AWS could result in some data loss while recording your stream. In these cases, Amazon IVS prioritizes the live stream over the recording. For redundancy, record locally via your streaming tool.

For more information (including how to set up post-processing or VOD playback on your recorded files), see [IVS Auto-Record to Amazon S3 \$1 Low-Latency Streaming](record-to-s3.md).

## How to Disable Recording
<a name="getting-started-disable-recording"></a>

To disable Amazon S3 recording on an existing channel:
+ Console — On the details page for the relevant channel, in the **Record and store** streams section, choose **Disabled** and then choose **Save Channel**. This removes the recording configuration’s association with the channel; streams on that channel will no longer be recorded.
+ CLI — Run the `update-channel` command and pass in the recording-configuration ARN as an empty string:

  ```
  aws ivs update-channel --arn "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh" --recording-configuration-arn ""
  ```

  This returns a channel object with an empty string for `recordingConfigurationArn`, indicating that the recording is disabled.

# Console Instructions for Creating an IVS Channel
<a name="create-channel-console"></a>

These steps are divided into three phases: initial channel setup, set up to auto-record to Amazon S3 (optional), and final channel creation.

## Initial Channel Setup
<a name="create-channel-console-setup"></a>

1. Open the [Amazon IVS console](https://console.aws.amazon.com/ivs).

   (You can also access the Amazon IVS console through the [AWS Management Console](https://console.aws.amazon.com).)

1. From the navigation bar, use the **Select a Region** drop-down to choose a region. Your new channel will be created in this region.

1. In the **Get started** box (top right), choose **Create Channel**.

1. Under **Channel configuration**, accept the **Default configuration**. Optionally, specify a **Channel name**. Channel names are not unique, but they provide a way for you to distinguish channels other than the channel ARN (Amazon Resource Name).

   Note: **Custom configuration** can be used for specifying certain non-default values, such as channel type or RTMP (instead of RTMPS) ingest. Custom specifications are not documented here.  
![\[Create a channel using the IVS Console: Specify channel configuration in the Create Channel window.\]](http://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/images/Accept_Default_Configuration.png)

1. If you want to auto-record to Amazon S3, continue with [Set Up to Auto-Record to Amazon S3 (Optional)](#getting-started-create-channel-console-record-s3) below. Otherwise, skip that and proceed directly to [Final Channel Creation](#getting-started-create-channel-console-final-creation).

## Set Up to Auto-Record to Amazon S3 (Optional)
<a name="getting-started-create-channel-console-record-s3"></a>

Follow these steps to enable recording while creating a new channel:

1. On the **Create channel** page, under **Record and store streams**, turn on **Enable automatic recording.** Additional fields display, to choose an existing **Recording configuration** or create a new one.  
![\[Create a channel using the IVS Console: Select Auto-record to Amazon S3.\]](http://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/images/Select_Auto_Record.png)

1. Choose **Create recording configuration**. A new window opens, with options for creating an Amazon S3 bucket and attaching it to the new recording configuration.  
![\[Create a channel using the IVS Console: Specify storage options for the recording configuration.\]](http://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/images/Click_Create_Recording_Config.png)

1. Fill out the fields:

   1. Optionally enter a **Recording configuration name**.

   1. Under **Recording configuration** accept the **Default configuration**. Note: **Custom configuration** can be used for specifying certain non-default values such as recorded renditions or merge fragmented streams. Custom specifications are not documented here.

   1. Enter a **Bucket name**.

1. Choose **Create recording configuration**, to create a new recording-configuration resource with a unique ARN. Typically, creation of the recording configuration takes a few seconds, but it can be up to 20 seconds. When the recording configuration is created, you are returned to the **Create channel** window. There, the **Record and store streams** area shows your new **Recording configuration**, with its **State** as **Active** and the S3 bucket (**Storage**) that you created.  
![\[Create a channel using the IVS Console: New recording configuration created.\]](http://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/images/Create_Recording_Config.png)

## Final Channel Creation
<a name="getting-started-create-channel-console-final-creation"></a>

1. At the bottom of the **Create channel** window, choose **Create channel**, to create a new channel with a unique ARN. To see channel details, expand **Details**. (Note: if you did not enable recording, **Auto-record to S3** is set to **Disabled** and there is no **Recording configuration** section on the screen.)  
![\[Create a channel using the IVS Console: View channel stream, playback and recording configuration, and stream sessions in the Channel Details window.\]](http://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/images/Final_Channel_Creation.png)

1. **Important**:
   + In the **Stream configuration** area, note the **Ingest server** and **Stream key**. You will use these in the next step, to set up streaming.
   + In the **Playback configuration** area, note the **Playback URL**. You will use it later, to play back your stream.

**Note**: To see SRT values (endpoint and passphrase), expand **Other ingest options** in the **Stream configuration** area.

# CLI Instructions for Creating an IVS Channel
<a name="create-channel-cli"></a>

Creating a channel with the AWS CLI is an advanced option and requires that you first download and configure the CLI on your machine. For details, see the [AWS Command Line Interface User Guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html).

Follow one of the two procedures below, depending on whether you want to create a channel with or without recording enabled.

## Create a Channel without Recording
<a name="getting-started-create-channel-cli-no-recording"></a>

1. Run the `create-channel` command and pass in an optional name:

   ```
   aws ivs create-channel --name test-channel
   ```

1. This returns a new channel:

   ```
   {
      "channel": {
         "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
         "authorized": false,
         "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
         "insecureIngest": false,
         "latencyMode": "LOW",
         "name": "channel-live",
         "playbackRestrictionPolicyArn": "arn:aws:ivs:us-west-2:123456789012:playback-restriction-policy/abcdABCDefgh",
         "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8",
         "recordingConfigurationArn": "none",
         "srt": {
            "endpoint": "a1b2c3d4e5f6.srt.live-video.net",
            "passphrase: "ZU5A3yrjGAkghUNDr0c5NXBhsPrjlmtcKMNBluh7oImwJQ3ijeyClvMKxlpPcGAMziICJ",
         },
         "tags": {},
         "type": "STANDARD"
      },
      "streamKey": {
         "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/g1H2I3j4k5L6",
         "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
         "tags": {},
         "value": "sk_us-west-2_abcdABCDefgh_567890abcdef"
      }
   }
   ```

1. **Important**: Note the `ingestEndpoint`, `streamKey value`, and `playbackUrl`. You will use these to set up streaming and playback.

## Create a Channel with Recording
<a name="getting-started-create-channel-cli-recording"></a>

**Prerequisite:** Before starting this procedure, create an Amazon S3 bucket and note its ARN. See [Getting Started with Amazon S3](https://docs.aws.amazon.com//AmazonS3/latest/userguide/GetStartedWithS3.html). The S3 bucket must be in the same region where you will create a recording configuration; see the known issue in Step 1 below.

Then follow these steps to create the channel:

1. Run the `create-recording-configuration` command and pass in the ARN of an existing Amazon S3 bucket:

   ```
   aws ivs create-recording-configuration --name configuration-1 --destination-configuration s3={bucketName=test-bucket}
   ```

   Optionally, pass the `thumbnail-configuration` parameter to manually set the thumbnail-recording mode and thumbnail interval:

   ```
   aws ivs create-recording-configuration --name configuration-1 --destination-configuration s3={bucketName=s3_bucket_name} --thumbnail-configuration recordingMode="INTERVAL",targetIntervalSeconds=60
   ```

   Optionally, pass the `recording-reconnect-window-seconds` parameter to enable merge fragmented streams functionality:

   ```
   aws ivs create-recording-configuration --name configuration-1 --destination-configuration s3={bucketName=test-bucket} --recording-reconnect-window-seconds 60
   ```

   **Known issue:** In the us-east-1 region, if you use the AWS CLI to create a recording configuration, it returns success even if the S3 bucket is in a different region. In this case, the `state` of the recording configuration is `CREATE_FAILED` (instead of `ACTIVE`). (In other regions, the CLI correctly returns failure if the bucket is in a different region.)

   **Workaround:** Ensure that your S3 bucket is in the same region as the recording configuration. If you create a recording configuration in a different region as your S3 bucket, delete that recording configuration and create a new one with an S3 bucket from the correct region.

1. This returns a new recording configuration with a unique ARN. The state of the recording configuration is `CREATING`, indicating that it is in the process of being created.

   ```
   {
      "recordingConfiguration": {
         "arn": "arn:aws:ivs:us-west-2:123456789012:recording-configuration/mhndauNaO1te",
         "name": "configuration-1",
         "destinationConfiguration": {
            "s3": {
               "bucketName": "s3_bucket_name"
            }
         },
         "recordingReconnectWindowSeconds": 60,
         "state": "CREATING",
         "tags": {},
         "thumbnailConfiguration": {
            "recordingMode": "INTERVAL",
            "targetIntervalSeconds": 60
         }
      }
   }
   ```

1. Typically, creation of the recording configuration takes a few seconds, but it can be up to 20 seconds. To check that the recording configuration has been created,run the `get-recording-configuration` command:

   ```
   aws ivs get-recording-configuration --arn "arn:aws:ivs:us-west-2:123456789012:recording-configuration/mhndauNaO1te"
   ```

1. This returns a response indicating that the recording configuration was created (`state` is `ACTIVE`):

   ```
   {
      "recordingConfiguration": {
         "arn": "arn:aws:ivs:us-west-2:123456789012:recording-configuration/mhndauNaO1te",
         "name": "configuration-1",
         "destinationConfiguration": {
            "s3": {
               "bucketName": "s3_bucket_name"
            }
         },
         "recordingReconnectWindowSeconds": 60,
         "state": "ACTIVE",
         "tags": {},
         "thumbnailConfiguration": {
            "recordingMode": "INTERVAL",
            "targetIntervalSeconds": 60
         }
      }
   }
   ```

1. To create a channel and enable recording on it, run the `create-channel` command and pass in the recording-configuration ARN:

   ```
   aws ivs create-channel --name channel-live --recording-configuration-arn  "arn:aws:ivs:us-west-2:123456789012:recording-configuration/mhndauNaO1te"
   ```

   Alternately, to enable recording on an existing channel, run the `update-channel` command and pass in the recording-configuration ARN:

   ```
   aws ivs update-channel --arn "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh" --recording-configuration-arn "arn:aws:ivs:us-west-2:123456789012:recording-configuration/mhndauNaO1te"
   ```

1. This returns a channel object with a non-"none" value for `recordingConfigurationArn`, indicating that recording is enabled. (The response below is from `create-channel`. The `update-channel` response does not include the `streamKey` object.)

   ```
   {
      "channel": {
         "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
         "authorized": false,
         "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net",
         "insecureIngest": false,
         "latencyMode": "LOW",
         "name": "channel-live",
         "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8",
         "recordingConfigurationArn": "arn:aws:ivs:us-west-2:123456789012:recording-configuration/mhndauNaO1te",
         "srt": {
            "endpoint": "a1b2c3d4e5f6.srt.live-video.net",
            "passphrase: "ZU5A3yrjGAkghUNDr0c5NXBhsPrjlmtcKMNBluh7oImwJQ3ijeyClvMKxlpPcGAMziICJ",
         },
         "tags": {},
         "type": "STANDARD"
      },
      "streamKey": {
         "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/g1H2I3j4k5L6",
         "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh",
         "tags": {},
         "value": "sk_us-west-2_abcdABCDefgh_567890abcdef"
      }
   }
   ```

1. **Important**: Note the `ingestEndpoint`, `streamKey value`, and `playbackUrl`. You will use these to set up streaming and playback.

# Step 5: Set Up Streaming Software
<a name="getting-started-set-up-streaming"></a>

You can stream (low-latency) to Amazon IVS with:
+ The native [IVS broadcast SDKs](#broadcast-sdk), which support RTMPS. We recommended this, especially for production scenarios.
+ The [Amazon IVS console](#ivs-console) — This is suitable for testing streams.
+ Other streaming software and hardware encoders — You can use any streaming encoder that supports the RTMP, RTMPS, or SRT protocols. Several examples are described below, using Open Broadcast Software (OBS) and FFmpeg with RTMPS and SRT. RTMPS enables high security via use of an encrypted TLS stream.

Key encoder settings are keyframe interval (2 seconds) and resolution/bitrate/frame rate (which are interrelated). For more detail on encoder settings, see: 
+ [Streaming Configuration](streaming-config.md) in the *Amazon IVS User Guide* 
+ This blog post: [Setting Up for Streaming with Amazon Interactive Video Service](https://aws.amazon.com/blogs/media/setting-up-for-streaming-with-amazon-ivs/)

**Notes:** 
+ The maximum duration of Amazon IVS streams is 48 hours. After that, the stream is terminated and the streaming session is disconnected. A successful reconnect (automatically or manually) starts a new stream.
+ If your encoder stops sending data (e.g., due to a temporary network issue), Amazon IVS waits for 30 seconds. If no broadcaster data is received during this time, Amazon IVS disconnects.

## Streaming with the Amazon IVS Broadcast SDK
<a name="broadcast-sdk"></a>

To broadcast from your iOS or Android applications, you can use the Amazon IVS broadcast SDK. The broadcast SDK leverages the Amazon IVS architecture and will see continual improvement and new features, alongside Amazon IVS. As a native mobile broadcast SDK, it is designed to minimize the performance impact on your application and on the devices with which your users access your application.


| To broadcast from … | You can use … | Notes | 
| --- | --- | --- | 
| Your Android or iOS applications | Amazon IVS Android or iOS broadcast SDK | As a native mobile broadcast SDK, it is designed to minimize the performance impact on your application and on the devices with which your users access your application. | 
| A web environment | Amazon IVS Web broadcast SDK | As a web broadcast SDK, the Amazon IVS Web Broadcast SDK allows you to broadcast from web environments using WebRTC. It boasts cross-browser and cross-platform support. | 

For details, see [IVS Broadcast SDK \$1 Low-Latency Streaming](broadcast.md).

## Streaming with the Amazon IVS Console
<a name="ivs-console"></a>

1. Open the [Amazon IVS console](https://console.aws.amazon.com/ivs).

   (You can also access the Amazon IVS console through the [AWS Management Console](https://console.aws.amazon.com).)

1. In the navigation pane, select **Channels**. (If the nav pane is collapsed, expand it by selecting the hamburger icon.)

1. Select the channel to which you want to broadcast, to go to its details page.

1. Select the **Broadcast** tab. (Tabs are below the **General Configuration** section.)

1. You will be prompted to grant the IVS console access to your camera and microphone; **Allow** those permissions.

1. Toward the bottom of the **Broadcast** tab, use the dropdown boxes to select input devices for the microphone and camera.

1. To begin streaming, select **Start broadcasting**.

1. To view the live stream, go to the **Playback** tab.

   **Note**: After you start the stream, expect a brief delay (usually under 30 seconds) before it is viewable in the playback tab.

You can use this feature to simultaneously broadcast to multiple channels.

**Note**: Streaming from the console consumes resources, and you will incur live-video input costs. To learn more, see [Live Video Input Costs](https://aws.amazon.com/ivs/pricing/#Low-Latency_Streaming) on the IVS Pricing page.

## Streaming with OBS Studio using RTMPS
<a name="obs-rtmps"></a>

([OBS Studio](https://obsproject.com/)) is a free, open-source software suite for recording and live streaming. OBS provides real-time source and device capture, scene composition, encoding, recording, and streaming. 

Follow these steps to get up and running quickly with OBS Studio v30.2 or later:

1. Download and install the software: [https://obsproject.com/download](https://obsproject.com/download).

1. Run the OBS Studio **Auto-Configuration Wizard**, which appears when you load OBS Studio for the first time. Follow the steps and accept the defaults.

1. At **Stream Information**, choose **Amazon IVS** from the **Service** dropdown and enter the **Stream Key**.

   If you created the channel with the Amazon IVS console, the **Stream Key** you enter in OBS is the **Stream key** from the console: `sk_us-west-2_abcd1234efgh5678ijkl`

   If you created the channel with the AWS CLI, the **Stream Key** you enter in OBS is the **streamKey value** from the CLI response `sk_us-west-2_abcd1234efgh5678ijkl`

   If your IVS channel is configured for multitrack video input, select **Enable Multitrack Video**. Optionally, configure the **Maximum Video Tracks** and **Maximum Streaming Bandwidth** settings, which are used to limit automatically configured stream settings.

1. For **Video Output Resolution** and **Bitrate**, refer to [Channel Types](streaming-config.md#streaming-config-settings-channel-types) in *Amazon IVS Streaming Configuration*. If either value chosen by the OBS wizard exceeds the values allowed by Amazon IVS, you should manually adjust the values to avoid a failed connection to Amazon IVS. After the wizard completes:

   1. To adjust video resolution, use **Settings > Video > Output (Scaled) Resolution**.

   1. To adjust video bitrate, use **Settings > Output > Streaming > Video Bitrate**. 

      **Note:** This does not affect the live stream if you previously checked **Enable Multitrack Video**.

1. We recommend a 2-second **Keyframe Interval** to improve the stream stability and avoid buffering in the viewer playback. After the wizard completes, go to **Settings > Output > Output Mode**, select **Advanced**, and on the **Streaming** tab, ensure that **Keyframe Interval** is 2.

   **Note:** Keyframe Interval is configured automatically if you previously checked **Enable Multitrack Video**.

1. In the OBS Studio main window, choose **Start Streaming**.

For more on streaming with OBS Studio, see [OBS Studio Quickstart](https://obsproject.com/wiki/OBS-Studio-Quickstart).

You can modify your OBS settings manually later:

1. Choose **Settings > Stream**.

1. Choose **Amazon IVS** from the dropdown.

1. Paste in the **Stream Key**.

You can run the wizard again at any time: choose **Tools > Auto-Configuration Wizard**.

Optionally, in **Settings > General**, enable local recording to save your live stream for later use. As mentioned earlier, network issues between the broadcast and AWS or within AWS could result in some data loss while recording your stream. In these cases, Amazon IVS prioritizes the live stream over the recording. Recording locally via your streaming tool provides redundancy.

It’s advisable to check for OBS Studio updates regularly and update to the most current version. (For instance, if you get a “Failed to connect to server” error, you may be using an old version of OBS Studio that does not support RTMPS.)

## Streaming with OBS Studio using SRT
<a name="obs-srt"></a>

Follow these steps to get up and running quickly with the Secure Reliable Transport protocol:

1. Download and install the software: [https://obsproject.com/download](https://obsproject.com/download).

1. Run the OBS Studio **Auto-Configuration Wizard**, which appears when you load OBS Studio for the first time. Follow the steps and accept the defaults.

1. At **Stream Information**, choose **Custom...** from the **Service** dropdown and enter the **Server (Ingest server)** and **Stream Key**.

   If you created the channel with the AWS CLI:
   + The **Server** you enter in OBS is a combination of five things:
     + An ingestion protocol: `srt://`
     + The **endpoint** from the `srt` struct in the CLI response: 

       `a1b2c3d4e5f6.srt.live-video.net`
     + A port: `9000`
     + A streamid, which is the **streamKey value** from the CLI response:

       `sk_us-west-2_abcd1234efgh5678ijkl`
     + A passphrase, used to encrypt the content. Use this only if **insecure ingest** is not enabled.

       `ZU5A3yrjGAkghUNDr0c5NXBhsPrjlmtcKMNBluh7oImwJQ3ijeyClvMKxlpPcGAMziICJ`

     The complete entry is:

     `srt://a1b2c3d4e5f6.srt.live-video.net:9000?streamid=sk_us-west-2_abcd1234efgh5678ijkl&passphrase=ZU5A3yrjGAkghUNDr0c5NXBhsPrjlmtcKMNBluh7oImwJQ3ijeyClvMKxlpPcGAMziICJ`
   + The **Stream Key** you enter in OBS will remain empty for the SRT protocol.

1. For **Video Output Resolution** and **Bitrate**, refer to [Channel Types](streaming-config.md#streaming-config-settings-channel-types) in *Amazon IVS Streaming Configuration*. If either value chosen by the OBS wizard exceeds the values allowed by Amazon IVS, you should manually adjust the values to avoid a failed connection to Amazon IVS. After the wizard completes: 

   1. To adjust video resolution, use **Settings > Video > Output (Scaled) Resolution**.

   1. To adjust video bitrate, use **Settings > Output > Streaming > Video Bitrate**.

1. We recommend a 2-second **Keyframe Interval** to improve the stream stability and avoid buffering in the viewer playback. After the wizard completes, go to **Settings > Output > Output Mode**, select **Advanced**, and on the **Streaming** tab, ensure that **Keyframe Interval** is 2.

1. In the OBS Studio main window, choose **Start Streaming**. 

You can modify your OBS settings manually later:

1. Choose **Settings > Stream**.

1. Choose **Custom** from the dropdown.

1. Paste in the **Server** and/or **Stream Key**.

You can run the wizard again at any time: choose **Tools > Auto-Configuration Wizard**.

Optionally, in **Settings > General**, enable local recording to save your live stream for later use. As mentioned earlier, network issues between the broadcast and AWS or within AWS could result in some data loss while recording your stream. In these cases, Amazon IVS prioritizes the live stream over the recording. Recording locally via your streaming tool provides redundancy.

It’s advisable to check for OBS Studio updates regularly and update to the most current version. (For instance, if you get a "Failed to connect to server" error, you may be using an old version of OBS Studio that does not support RTMPS.)

## Streaming a Recorded Video with FFmpeg using RTMPS
<a name="ffmpeg-rtmps"></a>

Follow these steps:

1. Download and install FFmpeg: [https://www.ffmpeg.org/download.html](https://www.ffmpeg.org/download.html).

1. Set `$VIDEO_FILEPATH` to the location of an MP4 video to stream:

   ```
   VIDEO_FILEPATH=/home/test/my_video.mp4
   ```

1. Set `STREAM_KEY` to your StreamKey **value**:

   ```
   STREAM_KEY=sk_us-west-2_abcd1234efgh5678ijkl
   ```

1. Set `INGEST_ENDPOINT` to your **ingestEndpoint** (from the AWS CLI):

   ```
   INGEST_ENDPOINT=a1b2c3d4e5f6.global-contribute.live-video.net
   ```

1. Start streaming with the following terminal command (this is all one line):

   ```
   ffmpeg -re -stream_loop -1 -i $VIDEO_FILEPATH -r 30 -c:v libx264 -pix_fmt yuv420p -profile:v main -preset veryfast -x264opts "nal-hrd=cbr:no-scenecut" -minrate 3000 -maxrate 3000 -g 60 -c:a aac -b:a 160k -ac 2 -ar 44100 -f flv rtmps://$INGEST_ENDPOINT:443/app/$STREAM_KEY
   ```

   *Note, the above command is an example. For production streaming, tune the parameters to your needs.*

## Streaming a Recorded Video with FFmpeg using SRT
<a name="ffmpeg-srt"></a>

1. Download and install FFmpeg: [https://www.ffmpeg.org/download.html](https://www.ffmpeg.org/download.html). If you are using an old/compiled version of FFmpeg, build a new version with the `--enable-libsrt` flag.

1. Verify that SRT is available for use in FFmpeg: run the following command and ensure that `libsrt` is in the output. If `libsrt` is not there, rebuild or get a newer version of FFmpeg which supports SRT.

   ```
   ffmpeg -version | grep enable-libsrt
   ```

1. Set `$VIDEO_FILEPATH` to the location of an MP4 video to stream:

   ```
   VIDEO_FILEPATH=/home/test/my_video.mp4
   ```

1. Set `STREAM_KEY` to your StreamKey **value**:

   ```
   STREAM_KEY=sk_us-west-2_abcd1234efgh5678ijkl
   ```

1. Set `INGEST_ENDPOINT` to your **endpoint** (from the AWS CLI under the `srt` object):

   ```
   INGEST_ENDPOINT=a1b2c3d4e5f6.srt.live-video.net
   ```

1. Set `PASSPHRASE` to your **passphrase** (from the AWS CLI under the `srt` object). Use passphrase only if insecure ingest is not enabled for the channel. 

   ```
   PASSPHRASE=ZU5A3yrjGAkghUNDr0c5NXBhsPrjlmtcKMNBluh7oImwJQ3ijeyClvMKxlpPcGAMziICJ
   ```

1. Start streaming with the following terminal command (this is all one line):

   ```
   ffmpeg -re -i $VIDEO_FILEPATH -c copy -f mpegts "srt://$INGEST_ENDPOINT:9000?streamid=$STREAM_KEY&passphrase=$PASSPHRASE”
   ```

# Step 6: View Your Live Stream
<a name="getting-started-view-stream"></a>

You can view your live stream with:
+ The native [IVS player SDKs](#view-stream-player-sdks).
+ The [Amazon IVS console](#view-stream-console).

## Viewing with the Amazon IVS Player SDKs
<a name="view-stream-player-sdks"></a>

1. Set up the IVS Player. Start with the [IVS Player SDK overview](player.md), then read the appropriate platform-specific Player guide(s).

1. From the [Amazon IVS console](https://console.aws.amazon.com/ivs), get the **Playback URL** that was generated when you created your channel. (See [Final Channel Creation](create-channel-console.md#getting-started-create-channel-console-final-creation) earlier in this *Getting Started* guide.)

1. Call `player.load()` with the playback URL.

## Viewing with the Amazon IVS Console
<a name="view-stream-console"></a>

1. Open the [Amazon IVS console](https://console.aws.amazon.com/ivs).

   (You can also access the Amazon IVS console through the [AWS Management Console](https://console.aws.amazon.com).) 

1. On the navigation pane, choose **Live channels**. (If the nav pane is collapsed, first open it by choosing the hamburger icon.)

1. Choose the channel whose stream you want to view, to go to a details page for that channel.

   The live stream is playing in the **Live stream** section of the page.

**Note**: Playback from the console consumes resources, and you will incur live-video output costs. To learn more, see [Live Video Output Costs](https://aws.amazon.com/ivs/pricing/#Live_Video_Output_Costs) on the IVS Pricing page.

**Note**: After you start streaming, there is a short delay (up to 30 seconds, usually less) before your stream can be viewed in the console.

# Step 7: Check Your Service-Quota Limits (Optional)
<a name="getting-started-check-service-quota"></a>

All accounts have limits on the number of concurrent viewers and concurrent broadcasts. *Ensure that your limits are adequate and request an increase if needed, especially if you are planning a large streaming event*. For details, see [IVS Service Quotas](service-quotas.md).

# Step 8: Prevent Undesired Content and Viewers (Recommended)
<a name="getting-started-prevent-undesired-content"></a>

Malicious users may try to re-stream undesirable content (e.g., professional sports) on your platform, or try to embed your platform’s streams on another website without permission. This kind of streaming can dramatically increase the amount of live-streamed video that your application is serving as well as the costs associated with it, without adding value to your business. In addition to providing you with controls to stop active streams, Amazon IVS provides resources to help detect and prevent this kind of behavior in the first place; see [Undesired Content and Viewers in IVS](undesired-content.md).

To constrain playback to specific origins and/or countries, use a playback restriction policy. Note that these policies can be used only with public channels. [Undesired Content and Viewers in IVS](undesired-content.md) also discusses the use of private channels to control undesired content.

Note that playback restriction policies (such as geo-blocking) cannot be used simultaneously with playback authorization. If playback authorization is enabled for a channel, any configured playback restriction policies will be ignored. To enforce geo-restrictions on a private channel, validate the user's location within your token generation logic before issuing a playback token.