Saltar al contenido principal
Versión: v1.1.4

Command-line reference

Who this is for: you need the exact name or behaviour of a flag.

What you can do after reading: build any InvenTag command line, and know which flags work today.

This page matches inventag --help of the release that this version of the docs describes. Run inventag --help to see the flags of the release you have installed. The Status column says what we saw when we ran the flag offline against mocked AWS. "Not re-tested" means we did not run it for this page. Details are on Feature status.

Commands​

Text
inventag [flags] run a scan and write reports
inventag templates list [--kind K] [--all]
inventag templates show NAME|PATH [--resolved]
inventag templates init NAME|PATH --output FILE|FOLDER [--name NAME] [--extend] [--force]
inventag templates validate NAME|PATH [NAME|PATH ...]

The inventag command works the same on Linux, macOS and Windows. templates must be the first word after the program name.

Templates​

FlagDefaultStatusWhat it does
--template NAME|PATHnoneWorksUse a template. Repeat for one report, one tag-policy and one config template. See Templates.

templates subcommands​

CommandWhat it does
templates listLists templates with kind, source and description, and the folders searched. --kind report|tag-policy|config filters; --all also shows templates hidden by one with the same name.
templates show NAMEPrints the file. --resolved prints the result after extends and defaults.
templates init NAME --output PATHCopies a template into your project. --extend writes a short file that inherits; --name sets the name; --force overwrites.
templates validate NAME|PATH ...Checks files and the templates they refer to. Exit code 0 if all are valid, 1 otherwise.

Accounts​

FlagDefaultStatusWhat it does
--accounts-file FILEnoneWorksRead accounts from a JSON or YAML file. See Configuration files.
--accounts-promptoffWorksAsk for accounts and credentials interactively.
--cross-account-role ARN|NAMEnoneWorksA full role ARN is assumed directly. A role name is combined with each account ID in --accounts-file. A name without --accounts-file stops with exit code 2.

Output​

FlagDefaultStatusWhat it does
--create-excelon if no other output flagWorksWrite multi_account_bom_<timestamp>.xlsx.
--create-wordoffWorksWrite multi_account_bom_<timestamp>.docx.
--create-google-docsoffWorks (mocked clients only)Create the Word report as a Google Doc. Needs the Google add-on (pip install "inventag-aws[google]"). See Google Sheets and Docs.
--create-google-sheetsoffWorks (mocked clients only)Create the Excel report as a Google Sheets spreadsheet.
--google-credentials FILEnoneWorks (mocked clients only)Service account key file. Without it, Application Default Credentials are used.
--google-oauth-client FILEnoneWorks (mocked clients only)OAuth client file; you sign in in the browser.
--google-folder-id IDnoneWorks (mocked clients only)Drive folder for the files.
--google-share-with EMAILnoneWorks (mocked clients only)Share with this address. Repeat for more.
--google-share-role ROLEreaderWorks (mocked clients only)reader, commenter or writer.
--google-share-anyoneoffWorks (mocked clients only)Anyone with the link can read. Files are private without it.
--google-title TITLEdated nameWorks (mocked clients only)Title of the Google files.
--output-directory DIRbom_outputWorksFolder for all output files.
--per-account-reportsoffWorksOne <account-id>_bom_<timestamp> file per account instead of one consolidated report.

What to scan​

FlagDefaultStatusWhat it does
--account-regions LISTevery enabled regionWorksComma-separated region codes, for example us-east-1,eu-west-1. IAM, the S3 bucket list, CloudFront and Route 53 are always read once from us-east-1, so you need not list it.
--account-services LISTallWorksComma-separated service names that are kept in the report, matched against the Service column, for example EC2,S3.
--account-tags JSONnoneWorksTag filter, for example '{"Environment":"prod"}'. Only resources with those tags are kept.
--fallback-display auto|always|neverautoWorksWhether to show resources found only through the Resource Groups Tagging API. auto shows them only for services with no results from their own discovery code.
--hide-fallback-resourcesoffNot re-testedSame as --fallback-display never. Deprecated.

Analysis​

FlagDefaultStatusWhat it does
--enable-network-analysisoffWorksAdds a Network Analysis sheet to the Excel report when VPCs are found. Adds nothing with --template. See Network and security analysis.
--enable-security-analysisoffWorksAdds a Security Analysis sheet to the Excel report when security groups are found. Adds nothing with --template.
--enable-cost-analysisoffWorksAdds a Cost Analysis sheet (and the four forgotten_analysis.* columns) to the default workbook. Makes extra Cost Explorer, Pricing and CloudWatch calls, also with --no-billing-validation. Needs pricing:GetProducts and cloudwatch:GetMetricStatistics. The costs are estimates from the AWS Pricing API, not your invoice.
--billing-validation, --no-billing-validationonWorksUse Cost Explorer during discovery to find services with spend. AWS charges for each Cost Explorer request. --no-billing-validation stops those calls.

Configuration files​

FlagDefaultStatusWhat it does
--tag-mappings FILEnoneWorksAdds one named column per mapping. See Configuration files.
--service-descriptions FILEnonePartialAdds a service_description column. A built-in description wins for S3, EC2, RDS, Lambda and VPC unless the entry names a template. See Configuration files.
--bom-config FILEnoneWorksSets fields of the BOM processing configuration from a YAML or JSON file. Other keys are ignored with a warning that names them.
--validate-configoffWorksLoad and check the configuration, then exit.
--validate-config-onlyoffWorksCheck only the files you name, then exit. It makes no AWS call.

