AWS Business Intelligence Blog

Optimize your Amazon QuickSight implementation: a guide to usage analytics and cost management

Understanding and optimizing Amazon QuickSight usage across your organization is crucial for managing costs effectively and ensuring maximum value from your business intelligence investments. As organizations scale their QuickSight implementations and onboard users across different roles, having clear visibility into usage patterns becomes increasingly important.

We’ve heard from customers that analyzing user activity and understanding usage patterns has been challenging. Common questions include “How many Reader Pro licenses have we added in the last 90 days?” and “What’s our actual session consumption pattern?” To address these needs, we’re excited to share a solution that makes it easier than ever to gain insights into your QuickSight usage and make data-driven decisions about your BI implementation.

Using AWS CloudFormation templates, we’ll show you how to:

  • Deploy an automated solution that extracts QuickSight user information using AWS Glue and QuickSight APIs
  • Create an Amazon Athena table providing access to your QuickSight account user data and aggregated view built on your AWS Cost and Usage Report (AWS CUR)
  • Set up a pre-built QuickSight dashboard that provides insights into:
    • Billed readers utilization and inactive user identification
    • Session consumption patterns (both reader and anonymous)
    • SPICE (Super-fast, Parallel, In-memory Calculation Engine), alerts, and pixel-perfect reports and Amazon Q in QuickSight usage
    • Cost optimization opportunities

The solution can be deployed within minutes using our provided templates. Whether you’re managing a small team or an enterprise-wide deployment, this analytics solution will help you make data-driven decisions about your QuickSight implementation and prepare for the upcoming pricing changes.

Solution overview

This solution uses QuickSight in conjunction with other AWS services to process and prepare data for analysis. To simplify deployment, we provide a CloudFormation template that automates the provisioning of all necessary resources.

  1. An AWS Glue job: A Python shell script qs-usage-users-info that’s scheduled to run daily. The script calls QuickSight APIs to get the QuickSight users details from your QuickSight identity AWS Region.
  2. The AWS Glue job saves the results in a new Amazon Simple Storage Service (Amazon S3) bucket named qs-usage-{AWS::AccountId}-{AWS::Region}
  3. An Athena table is built in database qs-usage-db using data in qs-usage-{AWS::AccountId}-{AWS::Region} and an Athena view is created on top of the AWS CUR data in the AWS account.
  4. The QuickSight dashboard is deployed based on the dataset, which fetches the data from the Athena table and view.

Solution Overview

The preceding architecture diagram has three main steps:

  1. Using an exchange, transform, and load (ETL) job, gather users’ information for the QuickSight account. AWS Glue runs a daily ETL job to make sure that decision-makers always have access to up-to-date information.
  2. Create an aggregated view in Athena on top of existing AWS CUR data to gather usage trends for QuickSight across all product groups.
  3. Import data in SPICE and get insights into usage patterns using the QuickSight Usage Analytics dashboard.

Prerequisites

Before proceeding with this walk-through, make sure that you have the following:

Deployment

By using the provided templates, you can set up and deploy the solution in three steps.

Step 1: Create an S3 bucket and Glue ETL job

When using this CloudFormation template, it’s essential to specify the QuickSight identity Region. This crucial step makes it possible for you to retrieve comprehensive user information for your QuickSight account. Note that selecting and providing the correct identity Region is a mandatory parameter and cannot be skipped.

The following is a list of resources that will be created by template:

  • An IAM role for AWS Glue jobs with permissions for QuickSight and Amazon S3 called qs-usage-glue-role-{AWS::AccountId}-{AWS::Region}
  • An AWS Glue job Python shell script called qs-usage-users-info
  • An AWS Glue trigger scheduled to run the AWS Glue job qs-usage-users-info daily at 6:00 AM Eastern time (ET) named QuickSightUsersExtractDailyTrigger
  • An S3 bucket for storing QuickSight user extracts and called qs-usage-{AWS::AccountId}-{AWS::Region}

  1. Choose Launch Stack and follow the steps to create these resources.

  1. Select your QuickSight Identity Region. This mandatory parameter enables extracting information about registered users in the QuickSight account.

QuickSight Identity Region pick

  1. Select I acknowledge that AWS CloudFormation might create IAM resources with custom names and choose Next.

Acknowledge Selection

  1. After the stack is created, go to the AWS Glue console and choose ETL jobs and then Visual ETL in the navigation pane. Select the qs-usage-users-info job and choose Run job to quickly generate the datasets instead of waiting for the next scheduled run.

ETL Job Set up

  1. After the ETL job completes, it will create user extracts and save them in qs-users-info.csv in the S3 bucket qs-usage-{AWS::AccountId}-{AWS::Region}. Navigate to S3 bucket and ensure data files are successfully created in your account.

ETL Output in S3

If you manage QuickSight across multiple AWS accounts, this solution simplifies your user management through an automated ETL process. By deploying this template in each linked account, you can extract and consolidate all QuickSight user data into a central account. This centralization enables comprehensive usage analysis through CUR data integration and provides unified visibility via QuickSight dashboards, making it easier to optimize and track usage patterns across your entire organization.

Step 2: Create Athena tables

The second CloudFormation template creates two objects in Athena:

  • Table qs_users_info: This table has all users profiles with their role as it exists in your QuickSight identity Region.
  • Saved query: qs_usage_cur_vw_query: This saved query is created on top of the AWS CUR table in your account to help analyze usage patterns across all QuickSight features, such as Alerts, Pixel-perfect reporting, Q, and session consumptions .You will use this query to create a view in a subsequent step.
  • Here is an example of Saved Query you will see in your account:
CREATE OR REPLACE VIEW "AwsDataCatalog"."qs-usage-db"."qs_usage_cur_vw" AS
          SELECT
            bill_payer_account_id,
            line_item_usage_account_id,
            concat(DATE_FORMAT(line_item_usage_start_date, '%Y-%m'), '-01') AS month_line_item_usage_start_date,
            line_item_usage_type,
            CASE
              WHEN LOWER(line_item_usage_type) LIKE 'qs-user-enterprise%' THEN 'Users - Enterprise'
              WHEN LOWER(line_item_usage_type) LIKE 'qs-user-standard%' THEN 'Users - Standard'
              WHEN LOWER(line_item_usage_type) LIKE 'qs-reader%' THEN 'Reader Usage'
              WHEN LOWER(line_item_usage_type) LIKE '%spice' THEN 'SPICE'
              WHEN LOWER(line_item_usage_type) LIKE '%alerts%' THEN 'Alerts'
              WHEN LOWER(line_item_usage_type) LIKE '%-q%' THEN 'QuickSight Q'
              WHEN LOWER(line_item_usage_type) LIKE '%-report%' THEN 'Paginated Reporting'
              WHEN LOWER(line_item_usage_type) LIKE '%-reader-pro%' THEN 'Reader PRO'
              WHEN LOWER(line_item_usage_type) LIKE '%-author-pro%' THEN 'Author PRO'
              WHEN LOWER(line_item_usage_type) LIKE '%-reader-enterprise%' THEN 'Reader Usage'
              ELSE line_item_usage_type
            END AS qs_usage_type,
            line_item_line_item_description,
            line_item_line_item_type,
            product_group,
            pricing_unit,
            line_item_resource_id,
            product_usagetype,
            line_item_unblended_rate,
            line_item_blended_rate,
            line_item_operation,
            SUM(CAST(line_item_usage_amount AS DOUBLE)) AS sum_line_item_usage_amount,
            SUM(CAST(line_item_unblended_cost AS DECIMAL(16, 8))) AS sum_line_item_unblended_cost,
            SUM(CAST(line_item_blended_cost AS DECIMAL(16, 8))) AS line_item_blended_cost
          FROM "billing"."cur"   --  This is replaced by ${CURSourceTable} with your CUR database.table name provided as Input to a parameter
          WHERE
            (CAST(year AS INTEGER) >=2024 )
            AND product_product_name = 'Amazon QuickSight'
            AND line_item_line_item_type IN ('DiscountedUsage', 'Usage')
          GROUP BY
            bill_payer_account_id,
            line_item_usage_account_id,
            DATE_FORMAT(line_item_usage_start_date, '%Y-%m'),
            4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
          ORDER BY
            month_line_item_usage_start_date ASC,
            sum_line_item_unblended_cost DESC
