Skip to main content
Skip to main content

Output Formats

CDK Insights offers multiple output formats to fit your workflow. Choose from table, JSON, markdown, summary, SARIF, or GitHub Actions formats for different use cases.

šŸ“‹ Output Behavior Guide

āœ…

Terminal Output

Table and Summary formats display results directly in your terminal. No files are created.

āš ļø

File Output

JSON and Markdown formats create files in your project directory. Results are not shown in terminal.

Available Output Formats

CDK Insights supports six different output formats, each optimized for specific use cases:

  • Table - Human-readable format perfect for terminal output
  • JSON - Structured format ideal for automation and integration
  • Markdown - Documentation-friendly format for reports and GitHub
  • Summary - Concise format focusing on critical issues and metrics
  • SARIF - Security tool format for GitHub Code Scanning integration
  • GitHub Actions - Workflow commands for PR annotations

You can specify the output format using the --output flag.

Format Details

Table Format

Human-readable table format perfect for terminal output and quick reviews

Best For

  • Quick reviews
  • Terminal output
  • Development workflow

Command

npx cdk-insights scan --output table
āœ…

āœ… Displays in terminal - no files created

Output: Terminal-only • Files: No files created

Example Output

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│ Resource    │ Stack        │ Severity │ Service │ Issue                   │ Location      │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ MyBucket    │ MyStack      │ šŸ”“ CRIT  │ S3      │ Public read access      │ lib/stack.ts │
│ MyRole      │ MyStack      │ 🟠 HIGH  │ IAM     │ Overly permissive       │ lib/stack.ts │
│ MyFunction  │ MyStack      │ 🟔 MED   │ Lambda  │ High memory allocation  │ lib/stack.ts │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

JSON Format

Structured JSON output ideal for automation and integration with other tools

Best For

  • CI/CD pipelines
  • API integration
  • Automated processing

Command

npx cdk-insights scan --output json
āš ļø

āš ļø Outputs to file only - not displayed in terminal

Output: File-based • Files: Creates {stackName}_analysis_report.json

Example Output

{
  "summary": {
    "totalIssues": 15,
    "critical": 3,
    "high": 5,
    "medium": 4,
    "low": 3
  },
  "issues": [
    {
      "resource": "MyBucket",
      "stack": "MyStack",
      "severity": "CRITICAL",
      "service": "S3",
      "issue": "S3 bucket has public read access",
      "location": "lib/stack.ts:15",
      "recommendation": "Remove public access or use private bucket"
    }
  ]
}

Markdown Format

Markdown format perfect for documentation, reports, and GitHub integration

Best For

  • Documentation
  • GitHub issues
  • Team reports

Command

npx cdk-insights scan --output markdown
āš ļø

āš ļø Outputs to file only - not displayed in terminal

Output: File-based • Files: Creates {stackName}_analysis_report.md

Example Output

# CDK Insights Analysis Report

## Summary
- **Total Issues**: 15
- **Critical**: 3
- **High**: 5
- **Medium**: 4
- **Low**: 3

## Critical Issues

### MyBucket (S3)
- **Stack**: MyStack
- **Location**: lib/stack.ts:15
- **Issue**: S3 bucket has public read access
- **Recommendation**: Remove public access or use private bucket

Summary Format

Concise summary format showing only high-level statistics and critical issues

Best For

  • Quick overviews
  • Status checks
  • CI/CD status

Command

npx cdk-insights scan --output summary
āœ…

āœ… Displays in terminal - no files created

Output: Terminal-only • Files: No files created

Example Output

CDK Insights Analysis Summary
================================

šŸ“Š Total Issues: 15
šŸ”“ Critical: 3
🟠 High: 5
🟔 Medium: 4
🟢 Low: 3

🚨 Critical Issues Found:
- MyBucket: Public read access (lib/stack.ts:15)
- MyRole: Overly permissive policies (lib/stack.ts:25)
- MyFunction: High memory allocation (lib/stack.ts:35)

āš ļø  Analysis completed with critical issues found.

SARIF Format

Static Analysis Results Interchange Format for GitHub Code Scanning and other security tools

Best For

  • GitHub Code Scanning
  • Security tools integration
  • IDE integrations

Command

npx cdk-insights scan --output sarif
āš ļø

āš ļø Outputs to file only - for security tool integration

Output: File-based • Files: Creates {stackName}_analysis_report.sarif per stack, plus consolidated_analysis_report.sarif when analyzing multiple stacks

Example Output

{
  "$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
  "version": "2.1.0",
  "runs": [{
    "tool": {
      "driver": {
        "name": "CDK Insights",
        "version": "0.13.0"
      }
    },
    "results": [{
      "ruleId": "S3-PUBLIC-ACCESS",
      "level": "error",
      "message": {
        "text": "S3 bucket has public read access"
      },
      "locations": [{
        "physicalLocation": {
          "artifactLocation": { "uri": "lib/stack.ts" },
          "region": { "startLine": 15 }
        }
      }]
    }]
  }]
}

GitHub Actions Format

GitHub Actions workflow commands format for annotations in PR checks

Best For

  • GitHub Actions workflows
  • PR check annotations
  • CI/CD pipelines

Command

npx cdk-insights scan --output github-actions
āœ…

āœ… Outputs workflow commands to terminal

Output: Terminal-only • Files: No files created. When analyzing multiple stacks, a consolidated summary is generated across all stacks

Example Output

::error file=lib/stack.ts,line=15,title=S3 Public Access::S3 bucket has public read access. Remove public access or use private bucket.
::warning file=lib/stack.ts,line=25,title=IAM Permissions::Overly permissive IAM policy. Apply least privilege principle.
::notice file=lib/stack.ts,line=35,title=Lambda Memory::High memory allocation for Lambda function.

Use Case Recommendations

Development Workflow

Quick analysis during development

Recommended Format:Table

Easy to read in terminal, shows all details at a glance

npx cdk-insights scan --output table

CI/CD Pipeline

Automated analysis in continuous integration

Recommended Format:JSON

Structured data for programmatic processing and decision making

npx cdk-insights scan --output json --fail-on-critical

GitHub Integration

Creating issues from analysis results

Recommended Format:Markdown

GitHub-friendly format that can be directly posted as issue content

npx cdk-insights scan --output markdown --with-issue

Team Reporting

Sharing results with team members

Recommended Format:Markdown

Professional format suitable for documentation and team communication

npx cdk-insights scan --output markdown > analysis-report.md

Status Monitoring

Quick health checks and monitoring

Recommended Format:Summary

Concise format focusing on critical issues and high-level metrics

npx cdk-insights scan --output summary

GitHub Code Scanning

Security vulnerability tracking in GitHub Security tab

Recommended Format:SARIF

Industry-standard format integrated with GitHub Code Scanning

npx cdk-insights scan --output sarif

Advanced Output Options

Save to File

Redirect output to a file for later review or sharing:

npx cdk-insights scan --output markdown > analysis-report.md

Combine with Other Options

Output formats work with all other CDK Insights options:

npx cdk-insights scan --all --output json --fail-on-critical
npx cdk-insights scan MyStack --output markdown --with-issue

Default Format

If no format is specified, CDK Insights uses table format by default:

npx cdk-insights scan # Uses table format

Choose Your Output Format

Experiment with different output formats to find the one that works best for your workflow.