CLICommands

l4 export

l4 export handles the pagination internally and emits a single, well-formed CSV. Use it when the destination is a spreadsheet, a BI tool, or a backup.

Subcommands

CommandPurpose
costsExport cost data over a time period
recommendationsExport the full recommendations list
l4 costs --csv and l4 recommendations list --csv are intentionally not supported. Those commands are paginated, and the per-page envelopes do not compose cleanly into a single CSV. Output formats has what --csv does on every other command.

costs

l4 export costs [flags]
FlagDescription
--period <p>Time period: 7d, 30d, 90d, 365d
--account <a>Filter by account
--format <f>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.csv

recommendations

l4 export recommendations [flags]
FlagDescription
--account <a>Filter by account
--format <f>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.json

Archiving to object storage

Leave --out off and the export goes to stdout, so it can be piped straight into a bucket with no local file in between:

DATE=$(date -u +%Y-%m-%d)
l4 export costs --period 30d --format json | aws s3 cp - "s3://my-bucket/levelfour/costs-${DATE}.json"