Networking and Content Delivery
Amazon CloudFront
Content delivery network (CDN) that delivers static and dynamic web content from edge locations around the world, caching copies retrieved from an origin such as an Amazon S3 bucket or an HTTP server. It reduces latency for users and improves content availability.
Exam phrases that point here
«reduce latency for users around the world who download static content»
CloudFront stores copies of the content in edge locations spread across the world, so each user receives it from a nearby point instead of going all the way to the Region where the origin is.
When not: If the application does not use HTTP (for example, games or VoIP over UDP) or the core requirement is static IP addresses and failover between Regions, AWS Global Accelerator fits better; it does not serve content from a cache but acts as a proxy for TCP or UDP packets at the edge.
«users can access the files in the bucket only through the CDN, not directly»
With Origin Access Control, CloudFront signs its requests to Amazon S3 and the bucket policy admits only that distribution, so the bucket can remain private.
When not: If there is no CDN in the scenario and the task is to give temporary access to a specific object, the clue points to Amazon S3 presigned URLs. And if the bucket is configured as a static website (website endpoint), OAC cannot be used.
«allow only authorized or paying users to access the content»
CloudFront can serve private content only when the request is signed, using signed URLs or signed cookies.
When not: If the requirement is for users to sign in and obtain credentials, think of Amazon Cognito. If access goes directly to S3, with no distribution, the tool is S3 presigned URLs.
«block access from certain countries»
CloudFront geographic restrictions allow lists of allowed or blocked countries; blocked users get a 403 error.
When not: If you also need to filter by IP, headers, or request rate, combine it with AWS WAF. If the goal is to respond differently depending on the user's location, not to block them, the clue points to Amazon Route 53 geolocation routing.
«protect the web application from DDoS attacks and malicious requests at the edge»
All distributions include AWS Shield Standard at no additional cost, and AWS WAF can be associated with them to allow or block requests before they reach the origin.
When not: If the scenario calls for advanced protection with a response team and cost protection during attacks, the answer is AWS Shield Advanced. If the application is not HTTP, the edge is not CloudFront but, for example, Global Accelerator.
«reduce the load on the origin server»
Every object that CloudFront serves from its cache is a request the origin does not have to handle; Origin Shield adds a central caching layer that further reduces requests to the origin.
When not: If the load comes from repeated queries to a database rather than from files or HTTP responses, the solution is usually Amazon ElastiCache or read replicas, not a CDN.
Often paired with
- Amazon S3
- Elastic Load Balancing (ELB)