Skip to content

runbooks inventory enrich-costsΒΆ

Auto-generated from runbooks inventory enrich-costs --help on 2026-05-21. Source of truth: runbooks PyPI package v1.3.22

Usage: runbooks inventory enrich-costs [OPTIONS]

  Enrich resources with Cost Explorer data with enterprise options.

  Adds 3 columns: monthly_cost, annual_cost_12mo, cost_trend_3mo.

  Note: Cost Explorer provides account-level granularity (not resource-level).

  πŸ”‘ Profile Requirements:   --profile: BILLING profile with Cost Explorer API
  permissions

    Required IAM permissions:     - ce:GetCostAndUsage (minimum)     -
    ce:GetCostForecast     - organizations:ListAccounts (for multi-account)

    See ~/.aws/config for available profiles.

  πŸ’‘ Common Workflows:   Discovery β†’ Costs:     runbooks inventory resource-
  explorer --resource-type ec2 --output /tmp/ec2.csv     runbooks inventory
  enrich-costs --input /tmp/ec2.csv --profile BILLING

    With account filtering:     runbooks inventory enrich-costs --input
    /tmp/ec2.csv \       --profile BILLING --accounts
    123456789012,987654321098

  Enterprise Features: - Multi-format export (--export for CSV/JSON/Markdown)
  - Account filtering (--accounts to enrich specific accounts only) - Cost
  metric selection (AmortizedCost, UnblendedCost, BlendedCost) - Granularity
  control (MONTHLY for trends, DAILY for detailed analysis) - Cost
  thresholding (filter resources below minimum monthly cost)

  Cost Metric Options: - AmortizedCost: RI/SP costs distributed across
  resources (enterprise recommendation) - UnblendedCost: Actual charges
  without RI/SP distribution (default) - BlendedCost: Organization-wide cost
  averaging

  Examples:     # Single profile enrichment (5-layer pipeline: Layer 3)
  runbooks inventory enrich-costs \       --input /tmp/resources-with-
  accounts.csv \       --profile ${BILLING_PROFILE} \       --months 12
  --output /tmp/resources-with-costs.csv

      # Filter high-cost resources only (>$10/month)     runbooks inventory
      enrich-costs \       --input /tmp/resources-with-accounts.csv \
      --profile ${BILLING_PROFILE} \       --cost-threshold 10.0 --skip-empty-
      costs \       --output /tmp/high-cost-resources.csv

      # Daily granularity with amortized costs     runbooks inventory enrich-
      costs \       --input /tmp/resources-with-accounts.csv \       --profile
      ${BILLING_PROFILE} \       --granularity DAILY --cost-metric
      AmortizedCost \       --output /tmp/resources-with-daily-costs.csv

Options:
  --tags TEXT                     Filter by tags (key=value format)
  --accounts TEXT                 Filter by specific account IDs
  --all                           Multi-account discovery
                                  (CENTRALISED_OPS_PROFILE as aggregator).

                                  πŸ“‹ Behavior: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                  ━━━━━━━━━━━━━━━

                                  β€’ Queries AWS Resource Explorer aggregator
                                  index β€’ Discovers resources across ALL
                                  accounts in Landing Zone β€’ Requires
                                  CENTRALISED_OPS_PROFILE with cross-account
                                  permissions

                                  πŸ” Enrichment Layers (Automatic):   β€’
                                  Organizations metadata: MANAGEMENT_PROFILE
                                  β€’ Cost data: BILLING_PROFILE   Note:
                                  Enrichment uses separate profiles regardless
                                  of discovery mode

                                  Use Case: Enterprise platform teams managing
                                  67+ account Landing Zones
  --profiles TEXT                 Specific AWS profiles (comma-separated,
                                  e.g., "billing,security,audit")
  --regions TEXT                  Specific AWS regions (space-separated)
  --all-regions                   Process all enabled AWS regions
  -f, --format, --output-format [json|csv|table|pdf|markdown]
                                  Output format for results display
                                  (-f/--format preferred, --output-format
                                  legacy)
  --output-dir PATH               Directory for generated files and evidence
                                  packages
  --all-outputs                   Generate all output formats (JSON, CSV, PDF,
                                  Markdown) - use with --output-dir
  --csv                           Export to CSV format (convenience flag,
                                  activates --all-outputs)
  --json                          Export to JSON format (convenience flag,
                                  activates --all-outputs)
  --markdown                      Export to Markdown format (convenience flag,
                                  activates --all-outputs)
  --profile TEXT                  AWS profile for single-account operations.

                                  πŸ“‹ Profile Selection Guide: ━━━━━━━━━━━━━━━━━
                                  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

                                  Single Account β†’ Use --profile YOUR_PROFILE
                                  Example: --profile dev-account   When:
                                  Developer/operator working in one AWS
                                  account

                                  Multi-Account LZ β†’ Use --all-profiles (see
                                  inventory commands)   Example: --all-
                                  profiles   When: Platform team discovering
                                  across organization

                                  πŸ” Enrichment Profiles (Automatic):   β€’
                                  Organizations: MANAGEMENT_PROFILE   β€’ Costs:
                                  BILLING_PROFILE   Note: Separate from
                                  discovery profile

                                  Decision: Single account = --profile |
                                  Multi-account = --all-profiles
  --region TEXT                   AWS region override (default: ap-
                                  southeast-2)
  --dry-run                       Safe analysis mode - no resource
                                  modifications (enterprise default)
  --input PATH                    Input CSV from resource-explorer or enrich-
                                  accounts  [required]
  --months INTEGER                Number of trailing months for cost analysis
                                  (default: 12)
  --granularity [MONTHLY|DAILY]   Cost Explorer granularity (MONTHLY for
                                  trends, DAILY for detailed analysis)
  --cost-metric [AmortizedCost|UnblendedCost|BlendedCost]
                                  Cost metric type: AmortizedCost (RI/SP
                                  distributed), UnblendedCost (actual
                                  charges), BlendedCost (org-wide averaging)
  --group-by [SERVICE|RESOURCE_ID|ACCOUNT]
                                  Cost Explorer dimension for grouping costs
                                  (optional)
  --skip-empty-costs              Exclude resources with $0 monthly cost from
                                  output
  --cost-threshold FLOAT          Minimum monthly cost threshold for inclusion
                                  (e.g., 1.0 for >$1/month resources)
  --output PATH                   Output CSV path  [required]
  --console-format                Display Rich table to console AND export CSV
                                  (dual output)
  -v, --verbose                   Show detailed execution logs
  --format-output [compact|table|json]
                                  Output format (renamed from --format to
                                  avoid conflict)
  --help                          Show this message and exit.

ExamplesΒΆ