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, or summary 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 four 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

You can specify the output format using the --format or --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 --format 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 --format 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 --format 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 --format 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.

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 --format table

CI/CD Pipeline

Automated analysis in continuous integration

Recommended Format:JSON

Structured data for programmatic processing and decision making

npx cdk-insights scan --format json --ci

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 --format 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 --format 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 --format summary

Advanced Output Options

Save to File

Redirect output to a file for later review or sharing:

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

Combine with Other Options

Output formats work with all other CDK Insights options:

npx cdk-insights scan --all --format json --ci
npx cdk-insights scan MyStack --format 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.