[SEO Subhead]
This Guidance demonstrates how to use HAQM Kinesis Video Streams with WebRTC to enable low-latency, bi-directional, peer-to-peer video streaming from home surveillance cameras. Kinesis Video Streams, a managed service for real-time video processing, can store video and other media files for replay and analytics, while WebRTC facilitates direct, low-latency connections between the camera and client applications. This Guidance allows seamless, responsive home monitoring from mobile devices or web browsers, as the peer-to-peer WebRTC connection minimizes latency and bandwidth compared to traditional client-server streaming. It also includes sample applications with the included software development kit (SDK). Camera manufacturers and connected home providers can use the SDK as a starting point to build custom camera management and viewing experiences. This helps them to more easily integrate high-quality, low-latency video capabilities into their connected home offerings and provides consumers with a reliable home monitoring experience.
Please note: [Disclaimer]
Architecture Diagram

-
Live View Smart Home Surveillance Cameras
-
Smart Home Surveillance Camera
-
Live View Smart Home Surveillance Cameras
-
This architecture diagram shows how use Kinesis Video Streams for WebRTC, allowing for the low-latency, bi-directional, peer-to-peer streaming of video from home surveillance cameras.
Step 1
The camera authenticates to AWS IoT Core using the Credentials Provider.Step 2
The HAQM Kinesis Video Streams software development kit (SDK) opens signaling to the signaling channel, awaiting viewer requests.Step 3
HAQM CloudFront is the content delivery network (CDN) for the static single-page application (SPA) hosted in HAQM Simple Storage Service (HAQM S3).Step 4
The camera owner logs in to the mobile client. HAQM Cognito and HAQM API Gateway manage user access for the mobile client.Step 5
The mobile client calls an API to look up the cameras belonging to the owner. The owner then selects a specific camera to initiate real-time video streaming.Step 6
The mobile client initiates a connection to the Kinesis Video Streams signaling channel, a WebSocket connection that the camera is listening to for viewer connection requests.The viewer and the camera negotiate connection details by sending messages to each other over the signaling channel.
Step 7
The mobile client and the camera establish a peer-to-peer connection. The Kinesis Video Streams client streams video data through the WebRTC peer connection, and the camera owner views the video stream in the mobile client.Optionally, the WebRTC data channel can be utilized for bi-directional command and control messages. If a direct, peer-to-peer connection cannot be established, video data can be relayed through the Kinesis Video Streams Traversal Using Relays around NAT (TURN) server.
-
Smart Home Surveillance Camera
-
This architecture diagram shows how to stream video from smart home cameras to Kinesis Video Streams for storage, playback, and analytics. It also shows how to send push notifications to mobile application users to notify them of events.
Step 1
The camera detects an event and begins recording video and audio using local storage.Step 2
The camera application publishes an event to AWS IoT Core. A rule is configured in Rules for IoT Core with an action to publish an HAQM Simple Notification Service (HAQM SNS) message, triggering a push notification to the end user's mobile application.An AWS Lambda function subscribes to the HAQM SNS topic to save events in an HAQM DynamoDB table.
Step 3
The Kinesis Video Streams Producer SDK uses the X.509 certificate to authenticate to AWS IoT Core using the credentials provider. It then streams media to a stream belonging to the camera for storage, playback, and analytics.Step 4
Kinesis Video Streams is configured with the HAQM S3 delivery feature to automatically extract still images from the uploaded media to deliver to an HAQM S3 bucket of your choice.An HAQM S3 trigger is configured to invoke a Lambda function, which will invoke an HAQM Rekognition image to perform object detection and trigger notifications in HAQM SNS.
Step 5
The camera owner logs in to the mobile client. HAQM Cognito and API Gateway manage user access for the mobile client.Step 6
The mobile client application invokes an API to retrieve a list of cameras and view a list of events. The events list view uses the images stored in HAQM S3 as preview thumbnails for viewing the stored media.Step 7
The mobile application user selects an event to replay and uses Kinesis Video Streams playback to replay the stored video and audio.
Get Started

Well-Architected Pillars

