On this page

Amazon Kinesis (Cohort)

Amplitude Data's AWS Kinesis Cohort integration streams your cohort membership updates straight to a Kinesis stream.

Considerations

  • This integration is only available for customers who have paid plans with Amplitude.
  • You must enable this integration for each Amplitude project you want to use it in.
  • You should understand Amplitude Activation and Behavioral Cohorts before setting up this integration.
  • Amplitude supports all cohort update cadences (Daily, Hourly, Real Time).
  • All existing Real Time Cohort Sync limits apply.

Prerequisites

Before you get started, create a Kinesis topic in your AWS account, and an IAM role that Amplitude uses to publish cohort updates to the stream.

Set up the integration

Kinesis setup

1. Create a Kinesis stream

Create a Kinesis stream in the AWS console.

2. Create an IAM role

Create an IAM role that gives Amplitude permission to write directly to your AWS Kinesis Stream.

  • For Account ID, specify: 358203115967. This is Amplitude's AWS account used to export events.
  • Finalize the role without assigning any policies.
  • The Trust Relationships for the new role should look like this:
json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::358203115967:root"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}

3. Create an IAM policy

  1. Create an IAM Policy to give Amplitude permission to write to your Kinesis Stream.

  2. Select the Create Policy from JSON option and use the following template policy in the Policy Document field. Change {account-id} to your account ID, and replace {region} and {stream-name} with the applicable values. Also replace {role-name} with the role you just created.

    json
    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "kinesis:PutRecord",
                    "kinesis:PutRecords",
                    "iam:SimulatePrincipalPolicy"
                ],
                "Resource": [
                    "arn:aws:kinesis:{region}:{account-id}:stream/{stream-name}",
                    "arn:aws:iam::{account-id}:role/{role-name}"
                ]
            }
        ]
    }
    
  3. Assign the new policy to the role.

    1. Open the role.
    2. Select the Attach Policies option, and select the new policy.

Make note of the role ARN, stream region, and stream name. You need these to set up the destination in Amplitude.

Amplitude setup

  1. In Amplitude Data, click Catalog and select the Destinations tab.
  2. In the Cohort section, click Kinesis Data Stream.
  3. Click Add another destination.
  4. Enter the Display Name for this destination. This name identifies the destination when syncing the cohort.
  5. Enter the stream name, AWS region, and role ARN you created.
  6. Save the destination.

Send a cohort

  1. In Amplitude, open the cohort you want to export.
  2. Click Sync, and choose Kinesis Data Stream.
  3. Select the destination you created.
  4. Select the sync frequency you need.

Payload

The payload sent to Kinesis is a JSON object. Example:

json
{
  "cohort_name": "Test Cohort",
  "cohort_id": "gs72ns",
  "in_cohort": true,
  "computed_time": "1685748245",
  "message_id": "some-message-id:54",
  "users": [{
    "user_id": "user1@amplitude.com",
    "user_properties": {
      "city": "San Francisco",
      "fav_animal": "Bat"
    }
  },
    {
      "user_id": "user2@amplitude.com",
      "user_properties": {
        "city": "Seattle",
        "fav_animal": "Cat"
      }
    }]
}

Was this helpful?