Amazon CloudFront CDN download usage increasing (but not traffic nor requests) - amazon-cloudfront

I’m looking for some advice or opinion as I’m not an expert in how Amazon CloudFront works.
I run an origin pull CDN through Amazon CloudFront for a self-hosted WordPress installation. It has been running since August 2012. Works perfectly.
Up until January my bill with Amazon CloudFront was quite constant. I do not host videos (always embedded YouTube but even that is rare). The only “big” files I host on my blog and which are shared through Amazon CloudFront service are occasional 1 or 2MB PDFs.
Since February of March, I’ve seen a significant increase in my Download Usage Report: it went from 10GB/month in January to 47GB/month for April.
However:
1) The number of HTTP request remains about the same: 150,000/month
2) My traffic is constant, did not significantly increased or decreased. It’s also modest: about 10,000 unique visits/month.
I’m wondering what could explain this increase.
Thanks,
P.

It is hard to answer your question without additional information. For starter, I may suggest you to turn on logging for your CloudFront distribution in AWS Console. Please note that although there is no extra charge for enabling access logging, you accrue the usual Amazon S3 charges for storing and accessing the files on Amazon S3 (you can delete them at any time).
CloudFront log file format is described here.
If you really concerned with growing usage, the best way to get insight would be to open new case via AWS Support Center.

Related

Protecting the AWS S3 download links

I have been developing a website where people can buy digital products and then download them after the payment. I am using MERN stack and thinking of using AWS S3 for storing the digital products.
I am quite worried about implementing the security. I want to make sure that nobody can find an evil way to download files unless they purchased the product.
Not only about AWS S3 but anything you can suggest is appreciated.
I am not really an experienced guy on this industry since I am a mechanical engineer. So, I appreciate even a single bit of your suggestions.
You should use Amazon S3 pre-signed URLs.
It works like this:
All files in Amazon S3 remain private
Users interact with your website and purchase the software
Your website then generates a pre-signed URL, which is a time-limited link to a private object stored in Amazon S3
Users can click that link to download the file. After the expiry period (which you can set), the link will no longer work.
Yes, they could share that link with other people, but it would only work for the stated time period (eg 5 minutes).
The signed URL only takes a couple of lines of code to generate. It can be generated within your app, without having to make an API call to S3.

Extremely high latency on Azure Web App

We currently self-host our website, but we've had a few downtime incidents outside of our control and we're looking at moving it into Azure. It's an ASP.NET website using Umbraco as the CMS.
Yesterday I signed up for an Azure trial, migrated a copy of our database onto an Azure SQL Server instance, spun up a new Web App and used Web Deploy to upload the app. This was my first experience with Azure, and I was pleasantly surprised at how easy it was. There were a few issues working out how to hook up my new app to my new database but overall it was a simple process.
But the performance is awful. The database is a Standard S2 and I initially created the web app on the Free tier. I was experiencing both poor download speed and latency. The first thing I tried was bumping up the Web App's scale, so I took it to Standard Medium. This seems to have fixed the download speed, but the latency is still impressively bad.
I'm using Google Chrome's network panel to test the speed. Here's what I get downloading an image from our server:
Obviously this is going to be fast as it's going over our local network, but this does at least show that the application is not the issue.
Here's what I get with Standard S2 hosted on Australia East:
The speed once the download has started is not too bad, but having a 41.92s TTFB is insane! It's not consistent, sometimes I get as low as 8s, but that's still unacceptable.
I don't have this issue when visiting other sites, so my internet is not the issue. I've tried using Small S2 and Large S2 with no change in results.
Am I doing something wrong? I find it difficult to believe that every Azure customer experiences this level of performance.
EDIT: Here's what we've learned in the comments so far:
Setting Always On does not help.
Using the Azure CDN is just as slow.
I also had enormous performance problems within the Azure environment. The cause was the activation of Applications Insights. After I deactivated it, the response times were again in the millisecond range and no longer 2-3 seconds.
This was an issue with my own network's configuration. I'm not sure how to resolve it, but I can't reproduce this issue when using my phone's internet so it's clearly not an Azure problem.