ORDER BY month_line_item_usage_start_date ASC, sum_line_item_unblended_cost DESC
SQL
  1. Choose Launch Stack and follow the steps to create these resources.

  1. This stack requires that you provide the AWS CUR database and table name using the format database.table_name as it appears in your account.

CUR Table

  1. After a successful deployment of the stack, you have a database called qs-usage-db, which now has the table qs_users_info, providing information of all users that exist in your QuickSight account.

After the stack has created the Athena saved query, you can now execute the query to create a view:

  • In the Athena console, choose Query editor in the navigation pane.
  • Choose the Saved queries tab and select the query named qs_usage_cur_vw_query.

Athena Saved Query

  • Choose Run in the Query editor to create the view.
  • When the query is complete, it will create a view in Athena named qs_usage_cur_vw. This view includes all AWS CUR data for the required analysis in a QuickSight dashboard.

Athena CUR aggregated Query

  • Enable Athena access and grant QuickSight permission to S3 bucket qs-usage-{AWS::AccountId}-{AWS::Region} by navigating to the QuickSight Console and click on your username in the top-right corner. Select Manage QuickSight from the dropdown menu, then choose Security & Permissions from the left-hand navigation pane.

Step 3: Deploy QuickSight datasets and dashboard

The next step is to create the QuickSight objects. The third stack will help you create three datasets in QuickSight: qs_usage_cur_vw and qs_users_info that map to the Athena view and table respectively and a third dataset—qs-usage-custom-inactive—that’s referencing Athena table and view to find inactive users in your QuickSight account.

The following sample query is referenced for the built of dataset. Using these three datasets, the template creates the QuickSight Usage Analytics Dashboard dashboard to provide reader activity and additional key usage patterns. You can use the dashboard to help identify any underutilized reader accounts in your QuickSight account.

SELECT
    u.userarn,u.username,u.useremail,u.userrole,u.useridentitytype,u.usernamespace,CAST(COALESCE(a.last_login, DATE '2020-01-01') AS DATE) as last_login
FROM "AwsDataCatalog"."qs-usage-db"."qs_users_info" u
LEFT JOIN (
    SELECT
        line_item_resource_id,
        MAX(date_parse(month_line_item_usage_start_date, '%Y-%m-%d')) as last_login
    FROM "AwsDataCatalog"."qs-usage-db"."qs_usage_cur_vw"
    WHERE (
        product_group = 'Reader Usage'
        OR product_group = 'Reader Subscription'
    )
    AND LOWER(line_item_resource_id) NOT LIKE '%anonymous%'
    GROUP BY line_item_resource_id
) a ON u.userarn = a.line_item_resource_id
WHERE u.userrole = 'READER'
SQL

Choose Launch Stack to deploy the QuickSight datasets and dashboard. Make sure to provide the QuickSight admin user’s ARN in the format arn:aws:quicksight:us-east-1:12345678910:user/default/admin/xyz. Please note that the AWS Account 12345678910, AWS Region (us-east-1), and user (Admin/xyz) shown here are placeholders and should be replaced with your actual values.

After the three stacks have been successfully deployed (as shown in the following figure), you can configure the SPICE refresh schedule with your preferred frequency for both SPICE datasets and share the dashboard with the appropriate members of your organization.

Stack Deployment

Explore this 5-sheet dashboard with seamless navigation. Click any sheet to move effortlessly between views.

  • The first sheet on the QuickSight Usage Analytics Dashboard provides a data dictionary of cost and usage data that you can access to generate key insights.
  • The dashboard view shown in the following figure provides insights into all key KPIs for your QuickSight accounts and the relevant usage.

QuickSight USage Summary

  • The dashboard view shown in the following figure provides a detailed view of the reader session capacity usage and details of all resources across all linked accounts.

QuickSight usage detail for Sessions

  • The dashboard view shown in the following figure shows another detailed view of usage of features such as alerts, reporting, SPICE, and PRO users, and provides the corresponding details of resources across all linked accounts.

QuickSight Usage for all Assets

  • The dashboard view shown in the following figure shows all user types in the QuickSight account.

QuickSight All Users Info

  • The dashboard view shown in the following figure provides information for all active registered readers across all linked accounts. From that information, it derives a list of all inactive or underutilized reader accounts that can be used to help determine which users can be removed if necessary.

QuickSight Inactive Readers

Clean up

