You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

QuickSight仪表板PDF下载功能及API导出方法咨询

QuickSight Dashboard PDF Export: Console & API Walkthrough

Hey there! Let's tackle your questions about exporting QuickSight dashboards to PDF, both through the console and API:

Console PDF Export Confirmation

First things first: Yes, QuickSight absolutely supports downloading dashboards as PDF—the exact workflow you mentioned (Export > Download as PDF) is a native, built-in feature. You just need the right permissions (like QuickSightAuthor or higher) to access that option in the console.

API Implementation with Boto3

I get why you might have missed this in the boto3 docs—PDF exports aren't under a straightforward "export" method. Instead, you'll use QuickSight's Dashboard Snapshot API to generate and retrieve the PDF. Here's a step-by-step guide with code examples:

  1. Set up the Boto3 QuickSight Client
    Make sure your AWS credentials have the quicksight:StartDashboardSnapshotJob and quicksight:DescribeDashboardSnapshotJob permissions first:

    import boto3
    import time
    import uuid
    
    # Initialize the client with your AWS region
    quicksight_client = boto3.client('quicksight', region_name='us-east-1')
    
  2. Start the Snapshot Job (Generate PDF)
    Use the start_dashboard_snapshot_job method to kick off the PDF generation. You'll need your AWS account ID, target dashboard ID, a unique job ID (I use a UUID for this), and configuration details:

    # Replace these values with your own
    AWS_ACCOUNT_ID = 'your-aws-account-id'
    DASHBOARD_ID = 'your-target-dashboard-id'
    SHEET_ID = 'sheet-id-from-dashboard-url' # Find this in the dashboard edit page URL
    
    # Generate a unique job ID
    snapshot_job_id = str(uuid.uuid4())
    
    response = quicksight_client.start_dashboard_snapshot_job(
        AwsAccountId=AWS_ACCOUNT_ID,
        DashboardId=DASHBOARD_ID,
        SnapshotJobId=snapshot_job_id,
        # Use RegisteredUser if exporting for a specific IAM user/role
        UserConfiguration={'AnonymousUser': {}},
        SnapshotConfiguration={
            'FileGroups': [
                {
                    'Files': [
                        {
                            'SheetSelections': [
                                {
                                    'SheetId': SHEET_ID,
                                    'SelectionScope': 'ALL_VISUALS' # Export the entire sheet
                                }
                            ],
                            'Format': 'PDF'
                        }
                    ]
                }
            ]
        }
    )
    
  3. Poll for Job Completion & Get Download URL
    Snapshot jobs take a few seconds to complete, so you'll need to check the status periodically until it finishes:

    while True:
        status_response = quicksight_client.describe_dashboard_snapshot_job(
            AwsAccountId=AWS_ACCOUNT_ID,
            DashboardId=DASHBOARD_ID,
            SnapshotJobId=snapshot_job_id
        )
    
        job_status = status_response['SnapshotJobStatus']
        if job_status == 'COMPLETED':
            # Extract the PDF download URL
            pdf_url = status_response['Result']['SnapshotFiles'][0]['FileUrl']
            print(f"PDF is ready! Download link: {pdf_url}")
            break
        elif job_status in ['FAILED', 'CANCELLED']:
            error_msg = status_response.get('ErrorInfo', {}).get('Message', 'Unknown error occurred')
            print(f"Snapshot job failed: {error_msg}")
            break
        # Wait 10 seconds before checking again
        time.sleep(10)
    

Key Notes

  • The generated PDF link expires after 24 hours by default, so be sure to download it promptly.
  • If you're exporting for a specific registered QuickSight user, replace the AnonymousUser block with {'RegisteredUser': {'Arn': 'arn-of-your-user/role'}}.
  • Double-check your IAM permissions and QuickSight account quotas (like concurrent snapshot job limits) to avoid unexpected issues.

内容的提问来源于stack exchange,提问作者mayukhc

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 20:07:37