CLICommands
l4 export
l4 export is the only command group that honors --csv natively — use it when you want a clean dump of costs or recommendations for a spreadsheet, BI tool, or backup.
Subcommands
| Command | Purpose |
|---|---|
costs | Export cost data over a time period |
recommendations | Export the full recommendations list |
costs
l4 export costs [flags]| Flag | Description |
|---|---|
--period <p> | Time period: 7d, 30d, 90d, 365d |
--account <a> | Filter by account |
--format | csv (default) or json |
--out <path> | Write to file instead of stdout |
l4 export costs --format csv --period 90d > costs.csv
l4 export costs --format json --period 30d --out costs.json
l4 export costs --period 30d --account "123456789012 (prod)" > prod-costs.csvrecommendations
l4 export recommendations [flags]| Flag | Description |
|---|---|
--account <a> | Filter by account |
--format | csv (default) or json |
--out <path> | Write to file instead of stdout |
l4 export recommendations --format csv > recommendations.csv
l4 export recommendations --format json --out recs.jsonWhy a separate command?
l4 costs --csv and l4 recommendations list --csv are intentionally not supported. Those commands are paginated and the per-page envelopes don't compose cleanly into a single CSV. l4 export handles the pagination internally and emits a single, well-formed CSV.
Patterns
Daily archive to S3:
DATE=$(date -u +%Y-%m-%d)
l4 export costs --period 30d --format json | aws s3 cp - "s3://my-bucket/levelfour/costs-${DATE}.json"Spreadsheet-friendly recommendations report:
l4 export recommendations --format csv > recs-$(date +%Y%m%d).csv