These examples demonstrates how to perform several Kinesis operations using version 2 of the AWS SDK for Go.
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.
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.
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