跳到主要内容
版本:v1.4.1(当前)

示例:快速审计一个账户

目标: 几分钟内得到一个账户易于阅读的 Excel 和 Word 清单。

你需要: 该账户的凭证,例如 aws sso login --profile prod-readonly 和 export AWS_PROFILE=prod-readonly。

未针对 AWS CLI 验证:本节中的登录命令。

模板​

内置的 single-account 配置模板会扫描 us-east-1,并使用 standard-bom 版式写出两个文件。 复制它并设置你的区域:

Terminal
inventag templates init single-account --output .inventag/templates/audit.yaml
.inventag/templates/audit.yaml
format_version: 1
kind: config
name: audit
description: Scan the account of your current credentials and write Excel and Word reports.
spec:
regions: [us-east-1, eu-west-1] # the regions you use
outputs: [excel, word]
output_directory: bom_output
report_template: standard-bom

命令​

Terminal
inventag templates validate audit
inventag --template audit

输出​

以下是同一版式、使用一个区域参数的离线运行结果(示例数据;IAM 列在区域 global 下,所以摘要统计为 2 个区域):

输出
inventag - WARNING - - No account specification method provided. Using default AWS credentials.
Wrote bom_output/multi_account_bom_20261112_090000.docx
Wrote bom_output/multi_account_bom_20261112_090000.xlsx

工作表: Summary、ATHENA、DYNAMODB、EC2、EVENTS、IAM、KMS、LAMBDA、S3、VPC

Summary 工作表:

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

ServiceResourcesShare
ATHENA12.7%
DYNAMODB12.7%
EC2410.8%
EVENTS12.7%
IAM12.7%
KMS1437.8%
LAMBDA12.7%
S3410.8%
VPC1027.0%
Total37100.0%

工作表: Summary、ATHENA、DYNAMODB、EC2、EVENTS、IAM、KMS、LAMBDA、S3、VPC

S3 工作表的前几行:

AccountRegionServiceTypeNameIDARNTag: CostCenterTag: DataClassificationTag: EnvironmentTag: Owner...
123456789012us-east-1S3Bucketacme-app-logsacme-app-logsarn:aws:s3:::acme-app-logsCC-1001internalprodplatform...
123456789012us-east-1S3Bucketacme-data-lakeacme-data-lakearn:aws:s3:::acme-data-lakeCC-2002proddata...
123456789012us-east-1S3Bucketacme-reportsacme-reportsarn:aws:s3:::acme-reports1234Productionfinance...
123456789012us-east-1S3Bucketacme-scratchacme-scratcharn:aws:s3:::acme-scratch...

该工作表共有 12 列;此处显示前 11 列。

下一步​

  • 添加标签检查:inventag --template audit --template security-baseline。
  • 常含机密的字段的值(例如 Lambda 环境变量)在报告中显示为 ***REDACTED***。
  • 每周运行一次:在 CI/CD 中运行 InvenTag。