Evolve your analytics with Amazon QuickSight’s new APIs and theming capabilities
The Amazon QuickSight team is excited to announce the availability of Themes and more APIs! Themes for dashboards let you align the look and feel of Amazon QuickSight dashboards with your application’s branding or corporate themes. The new APIs added allow you to manage your Amazon QuickSight deployments programmatically, with support for dashboards, datasets, data sources, SPICE ingestion, and fine-grained access control over AWS resources. Together, they allow you to creatively tailor Amazon QuickSight to your audiences, whether you are using Amazon QuickSight to provide your users with an embedded analytics experience or for your corporate Business Intelligence (BI) needs. This post provides an overview of these new capabilities and details on getting started.
Theming your dashboards
Amazon QuickSight themes allow you to control the look and feel of your dashboards. Specifically, you will be able to affect the following items through themes, and then share with other authors in the account.
- Borders around visuals
- Gutters (spacing between visuals)
- Data colors (used within the visuals)
- Background colors (for visuals within the dashboard and the dashboard itself)
- Foreground colors (for text in the visuals and on the dashboard)
- Highlight colors on visuals
The following screenshot of the dashboard highlights aspects of the dashboards you can modify via the theming options currently available:
With the available options, you can also make your QuickSight dashboards denser (e.g. no margins or gutters), as shown in the view below that uses QuickSight’s new “Seaside” theme.
You also have a dark dashboard option with QuickSight’s new “Midnight” theme as shown below.
Themes are accessible via the left hand panel in the dashboard authoring interface.
You can create your own theme by starting with one of the built-in themes and customizing it. The interactive theme editing experience makes this easy – you can edit as little or as much as you want, and get to the perfect theme for your dashboards.
Using APIs for dashboards, datasets, data sources, SPICE ingestion, and permissions
The new APIs cover dashboards, datasets, data sources, SPICE ingestion, and fine-grained access control over S3/Athena. We’ve introduced templates in QuickSight with this release: templates allow you to store the visual configuration and data schema associated with a dashboard and then easily replicate the dashboard for different sets of users or different data, within or across accounts.
The new template APIs allow you to create templates from QuickSight analyses. You can then use the dashboard APIs to create a dashboard from the template in the same or different account, version control dashboards, and connect them to different datasets as needed. The dataset APIs allow you to create custom datasets, with filters applied at the dataset level (for example, data for a specific customer only). Dataset APIs can be used to create both SPICE and direct query datasets. SPICE APIs let you refresh datasets programmatically and view SPICE ingestion status and history. Data source APIs programmatically define data source connections. Finally, fine-grained access permissions APIs let you secure access to data in Amazon S3, Amazon Athena, and other AWS resources.
As a developer using Amazon QuickSight’s embedded capabilities, or author using Amazon QuickSight to publish dashboards on different subject areas, the new APIs allow you to automate your workflows and programmatically perform repetitive activities such as rolling out identical versions of dashboards to different teams or customers. QuickSight assets can now be migrated from dev to QA to production via API, overcoming the need to manually access each environment. With versioning, you also have your previous dashboards backed up, providing you flexibility to roll back dashboard deployments if the need arises.
As an Amazon QuickSight administrator, you can use the new APIs to audit and manage access to dashboards, data sources, and datasets across your account. You can also pre-populate dashboards and datasets into individual author accounts for easier and faster onboarding. You no longer need to distribute individual credentials to data sources: you can provision centrally-managed data sources shared with all your users. You can also manage individual author access to S3, Athena, or other AWS resources on-the-fly using IAM policies through the fine-grained access control APIs. The APIs open up a lot of possibilities with Amazon QuickSight – we’ll cover a few scenarios in this blog post and then follow up with additional posts that cover more.
The Amazon QuickSight APIs can be invoked via the AWS Software Development Kit (SDK) or the AWS Command Line Interface (CLI). For our discussion, we will use the AWS CLI. To capture all the details needed for each API, this post uses the
generate-cli-skeleton option available in the AWS CLI and walks you through the example of creating a Redshift data source, creating data sets, and dashboards associated with it. This option, when invoked, provides a skeleton file with all the required API details, which you can edit to the correct inputs and use for your API calls. The code below invokes the
generate-cli-skeleton option and writes the details to the
create-data-source-cli-input.json file; we would then modify this file and use it as the input to the create-data-source API when invoking it.
aws quicksight create-data-source --generate-cli-skeleton > create-data-source-cli-input.json
Let’s say that you want to help Alice, a new hire in your company, create an Amazon QuickSight dashboard from some customer revenue data in Redshift. To set things up for Alice, you want to use the new APIs to connect to Redshift and create a QuickSight data set within her QuickSight user account.
Creating a data source
To connect to your Redshift database, you’ll need to create a data source in QuickSight. First, you describe it with the following configuration, which covers the data source connection details, credentials, and permissions around who should be able to see the data sources.
You can then invoke create-data-source API with this input to start the creation of your data source as indicated below.
aws quicksight create-data-source --cli-input-json file://./create-data-source-cli-input.json
You can validate that the data source was successfully created by calling the describe-data-source API as shown below and checking the response’s Status:
aws quicksight describe-data-source --aws-account-id $AAI --data-source-id SampleRedshiftDatasouce
Because you granted permissions to Alice as part of the call to create-data-source, this data source will now be visible to her when she logs in to QuickSight. If you didn’t grant user permissions, this data source is only visible to programmatic users with appropriate permissions.
Creating a dataset
Before Alice can build her dashboard, you’ll need to create a dataset, which identifies the specific data in a data source you want to use. To create a dataset from this data source, you can call the
create-data-set API. The
create-data-set API allows you to join two tables to create a desired view of data for Alice. Below,
PhysicalTableMap points to the tables in your Redshift data source you want to join, and
LogicalTableMap defines the join between them:
A sample dataset definition with joins included is shown below.
If you wanted to create a similar dataset with a SQL statement instead of specifying all the columns, call the
create-data-set API specifying your SQL statement in
PhysicalTableMap as shown below:
aws quicksight create-data-set --generate-cli-skeleton >create-data-set-cli-input-sql.json
Because you granted permissions to Alice, these data sets will be visible to her under Your Data Sets when she logs into QuickSight.
This dataset can be used like any other dataset in Amazon QuickSight. Alice can log in to the QuickSight UI and create an analysis that utilizes this dataset, as shown below:
Creating a template
Once Alice creates her dashboard and it gets popular with her team, the next ask might be to provide the same view, but to 100 other teams within the company, and using different datasets for each team. Without APIs, this ask would be a challenge. However, with the APIs, you can now define a template from Alice’s analysis and then create dashboards as needed. A template is created by pointing to a source analysis in QuickSight, which creates references for all datasets used, so that new datasets can referenced when using the template.
The following configuration describes a template created from Alice’s analysis:
Templates are not visible within the QuickSight UI and are a developer/admin managed asset that is only accessible via the APIs at this point. You can save the template configuration by calling the create-template API to start creation of your template:
aws quicksight create-template --cli-input-json file://./create-template-cli-input.json
To confirm the template was created, call the
describe-template API as shown below:
aws quicksight describe-template --aws-account-id $AAI --template-id DemoDashboardTemplate
You can then use this template to create a dashboard that is connected to the second, similar, dataset you created earlier. When calling the create-dashboard API, you define a SourceEntity, (in this case, the template we just created), permissions, and any dashboard publish options, as shown in the configuration used for create-dashboard-cli-input.json
You can confirm you created the dashboard correctly with the
describe-dashboard API. See the following code:
aws quicksight describe-dashboard --aws-account-id $AAI --dashboard-id DemoDashboard1
Because you granted permissions to Alice during creation, this dashboard will be visible to her under All dashboards when she logs into QuickSight as shown below:
Configuring SPICE datasets
Alice’s datasets are direct query datasets and may cause higher load on your Redshift cluster during peak times, which might also cause Alice and her customers to wait longer for their dashboards to load. With SPICE, Amazon QuickSight’s in-memory data store, you can offload user traffic from your database, while also achieving high concurrency limits and fast, responsive performance for your end-users. The following configuration redefines our second dataset and sets
ImportMode to SPICE as highlighted below:
You can call the
create-data-set API with that configuration to create the dataset in SPICE mode:
aws quicksight create-data-set --aws-account-id $AAI --cli-input-json file://./create-data-set-cli-input-sql-spice.json
When creating datasets in SPICE mode, you’ll consume SPICE capacity. The
describe-data-set API provides details on the SPICE capacity consumed. See the relevant bits from the
describe-data-set response highlighted in the code snippet below:
aws quicksight describe-data-set --aws-account-id $AAI --data-set-id DemoDataSet3|tail -5
For SPICE datasets, the APIs also provide the option of setting up ingestions or listing past ingestions. Listing past ingestions allows you to identify ingestion status and when the data in the dataset was last updated. To list past ingestions, call the list-ingestions API for your dataset:
aws quicksight list-ingestions --aws-account-id $AAI --data-set-id DemoDataSet3
Set up ingestions to update the data in your dataset from your data source. As you may have new data in your Redshift cluster, you can use the
create-ingestion API for your dataset to trigger a SPICE refresh:
aws quicksight create-ingestion --aws-account-id $AAI --data-set-id DemoDataSet3 --ingestion-id DemoDataSet3-Ingestion2
Listing ingestion history again shows the new ingestion in the state
RUNNING. See the following code:
aws quicksight list-ingestions --aws-account-id $AAI --data-set-id DemoDataSet3
Versioning and aliasing
As you may have noticed, the template and dashboard APIs support versioning. When you create a template or dashboard, version 1 of that entity is created, and each update of a template or dashboard results in a new version of that entity with an incremented version number. Versioning can be useful when you want to republish an old version of a dashboard or ensure you’re building off a known version of the template. For example, if you published your dashboard multiple times, but want to republish the first version, you can call the
update-dashboard-published-version API as follows:
aws quicksight update-dashboard-published-version --aws-account-id $AAI --dashboard-id DemoDashboard1 --dashboard-version-number 1
Versioning becomes even more powerful with aliases. A template or dashboard alias is a pointer to a specific template or dashboard version. Aliases are helpful when you want to point to a logical version of a resource rather than an explicit version number that needs to be manually updated. This feature can be helpful for development workflows where you want to make changes to a template and only want production code to use an approved template version. For example, you can create a ‘PROD’ template alias for your approved production template and point it to version 1, as shown below:
aws quicksight create-template-alias --aws-account-id $AAI --template-id DemoDashboardTemplate --template-version-number 1 --alias-name PROD
When you create a dashboard from this template, you can specify the
SourceEntity as the ‘PROD’ template alias to always publish the dashboard from the approved production template version. Note how the template Arn contains the template alias name in the call to the
create-dashboard API below:
aws quicksight create-dashboard --generate-cli-skeleton > create-dashboard-cli-input.json
If you were to create new versions of the template, you could then update the ‘PROD’ template alias to point to the new template version, without touching your dashboard creation code from above. For example, if you wanted to set template version 3 to be your approved production version, you can call the
update-template-alias API as shown below:
aws quicksight update-template-alias --aws-account-id $AAI --template-id DemoDashboardTemplate --template-version-number 3 --alias-name PROD
Keep an eye out for a future blog post that will detail more examples of using versioning and aliases for large scale deployments!
Amazon QuickSight’s data source, dataset, dashboard, and SPICE APIs are available in both Standard and Enterprise editions, with edition-specific support for functionality. Fine-grained access control APIs and template support for dashboard APIs are available in Amazon QuickSight Enterprise edition. APIs for Amazon QuickSight are part of the AWS SDK and are available in a variety of programming languages. For more information, see API Reference and Tools to Build on AWS.
With QuickSight’s new themes, APIs, and additional customization options underway, there are many creative ways to author the next chapter in your analytics story. To be a part of future API previews and connect with us, sign up for the embedding early access program.
About the Author
Jose Kunnackal John is a principal product manager for Amazon QuickSight.