AWS Contact Center

Analyze Amazon Connect agent event stream with Amazon Athena and Amazon QuickSight-part 5


Organizations want contact center reporting and analytic capabilities for agents’ activities. This enables them to manage agent staffing and optimizing the contact center work force operations. Contact center platforms with limited integration capability make it challenging to generate custom reports and perform advanced agent activity analytics. Amazon Connect agent event streams are Amazon Kinesis Data Streams that provide you with near real-time reporting of agent activity within your Amazon Connect instance.

In this blog you will learn how to enable Agent Event Stream, stream data out of Amazon Connect, and develop an analytics solution using Amazon QuickSight.


Architecture diagram for the solution.

Fig 1 – High-level architecture diagram

In this architecture, you will use Amazon Kinesis Streams to capture Amazon Connect Agent Event data in an Amazon Simple Storage Service (S3) bucket. Amazon Kinesis Data Streams streams the Agent event data into S3 by using an Amazon Kinesis Data Firehose. Using a data stream in the middle provides the advantage of using Agent Event data in other processes/solutions at the same time. For example, this data stream can be used to transfer the agent event records to Amazon DynamoDB database for the data to be consumed in third-party applications.

AWS Glue catalog has the table definitions for the contact event stream. You can run queries in Amazon Athena and generate reports. For visualization, you can use Amazon QuickSight.

This solution uses a parameter named “Project Name” that defines the solution domain. You can deploy this solution multiple times with different project names to maintain isolation. Because it will be used to name fundamental components, such as an Amazon S3 bucket, the project name must be unique globally.


To follow along with the solution presented in this blog post, you should be familiar with the following AWS services and features:


  1. Sign in to the AWS Management Console.
  2. Download the CloudFormation template from here onto your local machine.
  3. In your preferred Region, create a CloudFormation stack using the template file downloaded in step 2.Enter the CloudFormation Stack details
  4. Keep the defaults on the remaining options page and select Create Stack
  5. Enable Agent Event Stream for your instance, the stream name is “<ProjectName>-ae”Enabvle agent event stream


In this step, you generate data by making or receiving calls using Amazon Connect. You can go to Amazon Connect Contact Control Panel (CCP) to receive calls using a software phone or desktop phone. Within a few minutes, Agent Event stream data will appear in the bucket named as your project name under “ae-base” as “.parquet” files.

  1. Navigate to Amazon Athena table, you should see “connect-ae” table. Click on three dots besides the connect_ae table, then select Preview Table.Athena table screenshot
  2. Athena displays the query results when you run it.Athena query result set screens shot

Visualize in Amazon QuickSight

Amazon Athena allows you to visualize the results of your query directly within Amazon QuickSight. Before connecting Amazon QuickSight to Athena, you must grant Amazon QuickSight access to Athena and its associated Amazon S3 bucket. For more information, see managing Amazon QuickSight permissions to AWS resources. After granting the access permissions, you create a new dataset in Amazon QuickSight based on the Athena table that was created.

Next create a new analysis in Amazon QuickSight:

  1. Navigate to QuickSight and select Analysis.
  2. Click on New Dataset, then select Athena and give the data source a name.
  3. In the example below, the name chosen is ‘aes-reporting’. Afterwards, click on Create data source.QuickSight screen shot to enter the data source name
  4. Choose the name of the database (same name as your project name) and table/view, created as part of the blog, then click Select. (Make sure the QuickSight instance is in the same Region where you ran the CloudFormation template)QuickSight screen shot to select table
  5. Finally, click Visualize to complete the dataset creation.QuickSight screen shot to confirm the SPICE storage
  6. In the next screen, you should see the Agent Event Analysis page to configure analytics in the sheet.
    1. Login-Logout Report uses the login-logout view created from the Agent Event Stream table. The view analyzes all the logins and logouts for the agent in the filtered date time period. Then calculating the time elapsed between the login event and the subsequent logout event. The view also omits the agent events on the default Routing Profile (i.e. Basic Routing Profile). If there is a login event but a missing subsequent logout event, then it set the logout event as unavailable or NA. See a screenshot of the LOGIN-LOGOUT report below.The login-logout report screen shot
    2. Agent-Status report uses the Agent-Status view created from Agent Event Stream Table. The view analyzes all the event types like (Login, Logout, Status Change) except the Heart Beat. The view also omits the agent events from the Default Routing Profile. The report calculates the time spent by an agent in each of the status. Refer to the visual of the Agent Status Report below.Agent status report screenshot
    3. Agent-Status-Summary view aggregates the status time from the Agent-Status view by the agent status. This view can build graph and pie-chart on the QuickSight. Refer to the screenshot of the agent summary below.
      Agent status summary table Agent status summary pie chart

After following the steps above, you can use Amazon QuickSight to add different columns from the call records and perform visualizations. You can also create views within Amazon Athena to build enhanced visualizations. If interested in exploring more, review this blog post. Last, you can also build dashboards that continuously monitor your Amazon Connect instance and share those dashboards with others in your organization.


In order to delete the resources created by the stack:

  • Delete the CloudFormation template.
  • Delete the objects and the Amazon S3 bucket created from the CloudFormation template.
  • Delete the Glue database created from the CloudFormation template.


In this blog, you learned one way to analyze and visualize your Agent Event stream using Amazon QuickSight. We showed how Amazon Kinesis and Amazon Athena process agent event to build customized and enhanced visuals. To build further analysis, by creating views within Amazon Athena, check this blog post for more details. To visualize your data in Tableau and Power BI, follow Building AWS data lake visualizations with Amazon Athena and Tableau and Using the Amazon Athena Power BI connector blog, respectively.

For more analytics capabilities on Amazon Connect data sources, refer the following blogs in the Amazon Connect reporting blog series:

Author Bio

Mehmet Demir is a Senior Solutions Architect at Amazon Web Services (AWS) based in Toronto, Canada. He helps customers in building well-architected solutions that support business innovation
Kalyan Thandri is a consultant at AWS. He designs and implement Amazon Connect Contact Center solutions for AWS customers.
Ankur Taunk is a Senior Specialist Solutions Architect at AWS. He helps customer achieve their desired business outcomes in the Contact Center space leveraging Amazon Connect.