DEV Community

Cover image for Amazon IVS: Build Live Streaming Without the Complexity
Tanseer for AWS Community Builders

Posted on

Amazon IVS: Build Live Streaming Without the Complexity

Live video in your app without running a single streaming server. Stop two in the AWS Hidden Gems series.

About this series

Most AWS learning stops after EC2, S3, IAM, and Lambda. But AWS has over two hundred services, and many of the most useful ones rarely appear in tutorials.

AWS Hidden Gems covers those underrated services you shouldn't ignore. Each article picks one, then explains why it exists, what it does, where it fits, and how to set it up from the console. Know the four basics above and you can follow along. Everything else gets explained as it comes up.

Today's service: Amazon IVS

In the last article, MediaConvert handled video files that already existed. Amazon IVS, short for Interactive Video Service, is for the opposite case: video happening right now, like a live class, a product launch, or a gaming stream. It is the managed way to put live video into your app or website.

Why does this service exist?

Live streaming is genuinely hard to build. You need a server to receive the incoming video, something to transcode it into different qualities, a way to package it for players, a global network to deliver it, and a video player for viewers. On top of that, live audiences are spiky. Ten viewers one minute, ten thousand the next. Getting low latency, meaning a small delay between the camera and the viewer, takes real expertise.

Before IVS, teams stitched this together from separate services like MediaLive, MediaPackage, and a content delivery network, then built and tuned their own player. It worked, but it was a lot of moving parts.

IVS bundles all of it into one service. You create a channel, point your camera software at it, and share a playback URL. IVS handles ingest, transcoding, delivery, and scaling, and it gives you a ready made player. It is built on the same technology that runs Twitch.

What is Amazon IVS?

Amazon IVS is a fully managed live streaming service. It comes in two modes.

Low latency streaming is for broadcasting to an audience, from one host to thousands or millions of viewers, with a delay of only a few seconds. This is the classic live stream.

Real time streaming is for interactive video where the delay is under a third of a second. Think multiple hosts on screen together, audio rooms, or a guest joining a broadcast. It supports up to twelve hosts publishing at once.

Both give you SDKs for web, iOS, and Android, so you can broadcast and play video from inside your own app. IVS can also record streams to S3, add live chat, and carry timed metadata, which is data synced to a moment in the video for things like polls or product highlights.

What IVS does not do is process video files that already exist. That is MediaConvert, from the last article. IVS is only for live.

A real world problem

A fitness startup wants live workout classes in its app. An instructor streams from a studio, and members join from their phones at home.

Building this from scratch means running ingest servers, transcoding the video for different connection speeds, delivering it worldwide with a small delay, and writing a player for iOS and Android. The team is four people. None of that is their actual product.

With IVS, they create a channel, give the instructor a stream key, and drop the IVS player into their app pointed at the playback URL. The hard parts are handled, and they get back to building the fitness features that make the app worth using.

Real world use cases

  • Fitness and education run live classes with instructors streaming to members at home
  • Gaming and creator platforms build their own Twitch style streaming without owning the infrastructure
  • Retail and ecommerce run live shopping shows where hosts demo products and viewers buy in the moment
  • Events stream conferences, launches, and town halls to a large remote audience
  • Social apps add live audio rooms and multi host video using real time streaming
  • Auctions and betting need the tiny delay of real time streaming so no viewer sees the action late The common thread is live video inside an app, without a streaming team to run it.

Where it fits in AWS

The flow is simple. Broadcast software or the IVS broadcast SDK sends live video to an IVS channel using RTMPS, a secure protocol for pushing live streams. IVS transcodes the video into several qualities and delivers it through a playback URL. Viewers watch using the IVS player in your app. Optionally, IVS records the stream to S3 and sends stream events, like start and stop, to EventBridge.

flowchart LR
    A[Host camera and OBS] -->|RTMPS| B[IVS channel ingest]
    B --> C[IVS transcode and deliver]
    C -->|Playback URL| D[IVS player in your app]
    C -->|Optional recording| E[S3 bucket]
    C -->|Stream events| F[EventBridge]
Enter fullscreen mode Exit fullscreen mode

IVS is the whole live pipeline in one service. You bring the camera and the app, and it handles everything in between.

How the workflow runs

You create a channel, which gives you three things: an ingest endpoint where video goes in, a stream key that authorizes your broadcast, and a playback URL where viewers watch. You put the ingest endpoint and stream key into your broadcast software, then start streaming. IVS ingests the video, transcodes it into multiple qualities on the fly, and serves it through the playback URL with only a few seconds of delay. Viewers open your app and the player loads the stream. When you stop broadcasting, the stream ends, and if recording is on, the file lands in S3.

flowchart TD
    A[Create channel] --> B[Get ingest endpoint, stream key, playback URL]
    B --> C[Start broadcasting to the ingest endpoint]
    C --> D[IVS transcodes and delivers]
    D --> E[Viewers watch through the player]
    C --> F[Stop broadcasting ends the stream]
