Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Golang + Kinesis firehose
package main
import (
// FakeEntity is just used for testing purposes
type FakeEntity struct {
ID int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
const maxUint = 4294967295
func main() {
streamName := "firehoseStream"
sess := session.Must(session.NewSession())
// Create a Firehose client with additional configuration
firehoseService := firehose.New(sess, aws.NewConfig().WithRegion("us-east-1"))
recordsBatchInput := &firehose.PutRecordBatchInput{}
recordsBatchInput = recordsBatchInput.SetDeliveryStreamName(streamName)
records := []*firehose.Record{}
for i := 0; i < 10; i++ {
data := FakeEntity{
ID: rand.Intn(maxUint),
Name: fmt.Sprintf("Name-%d", rand.Intn(maxUint)),
Description: fmt.Sprintf("Test-Description %d", rand.Intn(maxUint)),
b, err := json.Marshal(data)
if err != nil {
log.Printf("Error: %v", err)
record := &firehose.Record{Data: b}
records = append(records, record)
recordsBatchInput = recordsBatchInput.SetRecords(records)
resp, err := firehoseService.PutRecordBatch(recordsBatchInput)
if err != nil {
fmt.Printf("PutRecordBatch err: %v\n", err)
} else {
fmt.Printf("PutRecordBatch: %v\n", resp)

This comment has been minimized.

Copy link

@leonardorifeli leonardorifeli commented Jun 26, 2019

Hi @coboshm.

The firehose implementation in Nodejs, you can set an httpOption with time to get a timed-out and max retries. In golang do you know something to resolve that?


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.