How to automate export using cli ( bash shell)?

I am trying automate the export job. But cannot think of a way of automating the list items. I can store all the ARNs in a bash array Is it possible to pass all the arn’s using a file ? It will help in automating ?

Really appreciate if anyone can share if they have already done this.
Thanks !!

aws quicksight start-asset-bundle-export-job
–aws-account-id AWSACCOUNTID
–asset-bundle-export-job-id JOBID
–resource-arns '[“arn:aws:quicksight:REGION:AWSACCOUNTID:dashboard/RESOURCEID”,“arn:aws:quicksight:REGION:AWSACCOUNTID:analysis/RESOURCEID”]’
–cloud-formation-override-property-configuration ‘{“Dashboards”: [{“Arn”: “arn:aws:quicksight:REGION:AWSACCOUNTID:dashboard/RESOURCEID”,“Properties”: [“Name”]}]}’
–include-all-dependencies
–export-format CLOUDFORMATION_JSON
–*

Hi @larry
Yes, it is possible to pass a file containing the ARN list to the StartAssetBundleExportJob API instead of hardcoding the ARNs. Here is an example of how you can do this:

  1. Create a text file called arns.txt with each ARN on a separate line, e.g.:
    arn:aws:quicksight:us-east-1:123456789012:dashboard/d-01234567890
    arn:aws:quicksight:us-east-1:123456789012:analysis/a-01234567890

  2. Read the file into a bash array:
    readarray -t arns < arns.txt

  3. Pass the array to the API call using --resource-arns “$arns”:
    aws quicksight start-asset-bundle-export-job --aws-account-id 123456789012 --asset-bundle-export-job-id myexportjob --resource-arns “$arns” --export-format CLOUDFORMATION_JSON
    This allows you to manage the ARNs in a separate file instead of hardcoding them. Hope this helps!

2 Likes

QuickSight offers list APIs to fetch the ARNs by type.

You can parse the JSON output with a CLI tool like jq.

@awsvig Have you tried the solution provided by you ? It is not working, can you please try in your environment. Here is what I have done-

  1. aws quicksight list-folder-members --aws-account-id $account_id --folder-id $folder_id |jq -r ‘.FolderMemberList.MemberArn’ > arns.txt
  2. readarray -t arns <arns.txt
  3. aws quicksight start-asset-bundle-export-job --aws-account-id $account_id --asset-bundle-export-job-id XXXXXXXXXXXXXXXX
    –include-all-dependencies
    –export-format QUICKSIGHT_JSON
    –resource-arns “$arns”

Thank you !