# Kinesis code examples for the SDK for Python ## Overview Shows how to use the AWS SDK for Python (Boto3) to work with Amazon Kinesis. *Kinesis makes it easy to collect, process, and analyze video and data streams in real time.* ## ⚠ Important * Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/?aws-products-pricing.sort-by=item.additionalFields.productNameLowercase&aws-products-pricing.sort-order=asc&awsf.Free%20Tier%20Type=*all&awsf.tech-category=*all) and [Free Tier](https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free%20Tier%20Types=*all&awsf.Free%20Tier%20Categories=*all). * Running the tests might result in charges to your AWS account. * We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege). * This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services). ## Code examples ### Prerequisites For prerequisites, see the [README](../../README.md#Prerequisites) in the `python` folder. Install the packages required by these examples by running the following in a virtual environment: ``` python -m pip install -r requirements.txt ``` ### Single actions Code excerpts that show you how to call individual service functions. #### Amazon Kinesis Data Streams actions * [Create a stream](streams/kinesis_stream.py#L44) (`CreateStream`) * [Delete a stream](streams/kinesis_stream.py#L86) (`DeleteStream`) * [Describe a stream](streams/kinesis_stream.py#L66) (`DescribeStream`) * [Get data in batches from a stream](streams/kinesis_stream.py#L123) (`GetRecords`) * [Put data into a stream](streams/kinesis_stream.py#L100) (`PutRecord`) #### Amazon Kinesis Data Analytics actions * [Add an input stream to an application](analyticsv2/analytics_application.py#L224) (`AddApplicationInput`) * [Add an output stream to an application](analyticsv2/analytics_application.py#L259) (`AddApplicationOutput`) * [Create an application](analyticsv2/analytics_application.py#L110) (`CreateApplication`) * [Delete an application](analyticsv2/analytics_application.py#L136) (`DeleteApplication`) * [Describe an application](analyticsv2/analytics_application.py#L150) (`DescribeApplication`) * [Describe an application snapshot](analyticsv2/analytics_application.py#L171) (`DescribeApplicationSnapshot`) * [Discover a data format for a stream](analyticsv2/analytics_application.py#L196) (`DiscoverInputSchema`) * [Start an application](analyticsv2/analytics_application.py#L321) (`StartApplication`) * [Stop an application](analyticsv2/analytics_application.py#L343) (`StopApplication`) * [Update an application](analyticsv2/analytics_application.py#L291) (`UpdateApplication`) ## Run the examples ### Instructions Run the Kinesis Data Analytics usage demonstration at a command prompt with the following command: ``` python kinesisanalyticsv2_demo.py ``` ### Tests ⚠ Running tests might result in charges to your AWS account. To find instructions for running these tests, see the [README](../../README.md#Tests) in the `python` folder. ## Additional resources * [Kinesis Developer Guide](https://docs.aws.amazon.com/streams/latest/dev/introduction.html) * [Kinesis API Reference](https://docs.aws.amazon.com/kinesis/latest/APIReference/Welcome.html) * [SDK for Python Kinesis reference](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/kinesisanalyticsv2.html) * [SDK for Python Kinesis Data Analytics reference](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/kinesisanalyticsv2.html) --- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0