Need help in migration of quicksight dashboards

:~/environment $ echo [‘{“AwsAccountId”:"’$AAI’"}', `aws quicksight describe-analysis --aws-account-id 539235944194

–analysis-id 150fea9e-4ce9-4cfd-be2f-5d9cde3c3376`]|jq ‘{“AwsAccountId”:.[0].AwsAccountId,“TemplateId”:“QSTCF-Template-V2”,“Name”:“QSTCF-Template-V2”,
“SourceEntity”:{“SourceAnalysis”:{“Arn”:.[1].Analysis.Arn,“DataSetReferences”:
[{“DataSetPlaceholder”:“DS1”,“DataSetArn”:.[1].Analysis.DataSetArns[0]}]}}}’>~/environment/create-template.json

I am getting error in creating a Template

Also i could not able to run the below code for dataset

echo [‘{“AwsAccountId”:"’$AAI’"}', aws quicksight describe-data-set --aws-account-id 539235944194 --data-set-id b77212ad-e5e9-414b-a9f3-0a4a6cfb6685,
aws quicksight describe-data-set-permissions --aws-account-id 539235944194 --data-set-id b77212ad-e5e9-414b-a9f3-0a4a6cfb6685 ] |jq
‘{“AwsAccountId”:.[0].AwsAccountId,“b77212ad-e5e9-414b-a9f3-0a4a6cfb6685”:(.[1].DataSet.DataSetId + “-V2”),“sage”:(.[1].DataSet.Name + “-V2”),
“PhysicalTableMap”:.[1].DataSet.PhysicalTableMap,“LogicalTableMap”:.[1].DataSet.LogicalTableMap,“ImportMode”:.[1].DataSet.ImportMode,
“Permissions”:.[2].Permissions}’|sed ‘s/b77212ad-e5e9-414b-a9f3-0a4a6cfb6685/b77212ad-e5e9-414b-a9f3-0a4a6cfb6685-V2/g’>~/environment/
create-data-set.json

Can you share with me the errors you are getting?

Here is a way that I do it. I hope this can help. In your console run this command.

aws quicksight create-template --aws-account-id 539235944194 --template-id **name_the_template** --source-entity file://path_to_file/file.json --profile your_profile

Before you run the command create the file below and point to it in the command.

File

{"SourceAnalysis": { "Arn": "arn_of_the_analysis_your_want_to_make_a_template", "DataSetReferences": [ { "DataSetPlaceholder": "name_of_dataset_1", "DataSetArn": "arn_of_dataset_1" }, { "DataSetPlaceholder": "name_of_dataset_2", "DataSetArn": "arn_of_dataset_2" } ] } }

Hi Max,

Thanks a lot for the quick response. I did run the code as below but still facing the error.

{“SourceAnalysis”: { “Arn”: “arn:aws:quicksight:us-east-1:539235944194:dataset/b77212ad-e5e9-414b-a9f3-0a4a6cfb6685”, “DataSetReferences”:
[ { “DataSetPlaceholder”: “name_of_dataset_1”, “DataSetArn”: “arn:aws:quicksight:us-east-1:539235944194:datasource/a44f3408-b325-4a93-9a3a-668787dfa292” },
] }

Below is the error:

gsasi@noranalytos.awsapps.com:~/environment $ {“SourceAnalysis”: { “Arn”: “arn:aws:quicksight:us-east-1:539235944194:dataset/b77212ad-e5e9-414b-a9f3-0a4a6cfb6685”, “DataSetReferences”:
bash: {SourceAnalysis:: command not found
gsasi@noranalytos.awsapps.com:~/environment $ [ { “DataSetPlaceholder”: “name_of_dataset_1”, “DataSetArn”: “arn:aws:quicksight:us-east-1:539235944194:datasource/a44f3408-b325-4a93-9a3a-668787dfa292” },
bash: [: missing `]’
gsasi@noranalytos.awsapps.com:~/environment $ ] }

