Cloud & MLOps ☁️
Cost Optimisation

Cost Optimisation

A sizable part of IT budgets is diverted to cloud providers, and understanding your cloud bill and budget on cloud providers like Amazon Web Services is becoming a prime concern. AWS cost optimization has become a discipline of its own with specialized tools, economic models and cost reduction best practices.

Data Transfer Pricing

Have you ever noticed how AWS data transfer costs suddenly start to crop up in your monthly cloud bill? There are different data transfer types you can perform within or out of AWS. Because of the sheer number of different transfer types available, and Amazon’s complex data transfer pricing, it can be challenging to keep track of all their associated costs. As a general guide, AWS charges users when moving data in either of two ways: between AWS and the Internet, and within the AWS cloud. Let’s take a look at both:

AWS Data Transfers Over the Internet

In from the Internet: The AWS cloud is not only the different worldwide regions and Availability Zones, but also Direct Connect links and AWS Edge Locations. Direct Connect links are dedicated private connections from on-premises sites to AWS. Edge Locations are data centers that are part of Amazon CloudFront, which delivers cached content of AWS services with reduced latency to users. Any data transfer coming from the Internet into AWS is free, whether it is into AWS Regions, into Direct Connect, or into Edge Locations.

Out to the Internet: Transfers that send data out over the internet are billed at region-specific and tiered data transfer rates. These rates take into account all the aggregate data transferred by all the following services: Amazon RDS, Amazon Redshift, Amazon SES, Amazon SimpleDB, Amazon EBS, Amazon S3, Amazon Glacier, Amazon SQS, AWS Storage Gateway, Amazon SNS, Amazon DynamoDB, and Amazon CloudWatch Logs. See the per-region chart with the tiered rates here.

Data Transfer Costs Within the AWS Cloud

Inter-Region data transfers: Inter-region data transfer fees are charged at the source region rates. For example, if you have a web content backup stored in Amazon S3 in the South America (Sao Paulo) Region and you need to pull that data from S3 into any other region, you will need to pay according to the Sao Paulo Region rate of $0.138 per GB. If you are expanding your services and now you have app users geographically located on the United States west coast, and you plan to move a copy of your data from the US East (Ohio) region to US West (Los Angeles), you would need to pay by the US East Region rate of $0.02 per GB transferred. You can find all the source-specific region rates here (opens in a new tab). No fees have to be paid for the incoming traffic at the destination region.

Data transfers between AWS Regions and Direct Connect locations: While there are no AWS data transfer costs into any of the AWS Regions—a situation which follows the general rule that transferring data into AWS from the internet is free—transferring data from an AWS Region to a Direct Connect location does have a charge.The rates for transferring data from an AWS Region into a Direct Connect location depend on the source Region and the destination Direct Connect location. For example, transferring data from the US East (Ohio) Region to a Direct Connection link in Montreal costs $0.0200 per GB. Transferring the same data from the EU (Frankfurt) region into the same Montreal Direct Connect link costs $0.0300 per GB. AWS has a complete chart with the rates for transferring from AWS Regions to Direct Connect locations here (opens in a new tab).

Data transfers between Edge locations and AWS Regions: Remember, Edge locations are data centers that are part of the Amazon CloudFront CDN (Content Delivery Network). Those locations cache data such as videos, APIs, or applications for low-latency access. Transfers from AWS regions into Edge locations are free.Transfers from Edge locations back to their origin are charged at region specific rates (opens in a new tab)

AWS Data transfer costs within the same region: Any time AWS resources or services communicate with each other within the same Region, there could be a potential fee attached to it. This is the type of AWS data transfer cost that can be a little trickier to keep track of and understand. Here are few basic guidelines on how intra-region transfer fees are applied:

  • Whenever you are transferring data between Amazon EC2, AWS containers, Amazon RDS, Amazon Redshift, Amazon DynamoDB Accelerator (DAX), Amazon ElastiCache instances, or Elastic Network Interfaces across Availability Zones or across VPC peering connections, whether this transfer is over public, private or Elastic IPv4 or IPv6 addresses, there is an egress fee of $0.01 per GB and an ingress fee of $0.01 per GB.
    • For example, you could be transferring 500 GB of data between a Redshift cluster in VPC-a and an EC2 instance in VPC-b, both in the same Availability Zone, and you would be charged $5 for egress from VPC-a and $5 for ingress into VPC-b. Using the same case example, only now both of them reside in the same VPC but in different Availability Zones, you would be charged the same.
  • Any data transfer between EC2 instances or containers or Elastic Network Interfaces in the same Availability Zone and in the same VPC, whether using Public or Elastic IPv4 addresses, comes with an egress charge of $0.01 per GB and an ingress charge of $0.01 per GB.
  • Any data transfer between EC2 instances or services, containers, or Elastic Network Interfaces in the same Availability Zone and same VPC using private IPv4 or IPv6 addresses is free.
  • Data transfers between AWS services which can't be confined to a particular Availability Zone or VPC (the clearest example being AWS S3) and EC2 instances or other AWS services within the same region are free. Amazon S3 is the main example but these other services follow the same rule including Amazon Glacier, Amazon DynamoDB, Amazon SES, Amazon SQS, Amazon Kinesis, Amazon ECR, Amazon SNS, and Amazon SimpleDB.

Some important exceptions for cross-AZ transfers:

  • Data transferred between Amazon Classic or Application Load Balancers and EC2 instances within the same region is free.
  • Some multi-AZ configurations for replication purposes are exempt from charges when replicating data across AZs. These include Amazon Aurora, Amazon Neptune, and Amazon RDS.

Tips to Reduce Data Transfer Costs

  • Control data volumes: Limit the size of data transfers by using storage efficiencies with a data management platform such as NetApp Cloud Volumes ONTAP, which we’ll cover in detail below.
  • Region exclusivity: If possible, keep all traffic within the same region. If traffic needs to exit a region check and choose the region with the lowest transfer rates that makes most sense for your business requirements.
  • AZ exclusivity: Remember all traffic within the same AZ and the same VPC, using AWS Private IPs, is free. So, try keeping your resources within the same AZ and the same VPC using private IPs as much as possible.
    • We have had issues of listening to Redis Elasticache from a different AZ continuously, even though it was in the same Region. Moving the subscribed micro-service into the same AZ as the Redis Elasticache instance saved a lot of money.
  • Avoid NAT devices: If you have EC2 instances inside a VPC that need to communicate out to the Internet or to other AWS public resources, try not using a dedicated NAT device as they charge a rate per GB that goes through it on top of the data transfer out rates that might apply. Assign those instances public IPs and use the VPC Internet Gateway NAT functionality instead. Or you can also use VPC endpoints.
  • Use Amazon CloudFront: If you need to deliver data out to Internet users, consider Amazon CloudFront. Data transferred out to the Internet up to 50TB is going to be less expensive from Amazon CloudFront than if transferred out from AWS regions and with less latency. If you have a public facing service that delivers rich content such as videos or audio files, this might be a good option.
  • Track specific services: Make sure to check the data transfer pricing for the following services as they have specific pricing rules: Amazon ElastiCache, Amazon Neptune, Amazon CloudSearch, Amazon ElasticSearch, Amazon MSK (Managed Kafka).

Resources: