BACKGROUND IMAGE: iSTOCK/GETTY IMAGES
IT teams sometimes expect a sudden surge in traffic, which understandably leads to questions about whether CloudFront can handle the influx.
Amazon CloudFront is AWS' content delivery network (CDN). It securely delivers data, applications and videos to global customers with low latency and high transfer speeds. It also offers support for static and dynamic content, along with network- and application-level protection. Advanced customers can use it to build a programmable CDN with Lambda@Edge, which can rewrite URLs and block all incoming traffic when a site is unavailable. On top of that, CloudFront's native integrations provide additional options and benefits.
CloudFront can handle the flood of traffic that will come when a blog post goes viral, but IT teams should follow these steps to ensure their environment doesn't get overwhelmed.
Traffic spikes with Amazon CloudFront
Admins can use CloudFront in multiple ways to prepare for and mitigate the impact of spikes. For starters, use S3 for static content. Data transfers between S3 and CloudFront are free, which reduces the overall cost when compared to EC2 web servers. S3 is also scalable and highly available, so it can handle large amounts of traffic without undue stress on the web servers.
IT teams should also reduce caching wherever possible. CloudFront itself caches on edge locations, so the application should be in good shape with default settings of high time to live and no forwarding for cookies, headers or query strings. However, admins should set up caching in front of their web servers -- Nginx or Squid, for example -- and databases. Read contention is often a choke point with databases, so consider Amazon ElastiCache or something similar.
Admins can also scale their origin server. Organizations that rely heavily on dynamic content often run web servers on EC2 instances behind Elastic Load Balancing. These web servers scale easily with Auto Scaling Groups and CloudWatch metrics -- most commonly CPU utilization or network throughput -- so make sure you use EC2 instance scaling to handle these demands.
IT teams must take additional steps to prepare for an anticipated traffic spike, but there are cheap and efficient options to manage the influx with CloudFront. Remember, customers only pay for what they use. An ElastiCache cluster may cost a bit, but it won't add any significant charges to a monthly AWS bill. New users can get started with AWS Free Tier, which includes 50 GB of data transfers out and 2 million HTTP and HTTPS requests per month, for up to a year.