0Pricing
AWS Solutions Architect · Lesson

S3 and Data Transfer Cost Optimisation

Apply S3 Intelligent-Tiering, lifecycle rules, S3 Select, and CloudFront to reduce storage and data-transfer costs significantly.

S3 and Data Transfer Cost Optimisation is a free AWS Solutions Architect lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the AWS Solutions Architect learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

S3 Storage Cost Fundamentals

Amazon S3 storage costs vary significantly by storage class and access pattern. S3 Standard charges approximately $0.023 per GB per month — at petabyte scale, this becomes significant. The good news is that S3 offers seven storage classes optimised for different access frequencies, with prices ranging from $0.023/GB (Standard) to $0.00099/GB (Glacier Deep Archive). The key to S3 cost optimisation is matching your data to the right storage class and automating transitions with lifecycle policies.

# S3 storage class costs (us-east-1 approximate):
# S3 Standard:              $0.023/GB/month
# S3 Intelligent-Tiering:   $0.023/GB (frequent) + $0.0125 (infrequent)
# S3 Standard-IA:           $0.0125/GB/month + retrieval fee
# S3 One Zone-IA:           $0.01/GB/month (single AZ)
# S3 Glacier Instant:       $0.004/GB/month + retrieval fee
# S3 Glacier Flexible:      $0.0036/GB/month + retrieval time
# S3 Glacier Deep Archive:  $0.00099/GB/month + retrieval time

S3 Intelligent-Tiering

S3 Intelligent-Tiering automatically moves objects between access tiers based on actual access patterns — no retrieval fees, no minimum duration for the frequent tier. It monitors object access at the object level: objects not accessed for 30 days move to the infrequent tier (40% cheaper), and after 90 days to the archive instant tier (68% cheaper). There is a small monthly monitoring fee ($0.0025 per 1,000 objects). Use Intelligent-Tiering when you cannot predict access patterns or when you have mixed hot and cold data in the same bucket.

# Enable Intelligent-Tiering on objects
aws s3api put-object \
  --bucket my-bucket \
  --key data/report.parquet \
  --body report.parquet \
  --storage-class INTELLIGENT_TIERING

# Or set as default for entire bucket
aws s3api put-bucket-intelligent-tiering-configuration \
  --bucket my-bucket \
  --id whole-bucket-tiering \
  --intelligent-tiering-configuration '{
    "Id": "whole-bucket-tiering",
    "Status": "Enabled",
    "Tierings": [
      {"AccessTier": "ARCHIVE_ACCESS", "Days": 90},
      {"AccessTier": "DEEP_ARCHIVE_ACCESS", "Days": 180}
    ]
  }'

S3 Lifecycle Rules for Automatic Tiering

S3 Lifecycle rules automate object transitions and expirations based on age. You define rules by prefix or tag, then specify transitions at specific day thresholds. A typical archival lifecycle: Standard → Standard-IA (30 days) → Glacier Instant Retrieval (90 days) → Deep Archive (365 days) → Delete (2555 days). This can reduce per-GB storage costs from $0.023 to $0.00099 over time — a 95% reduction for archival data. Lifecycle transitions have a minimum object size of 128KB for IA and Glacier (smaller objects are not cost-effective to transition).

# Lifecycle rule: transition logs to archive
aws s3api put-bucket-lifecycle-configuration \
  --bucket app-logs-bucket \
  --lifecycle-configuration '{
    "Rules": [{
      "ID": "log-archive",
      "Filter": {"Prefix": "logs/"},
      "Status": "Enabled",
      "Transitions": [
        {"Days": 30,  "StorageClass": "STANDARD_IA"},
        {"Days": 90,  "StorageClass": "GLACIER_IR"},
        {"Days": 365, "StorageClass": "DEEP_ARCHIVE"}
      ],
      "Expiration": {"Days": 2555}
    }]
  }'

S3 Select and Glacier Select

S3 Select allows you to retrieve only the data you need from an S3 object using SQL expressions, rather than downloading the entire object. For a 10 GB CSV file where you only need 100 rows, S3 Select can retrieve just those rows — reducing data transfer costs and application processing time dramatically. Glacier Select does the same for objects in Glacier. S3 Select supports CSV, JSON, and Parquet formats. This is especially valuable in data analytics pipelines where many queries only access a subset of each data file.

# S3 Select: query a CSV object using SQL expression
aws s3api select-object-content \
  --bucket analytics-data \
  --key sales/2026-06.csv \
  --expression-type SQL \
  --expression "SELECT * FROM S3Object WHERE region = 'us-east'" \
  --input-serialization 'CSV={FileHeaderInfo=USE}' \
  --output-serialization 'CSV={}' \
  output.csv