I need to speed up my site and reduce the number of files calls

My webhost is aking me to speed up my site and reduce the number of files calls.
Ok let me explain a little, my website is use in 95% as a bridge between my database (in the same hosting) and my Android applications (I have around 30 that need information from my db), the information only goes one way (as now) the app calls a json string like this the one in the site:
http://www.guiasitio.com/mantenimiento/applinks/prlinks.php
and this webpage to show in a web view as welcome message:
http://www.guiasitio.com/movilapp/test.php
this page has some images and jquery so I think this are the ones having a lot of memory usage, they have told me to use some code to create a cache of those files in the person browser to save memory (that is a little Chinese to me since I don't understand it) can some one give me an idea and send me to a tutorial on how to get this done?. Can the webview in a Android app keep caches of this files?
All your help his highly appreciated. Thanks
Using a CDN or content delivery network would be an easy solution if it worked well for you. Essentially you are off-loading the work or storing and serving static files (mainly images and CSS files) to another server. In addition to reducing the load on your your current server, it will speed up your site because files will be served from a location closest to each site visitor.
There are many good CDN choices. Amazon CloudFront is one popular option, though in my optinion the prize for the easiest service to setup is CloudFlare ... they offer a free plan, simply fill in the details, change the DNS settings on your domain to point to CloudFlare and you will be up and running.
With some fine-tuning, you can expect to reduce the requests on your server by up to 80%
I use both Amazon and CloudFlare, with good results. I have found that the main thing to be cautious of is to carefully check all the scripts on your site and make sure they are working as expected. CloudFlare has a simple setting where you can specify the cache settings as well, so there's another detail on your list covered.
Good luck!

How much time CDN takes with new DNS

I'm using Amazom CloudFront as CDN and we may have to change between two systems according to situation.
Here's what I need to be prepared for -
How much time will CDN take to resolve the new address every time (new system, old system)? The same time it takes the domain to propagate?
What about the cache it collected before changing?
I'm reading this article http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/HowToUpdateDistribution.html
It would be much better if someone shared his/her experience.
When you setup a new container on any CDN you are using their domains which are already propagated across the world. If you plan to use your own domain instead of theirs for example cdn.yourdomain.com or static01.yourdomain.com etc then standard propagate time comes into play.
What your find with CDNs is once you upload your files to the server it takes some times to "Spread" replicate your files on all there networks so for example say their main server is in america those accessing the files from UK will download from America and not a local server until all files have been cloned across their network, it takes from a few mins to a few hours depending on how many files and the sizes, the good thing is everyone can use those files with no delay but for full speed advantage it takes a little time.
As far as Cache its pretty straight forward you set a TTL expire on the containers which means they get cached and so on. Personally I use a 72 hour TTL on mine and is favored by Google and other search engines.
Hope this helps.

How to securely serve S3 files to blog

I'm starting a blog and i'm in the process of choosing where should i host it. For now i want a free solution like Blogger or Wordpress.com.
The problem i'm facing is that i want to use files i have in a S3 bucket in my blog but none of the blog solutions i found supports any kind of server code, which means that in order to use S3 query string authentication i would have to put vulnerable information in the client. For obvious reasons i don't want to do that.
So, i'm looking for ideas on how i can safely include content from S3 in a free blog host.
Im not aware of any blog software that by default supports Amazon S3. So your best shot is to get a cheap hosting (hosting is really cheap these days, a few dollars a month). Then you can install a plugin which supports Amazon S3.
I think we might need a bit more detail here. For example, if you just want to link to files on S3 from your blog, you can make the files globally readable on S3 and then just link to them, with no authentication necessary.
If you want to do something more complex, maybe look into hosting WordPress yourself using WordPress.org, at which point you can use server-side code yourself, perhaps as a plugin. Or, maybe there's an existing plugin that works with WordPress that would suit you -- there's definitely a plug-in which copies WordPress file uploads to S3 and then serves them from there, rather than from your blog host, for example. It's not free a free solution, but hosting starts pretty cheap.
For fairly obvious reasons of security, there aren't any blog service providers I can think of who provide server-side code access.

Resources