Aller au contenu principal
Version : v1.1.1

Scan several accounts

Who this is for: you look after more than one AWS account and want one consolidated report.

What you can do after reading: list your accounts once and scan them all in one run.

How it works​

InvenTag reads a list of accounts. For each one it gets credentials, either from a named AWS CLI profile or by assuming an IAM role from the identity you run it with. It scans each account, up to four at a time by default, and writes one report with an Account column.

InvenTag does not list the accounts in your AWS Organization for you. You write the list.

Create a read-only role in every account​

Follow Set up read-only access. Use the same role name everywhere, for example InvenTagReadOnly.

Get your account list​

From the management account, or a delegated administrator account:

Shell
aws organizations list-accounts \
--query "Accounts[?Status=='ACTIVE'].[Id,Name]" --output text

Write the list as a config template​

Shell
inventag templates init org-multi-account --output .inventag/templates/our-org.yaml

Edit the accounts section. Each account needs its 12-digit ID in quotes and either a role_arn or a profile_name:

YAML
spec:
accounts:
- account_id: "123456789012"
account_name: Production
role_arn: arn:aws:iam::123456789012:role/InvenTagReadOnly
- account_id: "210987654321"
account_name: Development
profile_name: dev-readonly
regions: [us-east-1, eu-west-1]

Check it, then run it:

Shell
inventag templates validate our-org
inventag --template our-org

validate catches the common mistakes: unquoted account IDs, a role ARN that points at a different account than account_id, and access keys in the file (not allowed in templates). With the placeholder IDs still in place it says (sample data):

Terminal
WARNING ~/acme-infra/.inventag/templates/our-org.yaml: account IDs 111111111111, 222222222222, 333333333333 look like placeholders; replace them with your own
OK ~/acme-infra/.inventag/templates/our-org.yaml (config 'our-org')

A run across the three sample accounts:

Terminal
Wrote bom_output/tag_compliance_20261112_090000.json
Wrote bom_output/multi_account_bom_20261112_090000.docx
Wrote bom_output/multi_account_bom_20261112_090000.xlsx
Tag policy 'finops-cost-allocation': 0 of 36 resources compliant (0.0%), 36 non-compliant, 42 out of scope.

Sheets: Summary, EVENTS, KMS, S3, VPC, Tag Compliance

Summary sheet:

AWS Resource Inventory
Bill of materials generated by InvenTag
Generated: 2026-11-12 09:00 UTC
Accounts: 3 Regions: 1

ServiceResourcesShare
EVENTS33.8%
KMS4253.8%
S333.8%
VPC3038.5%
Total78100.0%

Or use an accounts file​

The --accounts-file option also works, and it accepts access keys (avoid them if you can). If every account uses the same role name, you don't need to write each ARN:

Terminal
inventag --accounts-file accounts.yaml --cross-account-role InvenTagReadOnly --create-excel

The accounts file format is in Configuration files.

Shell
inventag --accounts-file accounts.yaml --create-excel

Tune the run​

SettingConfig template fieldFlag
Accounts scanned at once (default 4)max_concurrent_accounts--max-concurrent-accounts
Seconds allowed per account (default 1800)account_processing_timeout--account-processing-timeout
One account at a timeparallel_processing: false--disable-parallel-processing

If one account fails, for example because its role cannot be assumed, InvenTag logs the error and reports the accounts that worked. It does not fall back to your default credentials for that account. The run still exits with code 0, and the report does not name the missing account. Search the log for Failed to establish context for account. If every account fails, the run exits with code 1 and writes no report.

Next steps​