Possibly the most fundamental principle of the AWS cloud is that you pay for what you consume. For many SMBs, data transfer costs are likely to account for a significant percentage of their consumption and hence their billing, so it pays to understand how they are calculated.
There are three situations in which AWS may charge for data transfer
Data transfer from AWS to the internet
Data transfer from your native AWS region to another AWS region
Data transfer from your native AWS Availability Zone to another AWS Availability Zone
The first two situations work essentially the same way. If you send data outside your default region then you pay AWS data transfer costs. In fact, under the current AWS pricing system, you pay AWS data transfer costs at the same rate regardless of whether you are sending your data to the internet or another AWS region.
There are very few AWS services that charge for data transfer between AWS AZs, but they currently include both EC2 and S3, which are two of AWS’s most popular services.
Having said that, some of these services allow free data transfer between AZs in the same AWS region if you use a private IP address.
For the sake of completeness, some AWS services include data transfer costs as part of the overall price of the service. The obvious example of this is AWS Kinesis.
Even though this means that, technically, there is no direct benefit to controlling your data traffic, there may still be an indirect benefit to doing so in the shape of improved performance.
It may also stand you in good stead in the future if changes its pricing system.
Data transfers to AWS Cloud Front are free
For the most part, keeping on top of AWS data transfer costs means designing efficient infrastructure. If, however, you’re using AWS essentially as a storage location for content you then push out to end-users, your simplest option may simply be to use CloudFront.
CloudFront is a fast content delivery network (CDN) service. It works by sending content out to “edge locations” (otherwise known as data centers) around the world, from where users can download it.
The basic idea behind CloudFront is that the content will be made available to end-users via the edge location which is nearest to them.
This makes for a smoother, more reliable (i.e. lower latency) experience, which is perfect for resource-intensive content such as streaming video. In fact, it’s what Amazon uses for its own streaming service.
From the perspective of data transfer pricing, however, the key point to note is that CloudFront neatly gets around the dilemma of how to choose the right region when you’re serving customers in multiple locations.
Without CloudFront, you have to choose between either basing your service in one region and accepting the data transfer charges between regions or basing your service in multiple regions and dealing with all the complexities and expenses this creates.
With CloudFront, by contrast, you just base your service in whatever region you think is right for you and leave CloudFront to take care of delivering your content where it needs to go. You then pay the data transfer costs which apply in the region where the customer is based.
AWS data transfer costs vary widely by region
In principle, you can do a lot to minimize your AWS data transfer costs, just by choosing your region astutely. In practice, data protection laws may limit your choice of region, and even if they do not, ensuring a high quality of service for your users/customers is likely to be a higher priority than paring costs to the bone.
That said, if you do have a choice of regions, then it is worth at least taking a look at the difference in pricing as these can be substantial.
The better you manage your architecture, the better you manage your data transfer costs
If CloudFront isn’t for you, or at least not as a complete solution, then basically your only option is to optimize your architecture.
In short, you want to minimize data transfers as far as possible, but since it’s effectively impossible to use without transferring data, you want to keep data transfers within the same Availability Zone if at all possible and if that is not possible then you want to keep them within the same region.
Do everything you can to minimize data transfers to different regions and also to the internet.
For completeness, you are on safe ground accepting data transfers from other regions and the internet as these are paid by the sender.
Learn to love your billing data
It may seem like stating the obvious, but your billing data shows you where your money is being spent and is, therefore, the easiest place to look if you want to see whether or not it’s being spent wisely.