aws_s3_bucket_versioning cost estimation
Enabling S3 versioning is free, but it multiplies storage cost by keeping every old version of an object as billable data until something deletes it.
An aws_s3_bucket_versioning resource turns object versioning on for a bucket. Enabling it costs nothing by itself. What it changes is the storage math: with versioning on, every overwrite and every delete keeps the previous version as a separate, fully billed object. A delete does not free space; it just adds a zero-byte delete marker on top of versions that are still stored and still charged.
This is the classic S3 bill surprise. A bucket that looks like it holds 100 GB in the console object list can be storing many times that in noncurrent versions, all billed at the full per GB-month storage rate for their storage class. Workloads that overwrite the same keys frequently (logs, state files, build artifacts, database dumps) accumulate versions fastest, and nothing removes them automatically unless you configure it.
The fix is not to disable versioning (it is valuable for recovery) but to pair it with a lifecycle configuration that expires noncurrent versions after a retention window and transitions older versions to cheaper storage classes. c3x reads versioning and lifecycle settings together so it can flag a bucket where versioning is on but no expiry rule exists, which is where noncurrent-version storage quietly grows.
Terraform example
A minimal but realistic configuration that C3X can estimate.
resource "aws_s3_bucket_versioning" "data" {
bucket = aws_s3_bucket.data.id
versioning_configuration {
status = "Enabled"
}
}
# Pair with lifecycle rules that expire old versions
resource "aws_s3_bucket_lifecycle_configuration" "data" {
bucket = aws_s3_bucket.data.id
rule {
id = "expire-noncurrent"
status = "Enabled"
noncurrent_version_expiration {
noncurrent_days = 30
}
}
}Pricing dimensions
What you actually pay for when you provision aws_s3_bucket_versioning.
| Dimension | Unit | What's being charged |
|---|---|---|
| Enabling versioning | free | Turning versioning on for a bucket has no charge. $0 |
| Noncurrent version storage | per GB-month | Every retained old version is billed as stored data at its storage class rate. S3 Standard: $0.023/GB-month per version |
| Requests on versions | per 1,000 requests | PUT, COPY, and lifecycle transitions on versions incur normal S3 request charges. PUT: $0.005/1,000 |
Optimization tips
Common ways to reduce aws_s3_bucket_versioning cost without changing the workload.
Always pair versioning with an expiry rule
Often the largest single S3 saving on write-heavy bucketsAdd a lifecycle rule with noncurrent_version_expiration so old versions are deleted after a retention window instead of accumulating forever at full storage price.
Transition old versions to cheaper classes
Up to 90% on retained old versionsMove noncurrent versions to Standard-IA or Glacier before expiring them, so the versions you must retain cost a fraction of Standard.
Audit noncurrent storage with metrics
Use S3 Storage Lens or a bucket metrics filter to see how much of your bill is noncurrent versions. It is often far more than the current object size suggests.
FAQ
Does S3 versioning cost money?
Enabling versioning is free. The cost is indirect: every old version is retained as a separate billed object at the full per GB-month storage rate, so storage grows with every overwrite until a lifecycle rule removes old versions.
Why did my S3 bill grow after enabling versioning?
Because overwrites and deletes now keep the previous version instead of freeing space. Without a noncurrent-version expiration rule, those versions accumulate and are billed indefinitely at full storage rates.
Does deleting an object with versioning on reduce storage cost?
No. A delete adds a delete marker but keeps every prior version stored and billed. You must expire or permanently delete the noncurrent versions with a lifecycle rule to actually free space.
Related resources
Estimate this resource in your own Terraform
Free, open source, no API key. C3X parses your Terraform and shows line-item cost for every resource, including aws_s3_bucket_versioning.