Skip to content

Latest commit

 

History

History
 
 

kinesis

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

AWS SDK for Go V2 code examples for Amazon Kinesis

Purpose

These examples demonstrates how to perform several Kinesis operations using version 2 of the AWS SDK for Go.

Prerequisites

You must have an AWS account, and have your default credentials and AWS Region configured as described in Configuring the AWS SDK for Go in the AWS SDK for Go Developer Guide.

Running the code

PutRecord/PutRecordv2.go

This example produces a new data record in the stream.

go run PutRecordv2.go -s STREAM -k PARTITION-KEY -p PAYLOAD

  • STREAM is the Kinesis stream name.
  • PARTITION-KEY is the partition ID.
  • PAYLOAD is the content to be published.

The unit test accepts similar values in config.json.

Running the unit tests

Unit tests should delete any resources they create. However, they might result in charges to your AWS account.

To run a unit test, enter:

go test

You should see something like the following, where PATH is the path to the folder containing the Go files:

PASS
ok      PATH 6.593s

If you want to see any log messages, enter:

go test -v

You should see some additional log messages. The last two lines should be similar to the previous output shown.

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0