Example: upload reports to S3 on a schedule
Goal: every scheduled run puts its reports in an S3 bucket, encrypted, with a record of every AWS call it made.
You need:
- a bucket for reports, for example
acme-inventory-reports; s3:PutObjecton that bucket for the identity that runs InvenTag. TheOptionalS3ReportUploadstatement inconfig/defaults/iam-policy-read-only.jsondoes this, and it only allows encrypted uploads;- a scheduler: cron, a CI schedule or similar.
Command
Terminal
inventag --template standard-bom --create-excel --account-regions us-east-1 \
--s3-bucket acme-inventory-reports --s3-key-prefix inventag/ \
--audit-output audit.json
--s3-bucketuploads every report the run wrote. Uploads use server-side encryption (AES256by default; use--s3-encryption aws:kmsand--s3-kms-key-idfor a KMS key).--s3-kms-key-idworks only with--s3-encryption aws:kms; without it the run stops with exit code 2. Withaws:kmsand no key ID, S3 uses the AWS managed keyaws/s3.- Each file goes to
<prefix><UTC timestamp>/<file name>, so runs do not overwrite each other. The tag-compliance JSON file is uploaded too, when there is one. - If an upload fails, the run exits with code 1, so a scheduler notices. The reports are still on your disk.
--audit-outputwrites a JSON list of every AWS operation the run called. It works with or without S3.
Output
From an offline run against mocked AWS (sample data):
Output
inventag - WARNING - - No account specification method provided. Using default AWS credentials.
Wrote bom_output/multi_account_bom_20261112_090000.xlsx
What arrived in the bucket:
Objects in s3://acme-inventory-reports
inventag/20261112_090000/multi_account_bom_20261112_090100.xlsx
The audit file (excerpt):
audit.json (first operations shown)
{
"read_only_enforced": true,
"started_at": "2026-11-12T09:00:00+00:00",
"generated_at": "2026-11-12T09:00:00+00:00",
"allowed_prefixes": [
"List",
"Describe",
"Get",
"Head",
"Lookup",
"Search",
"BatchGet"
],
"total_calls": 96,
"allowed_calls": 96,
"blocked_calls": 0,
"operations": [
{
"service": "acm",
"operation": "ListCertificates",
"allowed": true,
"count": 1
},
{
"service": "apigateway",
"operation": "GetRestApis",
"allowed": true,
"count": 1
},
{
"service": "appsync",
"operation": "ListGraphqlApis",
"allowed": true,
"count": 1
},
{
"service": "athena",
"operation": "ListWorkGroups",
"allowed": true,
"count": 1
},
{
"service": "autoscaling",
"operation": "DescribeAutoScalingGroups",
"allowed": true,
"count": 1
},
{
"service": "backup",
"operation": "ListBackupVaults",
"allowed": true,
"count": 1
},
"..."
],
"blocked": []
}
blocked_calls is 0: the run only made read calls.
Schedule it
With cron, every weekday at 02:17:
crontab -e
17 2 * * 1-5 cd /opt/inventag-aws && .venv/bin/python inventag_cli.py --template standard-bom --create-excel --s3-bucket acme-inventory-reports --s3-key-prefix inventag/ >> /var/log/inventag.log 2>&1
In GitHub Actions, add the --s3-bucket options to the run step in
Run InvenTag in CI/CD.
Next steps
- Add an S3 lifecycle rule to the bucket if you want old reports deleted after a while. InvenTag does not change your bucket's lifecycle rules.
- Keep the
state/folder between runs if you want history: Track changes between runs.