跳到主要內容
版本: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。