# Only the matching rows are returned
# Saves data transfer cost vs downloading entire file

S3 Multipart Upload and Transfer Acceleration

For large object uploads, S3 Multipart Upload splits objects into parts (minimum 5 MB per part) that upload in parallel, improving throughput and allowing resumable uploads. Failed parts can be retried without restarting the entire upload. Clean up incomplete multipart uploads with lifecycle rules to avoid being charged for incomplete parts. S3 Transfer Acceleration routes uploads through AWS CloudFront edge locations for faster uploads from distant locations — useful for users uploading large files globally, but adds cost ($0.04-$0.08/GB extra). Use only when acceleration provides measurable improvement.

# Multipart upload example
aws s3api create-multipart-upload \
  --bucket my-bucket --key large-file.zip

# Abort incomplete multipart uploads via lifecycle
aws s3api put-bucket-lifecycle-configuration \
  --bucket my-bucket \
  --lifecycle-configuration '{
    "Rules": [{
      "ID": "cleanup-incomplete-uploads",
      "Status": "Enabled",
      "AbortIncompleteMultipartUpload": {"DaysAfterInitiation": 7}
    }]
  }'

Understanding Data Transfer Costs

Data transfer costs are one of the most surprising AWS bills. Key rules: Inbound data transfer (into AWS) is free. Outbound data transfer to the internet costs approximately $0.09/GB (first 10 TB/month). Cross-region data transfer costs approximately $0.02/GB. Cross-AZ data transfer within the same region costs $0.01/GB each way. Within the same AZ is free. Design architectures to minimise cross-region and internet-bound data transfer — this is why regional deployments and CloudFront are critical for cost-efficient content delivery.

# Data transfer cost examples (us-east-1):
# Internet (outbound):       $0.09/GB (first 10 TB)
# CloudFront -> internet:    $0.0085/GB (much cheaper!)
# Cross-region:              $0.02/GB
# Cross-AZ (same region):    $0.01/GB each direction
# Same AZ:                   $0.00/GB (free)
# S3 -> CloudFront:          $0.00/GB (free!)

# Cost reduction tip:
# S3 -> CloudFront -> users
# vs
# EC2 -> internet -> users
# CloudFront is 10x cheaper for data egress

CloudFront for Data Transfer Cost Reduction

Delivering content through Amazon CloudFront dramatically reduces data transfer costs in two ways. First, CloudFront charges lower egress rates than EC2 or S3 direct internet access (~$0.0085/GB vs $0.09/GB). Second, CloudFront caches content at edge locations, reducing the number of times data is served from your origin — potentially serving the same content millions of times from cache with only one origin fetch. S3 to CloudFront data transfer is also free. This makes CloudFront a cost optimisation tool, not just a performance tool.

# Cost comparison for 100 TB/month of outbound traffic:
# Direct from EC2/S3 to internet:
#   100,000 GB x $0.09/GB = $9,000/month

# Via CloudFront (assuming 80% cache hit rate):
#   20,000 GB origin pull: free (S3->CF) or $0.02 (EC2->CF)
#   100,000 GB CF->internet: 100,000 x $0.0085 = $850
#   Total: ~$1,250 vs $9,000 = 86% savings

# Create CloudFront distribution with S3 origin
aws cloudfront create-distribution \
  --distribution-config file://cf-config.json

VPC Endpoints to Avoid NAT Gateway Costs

NAT Gateway data processing charges ($0.045/GB) can become a significant cost when EC2 instances in private subnets frequently access S3 or DynamoDB. Instead, use VPC Gateway Endpoints for S3 and DynamoDB — they route traffic through the AWS network backbone at zero cost and do not require a NAT Gateway for these services. Additionally, VPC Interface Endpoints (PrivateLink) for other AWS services eliminate NAT Gateway processing fees for that service traffic, though Interface Endpoints themselves have a small hourly cost.

# Create VPC Gateway Endpoint for S3 (free!)
aws ec2 create-vpc-endpoint \
  --vpc-id vpc-12345 \
  --service-name com.amazonaws.us-east-1.s3 \
  --vpc-endpoint-type Gateway \
  --route-table-ids rtb-private-AZ1 rtb-private-AZ2

# Traffic from EC2 in private subnet to S3:
# WITHOUT endpoint: EC2 -> NAT GW ($0.045/GB) -> S3
# WITH endpoint:    EC2 -> S3 via VPC endpoint ($0.00/GB)

# For DynamoDB:
aws ec2 create-vpc-endpoint \
  --service-name com.amazonaws.us-east-1.dynamodb \
  --vpc-endpoint-type Gateway

Optimising S3 Request Costs