Enter fullscreen mode Exit fullscreen mode

Setting it up in the AWS Console

You will create a channel, then stream to it using OBS Studio, a free and popular broadcast tool.

  1. Sign in to the AWS Console, search for IVS or Interactive Video Service, and open it. Check the region in the top right corner, since your channel lives in one region.
  2. Click Create channel. For a first test, keep the default setup. The settings that matter are the channel type, which you can leave as Standard so IVS transcodes to several qualities, and the latency, which you can leave as Low. Give the channel a name and click Create channel.
  3. On the channel page, IVS shows three things you need. Copy the Ingest server, which is an RTMPS address. Reveal and copy the Stream key, and keep it secret, since anyone who has it can stream to your channel. Copy the Playback URL as well.
  4. Install and open OBS Studio. Go to Settings, then Stream. Set Service to Custom, paste the IVS ingest server into the Server field, and paste your stream key into the Stream Key field. Click OK.
  5. In OBS, add a source so there is something to show, such as your webcam or a screen capture, then click Start Streaming.
  6. Go back to the channel page in the IVS console. Within a few seconds the channel shows as Live with a preview of your video. You can also open the Playback URL in the IVS web player to watch it exactly as a viewer would.
  7. To confirm everything works, check that the preview matches your camera and plays smoothly. Click Stop Streaming in OBS to end the stream.
  8. To save your streams, edit the channel and turn on recording to an S3 bucket. IVS stores each stream there automatically, and the console sets up the permission it needs to write to the bucket. No IAM role is needed to broadcast, because the stream key is what authorizes you. Common mistakes: if OBS says it cannot connect, the ingest server or stream key is usually wrong, so paste them again carefully. If the console never shows Live, make sure OBS is actually streaming and that you picked the Custom service option rather than a preset like Twitch.

Going live from code

Two pieces of code make IVS practical: creating a channel on your backend, and showing the stream in your app.

First, create a channel with the AWS SDK. This returns the same ingest endpoint, stream key, and playback URL you saw in the console.

import boto3

ivs = boto3.client("ivs")

response = ivs.create_channel(
    name="my-live-channel",
    type="STANDARD",     # transcodes the stream into several qualities
    latencyMode="LOW",   # a few seconds of delay, good for most live streams
)

channel = response["channel"]
stream_key = response["streamKey"]["value"]

print("Ingest server:", channel["ingestEndpoint"])
print("Playback URL:", channel["playbackUrl"])
print("Stream key:", stream_key)   # keep this secret
Enter fullscreen mode Exit fullscreen mode

Then, on the viewer side, load the playback URL in the IVS web player.

<script src="https://player.live-video.net/1.x/amazon-ivs-player.min.js"></script>
<video id="video-player" playsinline controls></video>
<script>
  const player = IVSPlayer.create();
  player.attachHTMLVideoElement(document.getElementById("video-player"));
  player.load("YOUR_PLAYBACK_URL");
  player.play();
</script>
Enter fullscreen mode Exit fullscreen mode

To call create_channel, the backend's IAM role needs IVS permissions such as ivs:CreateChannel. The player needs nothing secret, since the playback URL is safe to share with viewers.

Pricing

Item Detail
What you pay for Input hours (video you send in) plus output hours (video sent to viewers)
Rate driver Video quality, grouped as SD, HD, and Full HD
Input, HD About $2.00 per streaming hour (US)
Output, HD About $0.15 per viewer hour (US)
Cost example 1 hour HD stream watched by 100 viewers, about $2 input plus $15 output, near $17
Real time streaming Billed separately, by participant minutes
Recording Saved to S3, so normal S3 storage rates apply
Free tier None for IVS streaming hours

The AWS live video family

AWS Live and Media Services
├── Amazon IVS      all in one live streaming with a built in player
├── MediaLive       broadcast grade live encoding you assemble yourself
├── MediaPackage    packaging and protection for live and on demand video
├── MediaConnect    reliable transport of live video between points
└── MediaConvert    file based transcoding for videos that already exist
Enter fullscreen mode Exit fullscreen mode

The choice comes down to control versus speed. IVS is the fastest way to add live video to an app, with the player included. MediaLive with MediaPackage is the build it yourself route when you need fine control over a broadcast. MediaConvert, from the last article, is for finished files rather than live video.

Wrapping up

IVS turns live streaming from a big infrastructure project into a channel, a stream key, and a playback URL. You bring the camera and the app, and IVS handles ingest, transcoding, delivery, and the player. Next time you need live video in a product, you know the service that removes the hard parts.

Series progress

You are on stop two of AWS Hidden Gems.

  1. AWS Elemental MediaConvert
  2. Amazon IVS (you are here)
  3. Amazon Rekognition
  4. Amazon Personalize
  5. AWS AppSync Next up is Amazon Rekognition, which adds AI vision to your apps so they can understand what is in an image or video.

Let's connect

Questions, corrections, or want to talk through where this fits in your own project? Reach me at khantanseer43@gmail.com.

Top comments (0)