aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.72k stars 3.94k forks source link

QuickSight: Proper Analysis or Template CDK Construct #19212

Open gunarkroeger opened 2 years ago

gunarkroeger commented 2 years ago

Description

Currently, the only way to create a QuickSight::Analysis is by giving it a QuickSight::Template as sourceEntity. And the only way to create a QuickSight::Template is by giving it either a QuickSight::Template or a QuickSight::Analysis as source Entity. So it is impossible to automate the creation of the Analysis completely.

Use Case

We want to reduce manual steps when deploying our pipeline as much as possible. We also want to version control the visuals in our analysis.

Proposed Solution

To properly automate QuickSight with CDK we need a way to define the Template with CDK, by perhaps passing it a json with the definition of all visuals in the analysis. This way we can source control the Analysis design and eliminate the manual steps for creating the analysis in the console.

Ideally there would be a way to call aws-describe-template to see the json of an analysis created with the console manually, that can then be included in the CDK src.

Other information

No response

Acknowledge

comcalvi commented 2 years ago

This needs CloudFormation to allow the creation of Template from JSON. You should be able to make any service calls from the AWS CLI already.

michuer commented 2 years ago

This needs CloudFormation to allow the creation of Template from JSON. You should be able to make any service calls from the AWS CLI already.

Or to allow the creation of Analysis without Template. I don't see any details in AWS Console about Template when creating manually Analysis, same with details when calling the CLI aws quicksight describe-analysis. I can see DataSetArns but nothing about template which is required in CfnAnalysis. Looks like a bug IMHO

peterwoodworth commented 2 years ago

Please raise any concerns about this to the thread in the coverage roadmap

jaykumarhpatel commented 1 year ago

Still today not able to create QuickSight Analysis and Template using CDK. Any update on this Issue?

gunarkroeger commented 1 year ago

Hi @comcalvi, quicksight now allows creating a template from JSON. Could you reevaluate implementing this feature?

peterwoodworth commented 1 year ago

@gunarkroeger unless there's a way to do this with CloudFormation resources (that doesn't appear to be the case) then we are blocked

gunarkroeger commented 1 year ago

@peterwoodworth actually I see that there is now a TemplateVersionDefinitionProperty and a AnalysisDefinitionProperty that look like they would solve the issue. Haven't tested it yet

peterwoodworth commented 1 year ago

Great, I'm not really that familiar with quicksight. let me know! It looks to me like all the cloudformation properties are available in CDK already on a quick glance, let me know if that's incorrect too.

gmournos commented 1 year ago

This might help :)

https://medium.com/@gmournos/aws-quicksight-as-code-a-unified-approach-for-quicksight-development-and-deployment-using-aws-30bbb6bd253a

adiaholic commented 2 months ago

I had tried it a few months back, didn't find a straight forward way to deploy analysis boards to prod although I had created them manually on staging.

Steps to publish Analysis on prod using CDK:

  1. Create the Analysis on staging
  2. Use boto3 quicksight client to list_analyses
  3. Grab the ARN for the analysis from there comparing the required Analysis name on staging
  4. Use describe_analysis_definition function from the quicksight client to download the JSON schema
  5. Get the analysis definition under the Definition key in the JSON schema
  6. Modify the definition JSON recursively to make the below 2 changes: a. Convert keys from upper camel case to lower camel case b. Convert values from boolean strings to boolean values i.e "true" to True
  7. Use this definition with aws_cdk.aws_quicksight
  8. Use CfnAnalysis in CDK to deploy to prod
    aws_quicksight.CfnAnalysis(
            scope,
            ...
            definition=<generated_definition>
            ...
        )