How to reduce Data Transfer costs with EC2 and S3

0

Greetings! We are new to AWS and are trying to reduce server cost. We operate a website that provides streaming video content to Users with paid memberships. Our Data Transfer Out Bandwidth charges have been very high compared to our last web host. We are wondering if we have selected the best AWS products for providing video streaming to our Users. Last month's costs were as follows: Data Transfer Out Bandwidth $805.55, EC2 Large Instance $110.71, S3 $15.86. Thank you in advance for your help! Patrick

7 Answers
1
Accepted Answer

I understand from above comment 80% of cost coming from S3 transfer towards internet. So definitely https://aws.amazon.com/blogs/networking-and-content-delivery/cost-optimizing-your-aws-architectures-by-utilizing-amazon-cloudfront-features/#:~:text=Use%20CloudFront%20for%20everything%20–%20including%20dynamic%20content&text=This%20approach%20lets%20you%20utilize,Transfer%20Out%20(DTO)%20costs will going to help you.

In addition to that, I would suggest to used S3 Storage lens for detail analysis around object, which type of objects are getting accessed mostly. Also this post https://aws.amazon.com/blogs/storage/analyzing-request-and-data-retrieval-charges-to-optimize-amazon-s3-cost/ can also guide around access patterns. May be according to that implement compression techniques.

One question, do you also processing content from S3 on EC2 and putting it back on S3 ? If that is case, in order to access content between S3 and EC2, you can use VPC endpoints so that traffic will stay within AWS.

Best Regards, Vikas

profile picture
Vikas
answered a year ago
1

Do you use CloudFront?
We thought that using CloudFront to deliver video content from edge locations would reduce costs to some extent.
https://aws.amazon.com/cloudfront/streaming/?nc1=h_ls

profile picture
EXPERT
answered a year ago
  • We are not using CloudFront but would be interested in using it, particularly with the prepay savings bundle. A question, what additional charges other than DT out to internet are associated with CloudFront? Particularly, what are the charges that apply to DT from CloudFront Edge to backend resource? What is an example of data being sent from CloudFront Edge to backend resource? I'm not sure if that would be applicable to anything we would be doing. Thanks so much! Patrick

  • Access to backend resources from edge locations occurs when access occurs to non-cached content. In addition, CloudFront fees are listed in this document, but in addition to data transfer, fees are also charged based on the number of HTTP requests. https://aws.amazon.com/cloudfront/pricing/?nc1=h_ls
    If data transfer volume is your bottleneck, implementing CloudFront could be an improvement. Also, as others have responded, purchasing Reserved Instances or Savings Plans will reduce the cost of EC2 instances below the on-demand rate. However, the amount of data transfer is the same whether it is a reserved instance or an on-demand instance.

1

Here is a diagram explaining various data transfer\processing charges. Do your EC2 instances have public or elastic IPs or are they in a private subnet communicating with Internet over a NAT Gateway or a load balancer? I would suggest to use Cost Explorer to get more information on your EC2 data transfer charge and NAT Gateway (if any). You can do this by selecting "C2: Data Transfer - Internet (Out)" and "EC2: NAT Gateway - Data Processed" to the filter named "Usage type group" on the right pane. Select "Usage type" as the Dimension under "Group by". It should give you more detail on the actual GBs that are transferred. Take a look at at the pricing for CloudFront, especially Example 3 at the bottom for Media streaming application: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CloudFrontPricing.html.

profile pictureAWS
EXPERT
answered a year ago
  • Thank you so much for your reply? My EC2 Data Transfer internet Out cost shows as relatively little for the month ($9). But S3 Data Transfer internet out shows $796. I will look at the link you sent now, especially for streaming. Cheers! Patrick

1

Hi!

It depends upon your architecture for application, here are few factors you may consider:

  • use reserved ec2 instance
  • review ec2 instance type needed for application
  • you may consider cloudfront for cdn or any other 3rd party cdn with cheaper pricing.
  • lifecycle rules for s3 bucket
  • use lambda for small task, reduce instance type according to your workload
  • use AWS Trust Advisor for cost optimization
  • use 3rd party apps instead of cloudwatch or cloudtrail, like datagod etc.
  • create another vpc for another region, share data with s3 gateway endpoint. Not sure pricing about this 1, suggested based on data transfer inside aws way cheaper than internet transfer.

there is one more point, I didn't tried this 1 yet. So we can create another ec2 with same configuration, but less traffic forwarded to it. most organization use it as backup server with small ec2 instance type in another region which have highest RTO. You may use this 1, for 20% or any traffic forwarding to this instance, fronted by cloudfront. us-est-1 provides cheapest ec2. Do not how much price it may reduce.

There may be more factors which i have missed.

Hope this helps,

profile picture
answered a year ago
profile picture
EXPERT
reviewed a year ago
  • Thank you so much for your answer! 80% of our monthly AWS bill is coming from Data Transfer out to internet from S3 bucket. Just curious, would AWS Trusted Advisor assist with actually configuring my account or will I need to implement their suggestions on my own? Thanks again

1

Your Application is doing Video Broadcast to your subscription users. I have a few questions that would help me give you the correct answers to optimize your workflow. Your video application is Live Video Streaming or File Video Streaming (Video On Demand)? Are you using your S3 bucket for the origination of the said video correct? Do you have any geo-restrictions in place for the users you currently serve and what regions are you serving?

AWS
Nuno_Q
answered a year ago
  • Hi Nuno, thank you for your reply! We offer video on demand, not live video streaming. Yes, we are using S3 as file origin. No, not using any geo restrictions. Thanks!

1

Sorry, I forgot to provide the diagram mentioned previously. Here it is https://github.com/open-guides/og-aws/issues/715. Yeah, that makes sense since the media is likely stored in S3 buckets. CloudFront can be used to optimize S3 data transfer cost as well. please refer to this blog post: https://aws.amazon.com/blogs/networking-and-content-delivery/cost-optimizing-your-aws-architectures-by-utilizing-amazon-cloudfront-features/#:~:text=Use%20CloudFront%20for%20everything%20%E2%80%93%20including%20dynamic%20content&text=This%20approach%20lets%20you%20utilize,Transfer%20Out%20(DTO)%20costs.

profile pictureAWS
EXPERT
answered a year ago
1

Have you looked at the following AWS VOD Solution https://aws.amazon.com/solutions/implementations/video-on-demand-on-aws/ that leverages AWS Elemental MediaConvert and CloudFront for the encoding and distribution of encoded files (VoD). AWS Elemental MediaConvert is a file-based video transcoding service with broadcast-grade features. Create live stream content for broadcast and multi-screen delivery at scale. https://aws.amazon.com/mediaconvert/ The price of MediaConvert is based on On-Demand down to the second of the file duration and is the following: https://aws.amazon.com/mediaconvert/pricing/ MediaConvert also will allow you to encode your video files with QVBR Rate control to reduce the amount of storage needed on S3 and the amount of bandwidth used when streaming the files thru CloudFront.

On CloudFront you can cache your files at the edge reducing this way requests back to the origin (in this case Amazon S3).

You can also secure your application at the edge with Amazon CloudFront: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html

Restricting access to the Origin only thru CloudFront: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html

Finally protect your backend application resources by using AWS WAF: https://docs.aws.amazon.com/waf/latest/developerguide/how-aws-waf-works-resources.html

AWS
Nuno_Q
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions