Sub topic 11
Managing cross-region traffic and replication
This chapter assumes you know how to read usage types in Cost Explorer (covered earlier) and that you have worked with S3 buckets, EC2, and IAM roles.
How cross-region transfer is billed
AWS charges for data leaving a region toward another region. Data entering a region is not charged. The rate depends on the source and destination regions. It is often around $0.02 per GB between US regions, and higher for some others, so check the pricing page for your pair.
In Cost Explorer, group by usage type. Inter-region charges show up as names like USE1-USW2-AWS-Out-Bytes. The prefix pair tells you the source and destination regions.
Common sources of cross-region traffic
- S3 Cross-Region Replication (CRR). You pay inter-region transfer, replica storage, and PUT requests in the destination. Replication Time Control adds a per-GB fee.
- Database replicas. RDS cross-region read replicas and DynamoDB global tables send every write to each other region.
- Application calls. A service in one region calling an API or database in another pays on every response.
- Container images and backups. ECR replication and cross-region snapshot copies move large objects.
Reduce the traffic
- Co-locate chatty components. Put the application, its database, and its cache in the same region. Cross-region calls should be rare and coarse-grained.
- Replicate only what you need. Use replication filters instead of copying whole buckets.
- Shrink data before it moves. Compress objects and drop unneeded fields before replication.
- Expire early. Lifecycle rules stop you from replicating, and storing, data nobody reads.
- Serve readers from a cache. For read-heavy content, CloudFront can replace a second regional copy.
- Question each replica. Replicas for disaster recovery are justified. Replicas for "maybe lower latency" often cost more than they save.
Example: replicate one prefix only
This replication rule copies only objects under critical/. Both buckets must have versioning enabled, and the role must allow S3 to replicate.
{
"Role": "arn:aws:iam::111122223333:role/s3-replication-role",
"Rules": [
{
"ID": "critical-only",
"Status": "Enabled",
"Priority": 1,
"Filter": { "Prefix": "critical/" },
"DeleteMarkerReplication": { "Status": "Disabled" },
"Destination": {
"Bucket": "arn:aws:s3:::example-dr-bucket-usw2",
"StorageClass": "STANDARD_IA"
}
}
]
}Save it as replication.json and apply it:
aws s3api put-bucket-replication \
--bucket example-source-bucket-use1 \
--replication-configuration file://replication.jsonThe STANDARD_IA storage class lowers the replica's storage cost. It does not lower the transfer charge, which is based on bytes moved.
Gotchas
- Replication applies to new objects only. Existing objects need S3 Batch Replication, which also incurs transfer charges.
- Replication to multiple destinations multiplies the transfer charge.
- Failover tests that run real traffic through the secondary region can produce a surprise bill. Schedule and measure them.
Estimating before you commit
Multiply the daily change volume by the per-GB rate and the number of destinations. For example, 500 GB of new data per day replicated to two regions at $0.02 per GB is 500 × 2 × 0.02 = $20 per day, about $600 per month, before storage and request fees.
Exercise
A bucket in us-east-1 receives 200 GB of new objects per day. Only objects under the logs/ prefix (about 20 GB per day) need a copy in eu-west-1. The transfer rate is $0.02 per GB. How much per month (30 days) in transfer does a prefix-filtered rule save compared with replicating the whole bucket?
Show answer
Whole bucket: 200 × 0.02 × 30 = $120 per month. Filtered: 20 × 0.02 × 30 = $12 per month. The filter saves $108 per month in transfer. Storage and request savings come on top.