CloudFormation- QuickSight Parameters

Hi,

I’m in the process of redefining all my QuickSight resources in CloudFormation for the sake of ease of migration and redeployability.

I’ve come to a halt due to the difficulty defining the custom parameters that I have in one of my QuickSight analyses within CloudFormation. The documentation for defining a QuickSight datetime parameter within CloudFormation is sparse and only mentions that it should be a string (without stating how this should be formatted):

AWS::QuickSight::Analysis DateTimeParameter - AWS CloudFormation (amazon.com)

On further digging I found this QuickSight article on defining parameters within a URL which gives a good indication of how a datetime parameter should be formatted:

Using parameters in a URL - Amazon QuickSight

Unfortunately, this still doesn’t help with my use-case since the datetime parameter I would like to define is a “rolling” or “relative” datetime corresponding to the start of this week and not a fixed date which I can input.

Any help would be much appreciated. Thanks,
Lewis

Can you edit this parameter in the analysis to be rolling or relative?

If so, you should be able to implement this at the analysis level and create a template that takes the parameter & it’s configurations with it. You shouldn’t need to have to define it in the CloudFormation template.

Here is an example of setting the parameter to be relative at the analysis level.

After you have set that, then you create your template.

https://docs.aws.amazon.com/cli/latest/reference/quicksight/create-template.html

Hi Max,

I have no issues setting up the parameters within an analysis that I create on the fly, the issue is when I try to define parameters as part of my CloudFormation stack.

The reason I want to define all my QuickSight resources within CloudFormation is because I use CloudFormation stacks to define all my other resources. Therefore, if I want to redeploy my environment or deploy it to a new environment all I would need are the CloudFormation stacks. The method with templates which you suggest seems like it could be a solution for redeploying or deploying in a new environment, but it adds another layer of tasks to perform post-deployment. There is CloudFormation documentation for QuickSight and so far I have been able to define all the resources I require excluding the QuickSight Analysis parameters I require.

Thanks,
Lewis

Hmm,

Yeah in that case it doesn’t seem like you can set up a “Rolling” date with a parameter in Cloudformation. It seems as though it will have to be a constant.

However, in order to create an analysis in a new environment from an existing one you need to use templates.

Steps.

  1. aws quicksight create-template (create template from analysis)
  2. aws quicksight update-template-permissions (share template to new account)

Then in your CloudFormation you will need to reference the newly created template.

There are features coming out using “Assets as Code” to allow you to create an analysis without templates and use JSON / YAML. But that is not out yet.

This is the only way to do it now

1 Like

Hi Max,

That makes sense. Thanks for all the prompt help.

Lewis

2 Likes