AWS云服务费用中,数据传输费用很难预估。为了帮助您了解AWS的数据传输成本,这里详细介绍了数据传输费用是如何构成的,以及如何减少数据传输费用的一些建议,以及如何分析数据传输成本。
尽可能使用价格便宜的区域
某些区域的AWS数据传输成本比其他区域低。美国和加拿大地区通常是最便宜的,而新加坡、印度和南美是最贵的。如果没有必要的商业理由要放在相对贵一些的区域,请选择成本效益更高的北美地区。
限制出站流量
减少AWS数据传输成本的最简单方法是减少发送出站数据。从AWS数据传输定价图表可以看出,入站数据是免费的,而出站数据是按照阶梯比例收费的。
使用CloudFront
CloudFront是专门为减少EC2到互联网传输费用而设计的,比如托管一个向公众提供内容的网站可能产生的费用。CloudFront数据传输在某些区域相比互联网数据传输费用更便宜一些。
保持数据传输在单区域
在AWS服务(如EC2和S3)之间传输数据时,构建应用程序以确保这些传输发生在单个AWS区域内。此外,要确保通过私有IP传输数据,而不是公共的或弹性的IPv4/IPv6地址。对于从公有或弹性地址"传入"和"传出"的数据,每个方向均按 0.01 USD/GB 的标准收费。
保持EC2数据传输在一个可用区内
在传输数据时,特别是在EC2实例之间以及RDS、Redshift和其他服务实例之间传输数据时,尽量将数据传输保持在相同的可用区内通过私有IP传输,否则每个方向将收取 0.01 USD/GB 的费用。
使用VPC Endpoint
S3 VPC Endpoint是一个很好的节约成本的方案,但大多数人都没有使用。在VPC中放置一个S3 Endpoint可以让流量走S3的内部路径,资费对比如下:
如何发现优化项
降低AWS成本的第一步是了解您的应用在哪些地方收取的使用费最高。AWS提供了成本分配标签功能,可以与AWS成本管理器一起使用,分析哪些实例/服务的数据传输费用来自何处。通过将这些标签应用到实例上,您可以定位到产生最高AWS数据传输成本的实例,并进一步按类型过滤流量费用:CloudFront (out)、Inter AZ、Internet (in)、Internet (out)、区域到区域 (in) 和区域到区域 (out)。
如需进一步协助或服务,请留言,泰岳云业务会提供成本分析工具及专业服务。
返回技术博客
Data transfer costs in AWS can be difficult to predict. This article explains how AWS data transfer charges are structured, offers tips for reducing them, and shows how to analyze your transfer costs.
Use Lower-Cost Regions When Possible
Data transfer costs vary significantly by region. The US and Canada are generally the cheapest, while Singapore, India, and South America are among the most expensive. Unless there is a specific business reason to use a more expensive region, consider using a cost-effective North American region.
Limit Outbound Traffic
The simplest way to reduce AWS data transfer costs is to send less outbound data. As shown in the AWS data transfer pricing chart, inbound data is free, while outbound data is charged on a tiered basis.
Use CloudFront
CloudFront is specifically designed to reduce the cost of transferring data from EC2 to the internet — for example, hosting a website that serves content to the public. CloudFront data transfer rates are cheaper than standard internet transfer rates in many regions.
Keep Data Transfers Within a Single Region
When transferring data between AWS services (such as EC2 and S3), design your application to ensure transfers happen within a single AWS region. Also, use private IP addresses rather than public or Elastic IPv4/IPv6 addresses. Data transferred "in" and "out" via public or Elastic addresses is charged at $0.01/GB per direction.
Keep EC2 Data Transfers Within a Single Availability Zone
When transferring data between EC2 instances, or between EC2 and services like RDS or Redshift, keep transfers within the same Availability Zone using private IPs. Cross-AZ transfers are charged at $0.01/GB per direction.
Use VPC Endpoints
S3 VPC Endpoints are a great cost-saving option that most users overlook. Placing an S3 endpoint in your VPC routes traffic to S3 via an internal path, avoiding data transfer charges. The cost comparison is shown below:
How to Identify Optimization Opportunities
The first step to reducing AWS costs is understanding where your highest charges come from. AWS provides cost allocation tags that work with AWS Cost Explorer to analyze which instances and services are generating the most data transfer costs. By applying these tags to your instances, you can pinpoint the highest-cost sources and filter by transfer type: CloudFront (out), Inter-AZ, Internet (in), Internet (out), Region-to-Region (in), and Region-to-Region (out).
For further assistance, feel free to reach out — UltraPower Cloud provides cost analysis tools and professional services.
Back to Tech Blog