The source analysis needs to be the arn of an analysis not a dataset.

And the dataset placeholder needs to be the arn of a dataset. Not a datasource

Yes Max, I did change. But when i tried to run the code, it is breaking as shown as below.

awsapps.com:~/environment $ {“SourceAnalysis”: { “Arn”: “arn:aws:quicksight:us-east-1:539235944194:analysis/150fea9e-4ce9-4cfd-be2f-5d9cde3c3376”,
bash: {SourceAnalysis:: command not found
awsapps.com:~/environment $ “DataSetReferences”: [ { “DataSetPlaceholder”: “Sage Revenue Dashboard”,
bash: DataSetReferences:: command not found
awsapps.com:~/environment $ “DataSetArn”: “arn:aws:quicksight:us-east-1:539235944194:dataset/b77212ad-e5e9-414b-a9f3-0a4a6cfb6685” } ] } }
bash: DataSetArn:: command not found

{“SourceAnalysis”: { “Arn”: “arn:aws:quicksight:us-east-1:539235944194:analysis/150fea9e-4ce9-4cfd-be2f-5d9cde3c3376”,
“DataSetReferences”: [ { “DataSetPlaceholder”: “Sage Revenue Dashboard”,
“DataSetArn”: “arn:aws:quicksight:us-east-1:539235944194:dataset/b77212ad-e5e9-414b-a9f3-0a4a6cfb6685” } ] } }

Did you run aws quicksight create-template --aws-account-id 539235944194 --template-id **name_the_template** --source-entity file://path_to_file/file.json --profile your_profile

This is a file you need to create.

file://path_to_file/file.json

{“SourceAnalysis”: { “Arn”: “arn_of_the_analysis_your_want_to_make_a_template”, “DataSetReferences”: [ { “DataSetPlaceholder”: “name_of_dataset_1”, “DataSetArn”: “arn_of_dataset_1” }, { “DataSetPlaceholder”: “name_of_dataset_2”, “DataSetArn”: “arn_of_dataset_2” } ] } }

Then you reference this file in your command line.

Thanks a lot Max,

I did uploaded the Json File in S3 buket and calling from their - Below is the error i am getting

$ aws quicksight create-template --aws-account-id 539235944194 --template-id name_the_template --source-entity file://s3://sandlerreportingbucket/Sagerevenue.json --profile default

Error parsing parameter ‘–source-entity’: Unable to load paramfile file://s3://sandlerreportingbucket/Sagerevenue.json: [Errno 2] No such file or directory: ‘s3://sandlerreportingbucket/Sagerevenue.json’

The file needs to be on your local computer.

And then direct towards the path in your local computer

Max,
$ aws quicksight create-template --aws-account-id 539235944194 --template-id name_the_template --source-entity file://C:\Users\LENOVO\Desktop\aws quicksight/Sagerevenue.json --profile default
Note: AWS CLI version 2, the latest major version of the AWS CLI, is now stable and recommended for general use. For more information, see the AWS CLI version 2 installation instructions at: Installing or updating the latest version of the AWS CLI - AWS Command Line Interface

usage: aws [options] [ …] [parameters]
To see help text, you can run:

aws help
aws help
aws help

Unknown options: quicksight/Sagerevenue.json

I did tried with the local path, but again showing some problem.

Try:

file://C:\Users\LENOVO\Desktop\“aws quicksight”\Sagerevenue.json --profile default

Sorry Max, this time i am getting some other error.

awsapps.com:~/environment $ aws quicksight create-template --aws-account-id 539235944194 --template-id name_the_template --source-entity file://C:\Users\LENOVO\Desktop\“aws quicksight”\Sagerevenue.json --profile default
Note: AWS CLI version 2, the latest major version of the AWS CLI, is now stable and recommended for general use. For more information, see the AWS CLI version 2 installation instructions at: Installing or updating the latest version of the AWS CLI - AWS Command Line Interface

usage: aws [options] [ …] [parameters]
To see help text, you can run:

aws help
aws help
aws help

Traceback (most recent call last):
File “/usr/bin/aws”, line 27, in
sys.exit(main())
File “/usr/bin/aws”, line 23, in main
return awscli.clidriver.main()
File “/usr/lib/python2.7/site-packages/awscli/clidriver.py”, line 70, in main
rc = driver.main()
File “/usr/lib/python2.7/site-packages/awscli/clidriver.py”, line 221, in main
sys.stderr.write(str(e))
UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\u201d’ in position 27: ordinal not in range(128)

You might want to update the AWS CLI. I’ve never encountered this error.

Yes Max, will try that, probably that would be the last option.

Hi Max,

I able to create a template, now while i am trying to create dashboard below is the error i am getting.

Error parsing parameter ‘cli-input-json’: Invalid JSON: Extra data: line 1 column 15 - line 11 column 6 (char 14 - 418)
JSON received: “SourceEntity”: {
“SourceTemplate”: {
“DataSetReferences”: [
{
“DataSetPlaceholder”: “SageRevenue”
“DataSetArn”: “arn:aws:quicksight:us-east-1:539235944194:dataset/b77212ad-e5e9-414b-a9f3-0a4a6cfb6685”
}
]
“Arn”: “Arn”: “arn:aws:quicksight:us-east-1:539235944194:template/SageRevenue”,
}
}

You don’t need “SourceEntity”

{
“SourceTemplate”: {
“DataSetReferences”: [
{
“DataSetPlaceholder”: “SageRevenue”
“DataSetArn”: “arn:aws:quicksight:us-east-1:539235944194:dataset/b77212ad-e5e9-414b-a9f3-0a4a6cfb6685”
}
],
“Arn”: “Arn”: “arn:aws:quicksight:us-east-1:539235944194:template/SageRevenue”
}
}

Hi Max,

Thanks for the help. Now i could create template. Now i need to create dashboard in Target account. while i am trying to use the below code, i am getting an error. Could you please help.

OrganizationAccountAccessRole:~/environment $ aws quicksight create-data-set --aws-account-id 023699950731 --cli-input-json file://CreateDashboardProduction.json

Error parsing parameter ‘cli-input-json’: Invalid JSON: Expecting ‘,’ delimiter: line 12 column 6 (char 328)
JSON received: {
“Name”: “SageRevenue”,
“PhysicalTableMap”: {
“Physicaltablename”: {
“RelationalTable”: {
“DataSourceArn”: “arn:aws:quicksight:us-east1:***********:dataset/b77212ad-e5e9-414b-a9f3-0a4a6cfb6685”,
“Schema”: “schema_name”,
“Name”: “table_name”,
“InputColumns”: [
{
“Name”: “column_name”
“Type”: “STRING”|“INTEGER”|“DECIMAL”|“DATETIME”|“BIT”|“BOOLEAN”|“JSON”,
}
]
}
}
},
“LogicalTableMap”: {
“Logicaltablename”: {
“Alias”: “any_alias”,
“DataTransforms”: [{
“ProjectOperation”: {
“ProjectedColumns”: [
“column_name”, “column_name”
]
}
}],
“Source”: {
“PhysicalTableId”: “Physicaltablename”
}
}
},
“ImportMode”: “SPICE”,
“Permissions”: [{
“Principal”: “arn:aws:sts::0**********1:assumed-role/OrganizationAccountAccessRole/gsasi@noranalytos.awsapps.com”,
“Actions”: [
“quicksight:UpdateDataSetPermissions”,
“quicksight:DescribeDataSet”,
“quicksight:DescribeDataSetPermissions”,
“quicksight:PassDataSet”,
“quicksight:DescribeIngestion”,
“quicksight:ListIngestions”,
“quicksight:UpdateDataSet”,
“quicksight:DeleteDataSet”,
“quicksight:CreateIngestion”,
“quicksight:CancelIngestion”
]
}]
}

Your JSON object is wrong.
How did you generated that version?