Enable real-time contact analysis segment streams - Amazon Connect

Enable real-time contact analysis segment streams

Real-time contact analysis segment streams are not enabled by default. This topic explains how to enable them.

Step 1: Create a Kinesis stream

Create the data stream on the same account and Region where your Amazon Connect instance resides. For instructions, see Step 1: Create a Data Stream in the Amazon Kinesis Data Streams Developer Guide.


We recommend creating a separate stream for each type of data. While it's possible to use the same stream for real-time contact analysis segment streams, agent events, and contact records, it is much easier to manage and get data from the stream when you use a separate stream for each one. For more information, see the Amazon Kinesis Data Streams Developer Guide.

Step 2: Set up server-side encryption for the Kinesis stream (optional but recommended)

There are several ways you can do this.

  • Option 1: Use the Kinesis AWS managed key (aws/kinesis). This works with no additional setup from you.

  • Option 2: Use the same customer managed key for call recordings, chat transcripts, or exported reports in your Amazon Connect instance.

    Enable encryption, and use a customer managed key for call recordings, chat transcripts, or exported reports in your Amazon Connect instance. Then choose the same KMS key for your Kinesis data stream. This key already has the permission (grant) required to be used.

  • Option 3: Use a different customer managed key.

    Use an existing customer managed key or create a new one and add required permissions for Amazon Connect role to use the key. To add permissions using AWS KMS grants, see the following example:

    aws kms create-grant \ --key-id your key ID \ --grantee-principal arn:aws:iam::your AWS account ID:role/aws-service-role/connect.amazonaws.com/AWSServiceRoleForAmazonConnect_11111111111111111111 \ --operations GenerateDataKey \ --retiring-principal arn:aws:iam::your AWS account ID:role/adminRole

    Where grantee-principal is the ARN of the service-linked role associated to your Amazon Connect instance. To find the ARN of the service-linked role, in the Amazon Connect console, go to Overview, Distribution settings, Service-linked role.

Step 3: Associate the Kinesis stream

Use Amazon Connect AssociateInstanceStorageConfig API to associate the resource type REAL_TIME_CONTACT_ANALYSIS_SEGMENTS along with the Kinesis stream where real-time contact analysis segments will be published. You'll need the instance ID and the Kinesis stream ARN.


aws connect associate-instance-storage-config --instance-id your Amazon Connect instance ID --resource-type REAL_TIME_CONTACT_ANALYSIS_SEGMENTS --storage-config 'StorageType=KINESIS_STREAM,KinesisStreamConfig={StreamArn=the ARN of your Kinesis stream}'


import { Connect } from 'aws-sdk'; async function associate (): Promise <void> { const clientConfig: Connect.ClientConfiguration = { region: 'the Region of your Amazon Connect instance', }; const connect = new Connect(clientConfig); // Build request const request: Connect.Types.AssociateInstanceStorageConfigRequest = { InstanceId: 'your Amazon Connect instance ID', ResourceType: 'REAL_TIME_CONTACT_ANALYSIS_SEGMENTS', StorageConfig: { StorageType: 'KINESIS_STREAM', KinesisStreamConfig: { StreamArn: 'the ARN of your Kinesis stream', }, } }; try { // Execute request const response: Connect.Types.AssociateInstanceStorageConfigResponse = await connect.associateInstanceStorageConfig(request).promise(); // Process response console.log('raw response: ${JSON.stringify(response, null, 2)}'); } catch (err) { console.error('Error calling associateInstanceStorageConfig. err.code: ${err.code},' + 'err.message: ${err.message}, err.statusCode: ${err.statusCode}, err.retryable: ${err.retryable}'); } } associate().then(r => console.log('Done'));

Step 4: Enable Contact Lens for your Amazon Connect instance

For instructions, see Enable Contact Lens for Amazon Connect.

Step 5 (Optional): Review a sample segment stream

We recommend you review a sample segment stream to familiarize yourself with what it looks like. See Sample real-time contact analysis segment stream.