Report layout files​

These flags change the layout of the default Excel and Word reports with a YAML or JSON file. See Layout files for one report.

FlagDefaultStatusWhat it does
--word-template PATHnoneWorksLayout file for the Word report. Needs --create-word; without it the run stops with exit code 2.
--excel-template PATHnoneWorksLayout file for the Excel report. With --create-word alone, the run stops with exit code 2.
--print-default-template word|excelnoneWorksPrint the default layout file for that format, then exit with code 0.
--validate-templatesoffWorksCheck the files given with --word-template and --excel-template, then exit. It makes no AWS call. Without one of those flags: exit code 2.

Parallel processing​

FlagDefaultStatusWhat it does
--max-concurrent-accounts N4WorksAccounts scanned at the same time.
--account-processing-timeout SECONDS1800WorksTime allowed per account (at least 60).
--disable-parallel-processingoffWorksScan one account at a time.

State and change tracking​

FlagDefaultStatusWhat it does
--enable-state-managementonWorksSave a snapshot in <output>/state/.
--disable-state-managementoffWorksDon't save snapshots or changelogs.
--enable-delta-detection / --disable-delta-detectiononWorksCompare the new snapshot with the previous one. --disable-delta-detection writes no change report.
--generate-changelog, --no-generate-changelogonWorksWrite changelog_<timestamp>.md from the second run on. --no-generate-changelog stops it.

Logging​

FlagDefaultStatusWhat it does
--verbose, -voffWorksShow each step.
--debug, -doffWorksShow every AWS request. Secrets are masked.
--log-file FILEnoneWorksAlso write a detailed log to this file.
--disable-account-loggingoffWorksDon't prefix log lines with the account.

Credentials​

FlagDefaultStatusWhat it does
--validate-credentialsoffWorksCheck every account's credentials, then exit (0 if all work, 1 if not).
--credential-timeout SECONDS30WorksTimeout for each credential check.
--skip-credential-validationoffWorksSkip the credential check at the start of a run.

Read-only guard and audit​

The read-only guard is always on. It blocks every AWS call that is not a read, and reads that return secrets or data.

FlagDefaultStatusWhat it does
--audit-output FILEnoneWorksWrite a JSON list of every AWS operation the run called, allowed and blocked.
--validate-operations SERVICE:OPERATION ...noneWorksCheck operations against the guard, then exit (0 if all allowed, 1 if not).
--enforce-read-only, --security-validation, --enable-production-safetyonNo effectKept so old commands still run. The guard is always on.
--disable-production-safetyoffStops with exit code 2The guard cannot be turned off.
--compliance-standard ...noneStops with exit code 2Not implemented: a standard cannot be checked from an inventory. Use a tag-policy template.
--risk-threshold LEVELnoneWorksWith --enable-security-analysis: exit code 4 if a security group rule is at or above LOW, MEDIUM, HIGH or CRITICAL. Without --enable-security-analysis: exit code 2.
Terminal
ALLOWED ec2:DescribeInstances (read-only prefix)
ALLOWED s3:GetBucketTagging (read-only prefix)
BLOCKED s3:PutObject (operation is not on the read-only allowlist)
BLOCKED secretsmanager:GetSecretValue (operation returns secrets, signed URLs or customer data)
$ echo $?
1

What flags that stop with exit code 2 print:

Terminal
$ inventag --create-google-docs
inventag - WARNING - - No output format specified. Use --create-word or --create-excel
inventag - WARNING - - No account specification method provided. Using default AWS credentials.
inventag: error: Google: Google output needs libraries that are not installed (google.auth). Install the Google libraries with: pip install "inventag-aws[google]"
(exit code 2)

$ inventag --risk-threshold HIGH
inventag: error: --risk-threshold: needs --enable-security-analysis, which produces the risk levels it checks.
(exit code 2)

$ inventag --compliance-standard soc2
inventag: error: --compliance-standard: Compliance-standard enforcement is not implemented yet; the option has never changed InvenTag's behaviour.
(exit code 2)

$ inventag --disable-production-safety
inventag: error: --disable-production-safety: The read-only guard cannot be disabled from the CLI: InvenTag only needs read access, so non-read AWS calls are always blocked.
(exit code 2)

S3 upload​

FlagDefaultStatusWhat it does
--s3-bucket BUCKETnoneWorksUpload every file the run wrote (Excel, Word and tag-compliance JSON) to this bucket. The run exits with code 1 if an upload fails. Needs s3:PutObject.
--s3-key-prefix PREFIXbom-reports/WorksFolder (key prefix) in the bucket. Files go under <prefix><UTC timestamp>/.
--s3-encryption AES256|aws:kmsAES256WorksServer-side encryption for the uploads.
--s3-kms-key-id KEYnoneWorksKMS key for aws:kms.

See Upload reports to S3 on a schedule.

Exit codes​

CodeMeaning
0Success. Also 0 when some accounts failed but others worked, and when no resources were found (no report is written). See Feature status.
1An error: invalid arguments, configuration or template, failed credentials, every account failed, a failed S3 upload, or a report format that could not be written
2Invalid command line: unknown or badly formed options, flags that are not implemented, bad Google options, a layout file flag without the report it needs, or a role name without --accounts-file
3Reports written, but a config template with fail_on_tag_violations: true found tag policy violations
4Reports written, but --risk-threshold found a security group rule at or above that level