Hello to the whole community.
Me and my team are having trouble serving videos through Cloudfront. We have a multi-tenant platform and have used the AWS platform for more than 10 years in which we have used S3 to store images, audio and PDF files.
For a couple of months we have a client who is also uploading videos on the platform, we are talking about extremely short videos (max 20s) and low weight (max 10mb) and since then those 13 videos (Literally 13 videos) have climbed up to be the most consulted files of our Cloudfront, reaching numbers that do not match our records. For example, in the client's tenant there are only about 2k users, and one of the videos has about 80k requests in just 24 hours, which would imply that each user has seen the video about 40 times, which doesn't make any sense and if there were If so, subsequent requests should use the browser's cache. Additionally, from what we can see from the "Top referrers" section in Cloudfront, the videos are being consulted from our domain associated with the Cloudfront distribution and it doesn't seem to have been embedded in a different domain like a social network or something similar.
This has become a huge problem as AWS costs have tripled and the cost of Cloudfront alone is more than the cost of our EC2 instances and our Aurora Multi-AZ database for only 13 videos.
These are the headers of one of the videos. We do not understand if it is a configuration problem in the cache or something like that.
Accept-Ranges: bytes
Age: 1120
Alt-Svc: h3=":443"; ma=86400
Cache-Control: max-age=31536000
Content-Length: 3726279
Content-Range: bytes 0-3726278/3726279
Content-Type: video/mp4
Date: Sun, 16 Jul 2023 17:05:37 GMT
Etag: "fc6252ed0e4a9cd9a973a879ee47ed48"
Last-Modified: Sun, 11 Jun 2023 09:56:19 GMT
Server: AmazonS3
Vary: Origin
Via: 1.1 eb2e4893b47f0d155cd51b82c2a8d596.cloudfront.net (CloudFront)
X-Amz-Cf-Id: I-lFrYHkkb_FAucgo0Ian18bbvgREE_mI56imPg7igZQuOEDOPDs6A==
X-Amz-Cf-Pop: JFK50-P5
X-Amz-Server-Side-Encryption: AES256
X-Cache: Hit from cloudfront
We will appreciate any advice
From what we can see, we have 63% usage at the desktop level and 34% mobile. 38% usage on Firefox, 24% on Chrome and 24% on Chrome Mobile. In operating systems 40% linux, 23% Windows, 30% android. In geographical terms, 83.68% of the requests come from Mexico, the location associated with that tenant, followed by the US and the rest of the countries does not exceed 1% of requests.