aws_s3_bucket_logging cost estimation
Enabling S3 server access logging is free, but it writes a stream of log objects into a target bucket that you pay to store and, eventually, to query or delete.
An aws_s3_bucket_logging turns on S3 server access logging for a source bucket and points it at a target bucket. Enabling the feature is free: S3 does not charge for delivering access logs. The catch is what it produces. Access logs are written as many small objects into the target bucket, and those objects are real S3 storage billed per GB-month, plus the PUT requests S3 makes to deliver them.
On a busy bucket, access logging can generate a large volume of log objects fast, and left unmanaged the target bucket grows indefinitely at the standard storage rate. The delivered log objects also accumulate PUT request charges, and if you later query them with Athena or copy them out, you pay for those requests and any egress. The logging itself is cheap; the accumulation is what costs, exactly like any other data you keep in S3.
The optimization is lifecycle management on the target bucket: transition old logs to Standard-IA or Glacier and expire them after your retention window so you stop paying storage. Keeping logs in a dedicated bucket with a tight lifecycle policy is the standard pattern. c3x prices the log target bucket's stored bytes and requests like any S3 data, and treats enabling logging as the free configuration it is.
Terraform example
A minimal but realistic configuration that C3X can estimate.
resource "aws_s3_bucket_logging" "assets" {
bucket = aws_s3_bucket.assets.id
target_bucket = aws_s3_bucket.logs.id
target_prefix = "s3-access/assets/"
}
resource "aws_s3_bucket_lifecycle_configuration" "logs" {
bucket = aws_s3_bucket.logs.id
rule {
id = "expire-access-logs"
status = "Enabled"
expiration { days = 90 }
}
}Pricing dimensions
What you actually pay for when you provision aws_s3_bucket_logging.
| Dimension | Unit | What's being charged |
|---|---|---|
| Logging configuration | free | Enabling server access logging and delivering the logs has no charge from S3. $0 |
| Log object storage | per GB-month | The access-log objects delivered into the target bucket are billed like any stored S3 data. S3 Standard: $0.023/GB-month |
| Log delivery requests | per 1,000 requests | S3 writes access logs as many small objects, each a billable PUT into the target bucket. PUT: $0.005/1,000 |
Optimization tips
Common ways to reduce aws_s3_bucket_logging cost without changing the workload.
Expire logs with a lifecycle rule
Caps log storage at your retention windowAccess logs accumulate indefinitely at the standard storage rate. A lifecycle rule that expires them after your retention window stops the target bucket from growing without bound.
Transition older logs to a cheaper class
Up to 95% for archived logsLogs you keep for compliance but rarely read cost far less on Standard-IA or Glacier. Transition them after a few weeks to cut GB-month cost.
Consider CloudWatch or CloudTrail instead
If you only need request auditing, S3 access logs can produce huge object counts. Evaluate whether CloudTrail data events or CloudWatch metrics meet the need with less storage churn.
FAQ
Does S3 bucket logging cost money?
Enabling access logging is free, but the log objects it delivers into the target bucket are billed as normal S3 storage per GB-month, plus PUT request charges. On a busy bucket that adds up if you never expire the logs.
Where does the cost of S3 access logging come from?
From the target bucket. S3 writes access logs as many small objects, and you pay to store them per GB-month and for the PUTs that deliver them. Delivery is free; keeping the logs is what costs.
How do I keep S3 logging cheap?
Put a lifecycle rule on the log target bucket to expire logs after your retention window and transition older ones to Standard-IA or Glacier, so log storage does not grow forever at the standard rate.
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_logging.