Use the following steps to remove all resources deployed by this solution in the following sequence.

1. Delete the dashboard stack

Locate and delete the CloudFormation stack that deployed the QuickSight assets (either the default name qs-usage-dashboard-stack or your custom stack name chosen during deployment). This removes:

  • The QuickSight dashboard QuickSight Usage Analytics Dashboard
  • The three datasets (qs-usage-custom-inactive, qs-usage-cur-vw, qs-users-info)
  • The QuickSight usage theme qs-usage-theme
  • The Athena data source connection in QuickSight (qs-usage)

2. Delete the Athena objects stack

Locate and delete the CloudFormation stack that created the Athena resources (either the default name qs-usage-athena-stack or your custom stack name chosen during deployment). This removes:

  • The qs_usage_cur_vw_query saved query
  • The qs_users_info table
  • The qs_usage_cur_vw view
  • The qs-usage-db Athena database

3. Delete the AWS Glue job and S3 bucket stack

Make sure that the S3 bucket qs-usage-{AWS::AccountId}-{AWS::Region} is empty, and then locate and delete the CloudFormation stack that created the core infrastructure (either the default name qs-usage-glue-stack or your custom stack name chosen during deployment). This removes:

  • The qs-usage-users-info Glue job
  • The QuickSightUsersExtractDailyTrigger Glue trigger
  • The qs-usage-glue-role-{AWS::AccountId}-{AWS::Region} IAM role
  • The qs-usage-{AWS::AccountId}-{AWS::Region} S3 bucket

This cleanup doesn’t affect your existing AWS CUR setup or QuickSight subscription.

Conclusion

This post provides a way for you go get insights into your Amazon QuickSight usage patterns and identify opportunities for cost optimization, particularly around reader accounts. By using AWS CUR data and automating the data collection process, you can:

  • Gain visibility into reader engagement and identify underutilized reader accounts
  • Track usage patterns across various QuickSight features including SPICE, Alerts, Q, and Pixel-Perfect Reports

The provided CloudFormation templates simplify deploying this solution in your environment, so that you can start monitoring your QuickSight portfolio through a single pane of glass within minutes. As organizations continue to scale their BI implementations, having automated tools for usage analysis becomes increasingly critical for maintaining cost efficiency.

If you have any questions or feedback, leave a comment. For additional discussions and help getting answers to your questions, check out the QuickSight Community.


About the Author

Jesse Gebhardt is a Senior Manager specializing in analytics and Generative AI and leading team of experts for Amazon QuickSight. He has spent over 15 years in the Business Intelligence industry. At AWS, he aids customers around the globe gain insight and value from the data they have stored in their data lakes and data warehouses. Jesse lives in sunny Phoenix, and is an amateur electronic music producer.

Srikanth Baheti is a Senior Manager for Amazon QuickSight. He started his career as a consultant and worked for multiple private and government organizations. Later he worked for PerkinElmer Health and Sciences & eResearch Technology Inc, where he was responsible for designing and developing high traffic web applications, highly scalable and maintainable data pipelines for reporting platforms using AWS services and Serverless computing.

Sindhu Chandra is a Senior Product Marketing Manager for Amazon QuickSight at AWS, bringing over a decade of experience in marketing and technology. Prior to her current role, she held marketing positions across technology leaders including Amazon, Uber, and Google, where she led cross-channel marketing strategies. She is passionate about making B2B marketing more relatable and driving inclusive marketing initiatives. Outside of work, she enjoys playing with her dog, and brewing coffee from different origins.

Salim Khan is a Specialist Solutions Architect for Amazon QuickSight. Salim has over 16 years of experience implementing enterprise business intelligence (BI) solutions. Prior to AWS, Salim worked as a BI consultant catering to industry verticals like Automotive, Healthcare, Entertainment, Consumer, Publishing and Financial Services. He has delivered business intelligence, data warehousing, data integration and master data management solutions across enterprises.

Neeraj Kumar is a Senior Solutions Architect for Amazon QuickSight, AWS’ cloud-native, fully managed BI service. Neeraj started his career as software engineer building software applications for automotive, manufacturing and telecom companies, he further progressed as specialist and while working at Cognizant he was responsible for designing and developing end-to-end Business Intelligence and Analytics solutions across enterprises.