S3 charges per API request as well as per GB stored. PUT, COPY, POST, LIST requests cost $0.005 per 1,000; GET, SELECT requests cost $0.0004 per 1,000. For applications that make millions of requests, these costs add up. Optimise by: batching small objects into larger ones (fewer requests), using CloudFront to serve cached responses (reduces GET requests to origin), avoiding list operations where possible (LIST is expensive), and using S3 Batch Operations for bulk operations instead of millions of individual API calls.

# S3 Batch Operations: process millions of objects at once
aws s3control create-job \
  --account-id 123456789012 \
  --manifest '{
    "Spec":{"Format":"S3BatchOperations_CSV_20180820","Fields":["Bucket","Key"]},
    "Location":{"ObjectArn":"arn:aws:s3:::manifest-bucket/manifest.csv","ETag":"abc123"}
  }' \
  --operation '{
    "S3CopyObject": {
      "TargetResource": "arn:aws:s3:::destination-bucket",
      "StorageClass": "GLACIER"
    }
  }' \
  --report '{"Bucket":"arn:aws:s3:::report-bucket","Enabled":true}'

AWS DataSync for Data Transfer

For large-scale data transfers between on-premises and AWS, or between AWS services, AWS DataSync is more cost-effective than writing custom transfer code. DataSync uses a purpose-built protocol that achieves up to 10x the throughput of open-source tools and includes built-in data validation, scheduling, and monitoring. Data transferred via DataSync to S3, EFS, or FSx is charged at standard AWS data transfer rates — but DataSync's efficiency means you complete transfers faster, reducing the EC2 compute time (and cost) needed for large migrations.

# Create DataSync task to copy S3 bucket to another region
aws datasync create-task \
  --source-location-arn arn:aws:datasync:us-east-1:123:location/loc-source \
  --destination-location-arn arn:aws:datasync:us-west-2:123:location/loc-dest \
  --name 'DR-replication' \
  --options '{
    "VerifyMode": "ONLY_FILES_TRANSFERRED",
    "OverwriteMode": "ALWAYS",
    "TransferMode": "CHANGED"
  }'

# DataSync pricing: $0.0125/GB transferred

Storage Lens for S3 Visibility

Amazon S3 Storage Lens provides organisation-wide visibility into S3 storage usage and activity metrics across accounts and regions. It surfaces cost optimisation opportunities like identifying buckets with no lifecycle rules, buckets with incomplete multipart uploads, or storage class distribution. S3 Storage Lens default dashboard is free; the advanced metrics dashboard ($0.20/million objects) adds per-prefix drill-down and data age metrics. Use Storage Lens as your starting point for any S3 cost optimisation exercise to identify the highest-impact buckets.

# Enable S3 Storage Lens dashboard
aws s3control put-storage-lens-configuration \
  --account-id 123456789012 \
  --config-id default \
  --storage-lens-configuration '{
    "Id": "default",
    "IsEnabled": true,
    "DataExport": {
      "S3BucketDestination": {
        "AccountId": "123456789012",
        "Arn": "arn:aws:s3:::my-storage-lens-export",
        "Format": "CSV",
        "OutputSchemaVersion": "V_1"
      }
    }
  }'

Quick Check

Test your understanding of AWS Solutions Architect (SAA-C03) concepts from this lesson.

Lesson Recap

In this lesson you learned: S3 Intelligent-Tiering and lifecycle rules reduce storage costs by moving data to cheaper storage classes automatically, CloudFront dramatically reduces data transfer costs compared to serving directly from S3 or EC2, and VPC Gateway Endpoints eliminate NAT Gateway charges for S3 and DynamoDB traffic. S3 Storage Lens provides visibility into optimisation opportunities. Next up we explore KMS, ACM, and encryption patterns.

Frequently asked questions

Is the “S3 and Data Transfer Cost Optimisation” lesson free?

Yes — the full text of “S3 and Data Transfer Cost Optimisation” is free to read here on the web, and the AWS Solutions Architect course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the AWS Solutions Architect course, upgrade to CoddyKit PRO.

What will I learn in “S3 and Data Transfer Cost Optimisation”?

Apply S3 Intelligent-Tiering, lifecycle rules, S3 Select, and CloudFront to reduce storage and data-transfer costs significantly. You practise AWS Solutions Architect with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start AWS Solutions Architect?

No prior experience is required. AWS Solutions Architect on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “S3 and Data Transfer Cost Optimisation” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this AWS Solutions Architect lesson?

Yes. Every AWS Solutions Architect lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Right-Sizing and Compute Optimizer
  2. Reserved Instances, Savings Plans, and Spot
  3. Cost Explorer, Budgets, and Cost Allocation Tags
  4. S3 and Data Transfer Cost Optimisation
← Back to AWS Solutions Architect