跳到主要內容
版本:v1.1.4

Example: inventory every account in an organization

Goal: one report that covers all your accounts, with an Account column and a tag check.

You need:

  • a role with the same name (here InvenTagReadOnly) in every account, with a read-only policy;
  • credentials for an identity that may assume those roles, for example in the management account or a delegated security account.

Template​

List your accounts:

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

Copy the built-in template and put your accounts in it:

Terminal
inventag templates init org-multi-account --output .inventag/templates/our-org.yaml
.inventag/templates/our-org.yaml
format_version: 1
kind: config
name: our-org
description: Every active account, read-only
spec:
accounts:
- account_id: "111111111111"
account_name: Production
role_arn: arn:aws:iam::111111111111:role/InvenTagReadOnly
- account_id: "222222222222"
account_name: Staging
role_arn: arn:aws:iam::222222222222:role/InvenTagReadOnly
- account_id: "333333333333"
account_name: Shared services
role_arn: arn:aws:iam::333333333333:role/InvenTagReadOnly
regions: [us-east-1]
outputs: [excel, word]
report_template: standard-bom
tag_policy: finops-cost-allocation
max_concurrent_accounts: 4

Command​

Terminal
inventag templates validate our-org
inventag --template our-org

Output​

While the placeholder IDs are still there, validate warns you:

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')

The run, with one sample bucket in each of the three made-up 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%

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

S3 sheet, first rows:

AccountRegionServiceTypeNameIDARN...
111111111111us-east-1S3Bucketacme-production-artifactsacme-production-artifactsarn:aws:s3:::acme-production-artifacts...
333333333333us-east-1S3Bucketacme-shared-services-artifactsacme-shared-services-artifactsarn:aws:s3:::acme-shared-services-artifacts...
222222222222us-east-1S3Bucketacme-staging-artifactsacme-staging-artifactsarn:aws:s3:::acme-staging-artifacts...

The sheet has 9 columns; the first 7 are shown.

Next steps​

  • If an account fails, InvenTag logs the error, reports the others and still exits with code 0, so check the log. The usual cause is the role's trust policy.
  • Scan several accounts explains the tuning options.