Boto3 deploy dashboard with link to analysis

We want to be able to deploy a dashboard from an analysis and retain a reference that the dashboard is deployed from this analysis.

Steps to achieve in console:

  1. In the console, after creating an analysis, click Share -> Publish dashboard
  2. Under Publish new dashboard as, enter new dashboard name and click Publish dashboard
  3. Now quicksight console should redirect you to the dashboard. Hit back to return to the analysis.
  4. Now if I click on Replace an existing dashboard, it should show the newly created dashboard.

The question is, how can I achieve this with boto3? We tried to use boto3 to deploy an analysis and a dashboard from a template, but it does not retain this information that links the analysis to the dashboard.

Hi,

I assume you deployed everything and then checked in Quicksight, if you can publish the analysis to the dashboard. Correct?

Does your user have access to the Dashboard? In the Quicksight frontend, you can only “re-publish” an analysis to a specific dashboard, when you have access to this dashboard.

Thomas

2 Likes

@mangell - Are you interested to deploy the dashboard ( instead of front end, you are looking for backend approach). Please see boto3 API for QuickSight ( link - QuickSight - Boto3 1.26.99 documentation)

Regards - San

1 Like

Hi,

There are 2 approaches
It depends on how many dashboard instances you want to launch with this analysis.

If only 1 analysis and 1 dashboard, Then you can create a dashboard from analysis through boto3.quicksight.create_dashboard

For this, you will need arn of the analysis and all datasets you are using for the analysis,
And create a dashboard.

This method expects you to provide dashboard-id,
So you can generate id with uuid in python and store in the DB/ settings/environment depending on how your app is configured.
This method also lets you pass the who it needs to be shared with info too.

Now, whenever in the future when you want to update the dashboard from analysis, you can delete the current dashboard with boto3.Quicksight.delete_dashboard and create a new dashboard, where your dashboard id is the same as the previous one, this way you don’t have to worry about providing a new link to users (who it is shared with) or update iframe if your embedding the dashboard.

2nd approach

If there are multiple dashboards with the same analysis with diff datasets (client respective)

Then create a template from analysis using boto3 and, then do everything the same as 1st approach, but use template arn instead of analysis arn.

Let me know if you need further details

2 Likes

Thanks @neelay for explanation. Kudos to you :slight_smile:
Regards - San

1 Like

Hi @neelay,

Thank you for the response.

Do you have a code example on how to create a dashboard from an analysis from boto3? I can’t seem to find this information on the boto3 website, it says the documentation is too large to render and there are no specific examples for this

@thomask Yes, the user has access. They are in a group which is a co-owner for both the analysis and dashboard.

We extracted the artifacts from one account into .json files.

The extracted information does not link an analysis/template to the dashboard (the analysis_id is not in the dashboard .json, and the dashboard_id is not in the analysis/template.json). That is the information that i assume is missing and needed. We want to extract/deploy the linkage between the two using boto3

@mangell

I see this link referenced on the boto3.create_dashboard, which has everything.

If you need more help, PM me

1 Like