跳到主要内容
版本:v1.0.1

Track changes between runs

Who this is for: you run InvenTag on a schedule and want to know what changed.

What you will know after reading: where snapshots are stored, what the change report contains, and how to compare runs yourself.

Snapshots​

Every run saves what it found in the output folder. After two runs against mocked AWS (sample data):

bom_output/ after two runs (reports omitted)
bom_output/changelog_20261112_090100.md
bom_output/state/metadata.json
bom_output/state/state_20261112_090000.json
bom_output/state/state_20261112_090100.json

Each snapshot holds every resource the run found:

state/state_<timestamp>.json (structure)
{
"top_level_keys": [
"compliance_data",
"metadata",
"network_analysis",
"resources",
"security_analysis"
],
"one_resource": {
"service": "S3",
"resource_type": "Bucket",
"resource_id": "acme-app-logs",
"arn": "arn:aws:s3:::acme-app-logs",
"region": "us-east-1",
"tags": {
"Environment": "prod",
"Owner": "platform",
"CostCenter": "CC-1001",
"Project": "storefront",
"DataClassification": "internal"
},
"source_account_id": "123456789012"
}
}

Keep the state/ folder between runs, for example as a CI cache or in a bucket, if you want history. Turn snapshots off with --disable-state-management.

The change report​

From the second run on, InvenTag compares the new snapshot with the one before it and writes changelog_<timestamp>.md in the output folder. The first run has nothing to compare with, so it writes no change report.

In this sample a bucket was added between the two runs. The change report lists it:

changelog_20261112_090100.md (first 30 lines)
Markdown
# Multi-Account Infrastructure Changes

**Generated:** 2026-11-12T09:00:00+00:00

## State Comparison

- **from_state:** 20261112_090000
- **to_state:** 20261112_090100
- **comparison_timestamp:** 2026-11-12T09:00:00+00:00

## Summary

| Metric | Count |
|--------|-------|
| Total Changes | 1 |
| Critical Changes | 0 |
| High Severity | 0 |
| Security Changes | 0 |
| Compliance Changes | 0 |
| Network Changes | 0 |

**Most Impacted Services:**
- S3: 1 changes

## S3 Service Changes

Changes detected in S3 service resources

### New Bucket 'acme-new-bucket' was created in S3
- **Type:** added

The report has a summary table, then a section for each service with changes. Each change has a type (such as added), a severity, the resource and its ARN.

What to know:

  • It compares one run with the run before it. It does not compare with an older run you pick.
  • It compares the resources each run found. Use the same regions, services and filters for both runs, so that a change in scope is not read as a change in your estate.
  • --no-generate-changelog stops the report but keeps the snapshots. --disable-delta-detection also stops it. --disable-state-management stops snapshots and reports.
  • InvenTag removes snapshots that are older than 30 days or beyond the newest 100. A scheduled job on a fresh runner has no earlier snapshot, so keep the state/ folder between runs.

Compare two snapshots yourself​

You can compare any two snapshots, because each is JSON with a resources list:

Shell
python3 - <<'EOF'
import json, sys, glob
old, new = sorted(glob.glob("bom_output/state/state_*.json"))[-2:]
ids = lambda f: {r.get("arn") or r.get("id") for r in json.load(open(f))["resources"]}
a, b = ids(old), ids(new)
print("Added:", sorted(b - a))
print("Removed:", sorted(a - b))
EOF

Sample output after adding one bucket between two runs (sample data):

Terminal
Added: ['arn:aws:s3:::acme-new-bucket']
Removed: []

Next steps​