These examples demonstrate how to perform several Amazon Kinesis (Kinesis) operations using the developer preview version of the AWS SDK for Rust.
Kinesis makes it easy to collect, process, and analyze video and data streams in real time.
- Create a data stream (CreateStream)
- Delete a data stream (DeleteStream)
- Describe a data stream (DescribeStream)
- List your data streams (ListStreams)
- Add a record to a data stream (PutRecord)
- We recommend that you grant this code least privilege, or at most the minimum permissions required to perform the task. For more information, see Grant Least Privilege in the AWS Identity and Access Management User Guide.
- This code has not been tested in all AWS Regions. Some AWS services are available only in specific Regions.
- Running this code might result in charges to your AWS account.
You must have an AWS account, and have configured your default credentials and AWS Region as described in https://github.com/awslabs/aws-sdk-rust.
This example creates a Kinesis data stream.
cargo run --bin create-stream -- -n NAME [-r REGION] [-v]
- NAME is the name of the stream to create.
- REGION is the Region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
- -v display additional information.
This example deletes a Kinesis data stream.
cargo run --bin delete-stream -- -n NAME [-r REGION] [-v]
- NAME is the name of the stream to delete.
- REGION is the Region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
- -v display additional information.
This example displays information about a Kinesis data stream.
cargo run --bin describe-stream -- -n NAME [-r REGION] [-v]
- NAME is the name of the stream.
- REGION is the Region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
- -v display additional information.
This example lists your Kinesis data streams.
cargo run --bin list-streams -- [-r REGION] [-v]
- REGION is the Region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
- -v display additional information.
This example adds a record to a Kinesis data streams.
cargo run --bin put-record -- -n NAME -k KEY -i INFO [-r REGION] [-v]
- NAME is the name of the stream.
- KEY is the name of the partition key for the record.
- INFO is the content of the record.
- REGION is the Region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
- -v display additional information.
To propose a new code example to the AWS documentation team, see CONTRIBUTING.md. The team prefers to create code examples that show broad scenarios rather than individual API calls.
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0