简体   繁体   中英

Reduce data transfer cost in aws

I have aws setup for my website, What I am doing is when a user uploads an image , we are saving it to a folder on ec2 and then transferring it to s3, post which we are fetching images from s3.

I have also stored all the js and css on ec2 and fetching all from ec2 itself.

My data transfer cost is very high now, Please suggest if storing images on ec2 is costing me more ? should I directly store it on s3?

Always think of using CDN or dedicated web hosting services if your web traffics is high. EC2 are only recommended for back-office processing usage than serving web page. There is no free lunch in AWS if you are not careful. You must always check AWS bandwidth pricing before you want to host anything inside AWS. In certain extend, the data transfer costs can be many time more expensive than the EC2 server and (s3, EBS) storage.

AWS only give EC2 1 GB free data transfer to the Internet. After that, it is $0.09/GB. If you open your web server to everyone and 20 bots go download 100GB data daily from your EC2 web server, you will get a hefty bill, ie (100GB x $0.09 x 30days = $270 ) - $0.09 (Free 1GB) = $269.01

Also remember, S3 data transfer out to internet is NOT FREE. You only get free unlimited data transfer from S3 to your EC2/lambda within the same region. If you signed the S3 file as a URL to let people download the file, you get billed by "internet OUT" bandwidth charge.

Data Transfer charges only apply to data going from an AWS Region to the Internet. There is no charge for uploading to AWS, nor for moving data between S3 and EC2 in the same region.

If your data transfer costs are high, it suggests that you are serving a lot of traffic to the Internet, either from EC2 or S3.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM