How to setup kinesis data stream for AWS Pinpoint? Let’s use Terraform!

Krzysztof Dragan
the-stepstone-group-tech-blog
3 min readSep 23, 2022

General

There are many solutions on the market which give opportunities to send messages via multiple channels. In general, they are very similar to each other. You have to setup configuration of send out mechanism and that’s it. The performance and delivery rate is comparable through all solutions. What is very important and has a crucial role when choosing a notifications solution for your business is analytics. You want to know, what happened to your message, whether it was successfully delivered or not, was the email opened or not, did the recipient unsubscribe. Pinpoint service can provide a wide variety of message’s related events. Here is a link which describes all of them. In order to use them, they need to be propageted to AWS Kinesis Stream. Stream needs to be attached to Pinpoint instance. In this article we will focus on configuration of such setup using Terraform and AWS Console.

Configuration using Terraform

First step will be to create a pinpoint app using aws_pinpoint_app resource. After that we can create a kinesis stream. By default, it will be in provisioned mode with only one shard.

In second stage we can start creating our policy document. Basically, we will enable pinpoint’s application to assign an event stream to it. In the gist presented above, I created some code which shows example policy document and iam role creation.

On the end we need to define aws_pinpoint_event_stream resource to finally assign the stream which you created to the pinpoint application.

Make sure to pass arn of role which you created in previous steps!

Configuration using AWS console

Using terraform to automate your infrastructure is smart but not needed in all cases. We can assign kinesis stream to pinpoint using AWS Console.

Firstly, open your pinpoint application in console and go to settings. You should be confronted with such image.

Then click edit

Final view will give a possibility to select a data stream and a proper role which should allow pinpoint to send events to Kinesis.

After successfull configurtion, just use Pinpoint to send some messages. You should be able to see operating Kinesis Stream. To do that, open Amazon Kinesis Data Streams page in AWS Console. Find your stream and open Monitoring tab.

Scroll down a little bit to check PutRecords operation metrics.

As shown, something is going on there! Our Pinpoint instance is putting some events on Kinesis. There are few ways to fetch data which is laying on Kinesis, I will present those options in the upcoming article.

Conclusion

The main obstacles while configuring this setup will be most probably priviliges and permissions. Make sure that your user which is operational in context of your Terraform has everything that it needs. Besides that, we should be good to go. I hope that my explanation was helpful, if no, feel free to add a comment. Good luck!

Read more about the technologies we use or take an inside look at our organisation & processes. Interested in working at StepStone? Check out our careers page.

--

--

the-stepstone-group-tech-blog
the-stepstone-group-tech-blog

Published in the-stepstone-group-tech-blog

The Stepstone Group is one of the world’s leading job platforms. We create opportunities at scale for jobseekers and companies by leveraging our data, platform, and technology. We do this across a portfolio of more than 20 brands and businesses across more than 30 countries.

Krzysztof Dragan
Krzysztof Dragan