The AWS Well-Architected Framework helps you understand the pros and cons of the decisions you make when building systems in the cloud. The six pillars of the Framework allow you to learn architectural best practices for designing and operating reliable, secure, efficient, cost-effective, and sustainable systems. Using the AWS Well-Architected Tool, available at no charge in the AWS Management Console, you can review your workloads against these best practices by answering a set of questions for each pillar.
The architecture diagram above is an example of a Solution created with Well-Architected best practices in mind. To be fully Well-Architected, you should follow as many Well-Architected best practices as possible.
-
Operational Excellence
This Guidance uses Kinesis Video Streams and AWS IoT Core, which allow users to identify ways of optimizing the location event ingestion workflow and ensure the workflow can scale in the event of a large influx of new events. For instance, Kinesis Video Streams sends metrics to HAQM CloudWatch, giving users visibility into video streaming data. In addition, AWS IoT Core sends metrics to CloudWatch to monitor incoming messages and alerts when ingestion stops or slows, indicating possible network or other issues. AWS IoT Core also provides fleet management capabilities to give operators insights into connected camera status.
-
Security
AWS Identity and Access Management (IAM) policies scope permissions for the required AWS services to the minimum level. Kinesis Video Streams allows scoping permissions to authorized users and devices; it also protects data at rest with AWS Key Management Service (AWS KMS) and in transit with TLS. Moreover, AWS IoT Core policies control device access to MQTT topics and cloud interactions. Finally, HAQM Cognito provides authentication and authorization controls for mobile applications.
-
Reliability
Serverless services designed across multiple Availability Zones (AZs) provide resilience against a number of failures. Specifically, it helps to ensure data ingestion into AWS IoT Core, processing by Lambda, and storage in HAQM S3, which offers versioning, object lock, and lifecycle configuration for reliability.
DynamoDB provides features like on-demand backup, point-in-time recovery, and global tables for data sync. Also, Kinesis Video Streams is built on AWS Regions and AZs, which offer low-latency, high-throughput, and highly redundant networking. This allows applications and databases to automatically failover between AZs with higher availability, fault tolerance, and scalability than traditional data centers.
-
Performance Efficiency
AWS IoT Core scales to accommodate increasing message ingestion while offering low latency. Lambda enables the configuration of concurrency reservations to reduce cold start times and enhance performance. And Kinesis Video Streams automatically provisions and scales all the necessary infrastructure to ingest streaming video data from millions of devices.
-
Cost Optimization
Kinesis Video Streams for WebRTC reduces the need for cloud-based video streaming through peer-to-peer connectivity while providing pay-as-you-go TURN service pricing when cloud streaming is required. AWS IoT Core scales pricing with usage, enabling ongoing cost optimization by identifying goals, measuring metrics, and making incremental improvements, aided by cost tagging and billing groups. Cloud storage with HAQM S3 enables agility and cost savings through unlimited scale, storage class selection, and features like the HAQM S3 Intelligent-Tiering storage class. Similarly, DynamoDB offers cost optimization through capacity modes, table classes, and cost allocation tags.
-
Sustainability
The majority of services comprising this Guidance are constructed using serverless technologies, thereby reducing the required compute footprint. For instance, Lambda will only execute when invoked by AWS IoT Core, and HAQM S3 can use more energy-efficient storage volumes for long-term media storage, such as thumbnail preview images. By building upon serverless services, the overall compute usage can be diminished, enabling the construction of a fully event-driven architecture that scales up and down with traffic demands, consuming less energy during periods of lower ingestion.
Furthermore, employing Kinesis Video Streams eliminates the need to maintain steady-state applications running on instances, instead automatically provisioning and elastically scaling all the infrastructure required to ingest streaming video data from millions of devices.
Additional Resources

These additional resources can assist in the development of both camera-side applications as well as web and mobile applications. Included are links to the associated GitHub repositories containing example applications.
-
HAQM Kinesis Video Streams
This developer guide provides an overview of the C++ Producer Library for HAQM Kinesis Video Streams, including the key objects, features, and a 3-step procedure to use the SDK. This developer guide provides a step-by-step guide on how to set up and use the HAQM Kinesis Video Streams C++ Producer SDK on a Raspberry Pi device. Using HLS in HTML and JavaScript » This developer guide provides an example for how to use HTTP Live Streaming (HLS) to view Kinesis Video Streams, including how to retrieve an HLS streaming session URL, display the stream in a web page using various players, and troubleshoot common HLS playback issues. -
HAQM Kinesis Video Streams WebRTC
This developer guide provides instructions on how to download, build, and run the Kinesis Video Streams with WebRTC SDK in C for embedded devices, including details on supported codecs and sample applications. This developer guide provides instructions for installing, using, and customizing the Kinesis Video Streams with WebRTC SDK in JavaScript for web applications. These examples includes a framework for building mobile applications with WebRTC capabilities for Android and iOS, as well as integration with HAQM Kinesis Video Streams to enable real-time video streaming.
Disclaimer
The sample code; software libraries; command line tools; proofs of concept; templates; or other related technology (including any of the foregoing that are provided by our personnel) is provided to you as AWS Content under the AWS Customer Agreement, or the relevant written agreement between you and AWS (whichever applies). You should not use this AWS Content in your production accounts, or on production or other critical data. You are responsible for testing, securing, and optimizing the AWS Content, such as sample code, as appropriate for production grade use based on your specific quality control practices and standards. Deploying AWS Content may incur AWS charges for creating or using AWS chargeable resources, such as running HAQM EC2 instances or using HAQM S3 storage.
References to third-party services or organizations in this Guidance do not imply an endorsement, sponsorship, or affiliation between HAQM or AWS and the third party. Guidance from AWS is a technical starting point, and you can customize your integration with third-party services when you deploy the architecture.