AWS Certified Solutions Architect – Associate
CloudFront vs Global Accelerator: when to use each
Amazon CloudFront is a content delivery network: it caches your web content at edge locations and serves it from the one closest to the viewer. AWS Global Accelerator caches nothing: it gives you two static anycast IPv4 addresses and carries TCP or UDP traffic over the AWS global network to the healthiest, nearest Regional endpoint. Pick CloudFront for cacheable HTTP content, and Global Accelerator for fixed IP addresses, non-HTTP protocols, or fast Regional failover.
CloudFront: cache content near viewers
CloudFront speeds up delivery of static and dynamic web content such as HTML, CSS, JavaScript and images. A request goes to the edge location with the lowest latency. If the object is cached there, CloudFront returns it at once. If not, CloudFront fetches it from your origin, such as an S3 bucket or an HTTP server on EC2 or on premises.
By default an object stays in an edge location for 24 hours. Your origin can set headers to change that. Data transfer from AWS origins such as S3 or Elastic Load Balancing to CloudFront is free; you pay for transfer out to viewers and for requests.
Global Accelerator: static IPs and the AWS network
A standard accelerator gives you two static IPv4 addresses, anycast from the AWS edge network. Dual-stack adds two IPv6 addresses. The addresses stay with the accelerator until you delete it, so customers can put them on firewall allow lists once. Endpoints can be Network Load Balancers, Application Load Balancers, EC2 instances or Elastic IP addresses in one or more Regions.
Listeners accept TCP and UDP. Traffic enters at the nearest edge location and travels the AWS global network to the best Regional endpoint based on health, client location and your policies. If the endpoint in one Region fails, traffic is moved to the next closest healthy Region. AWS lists gaming, VoIP, IoT and other latency-sensitive applications as use cases.
By default, client affinity is None: Global Accelerator hashes the 5-tuple (source IP, source port, destination IP, destination port, protocol), so two connections from one client can reach different endpoints. Set it to Source IP to hash only source and destination IP and keep a user on one endpoint.
How to choose
Ask what the traffic is. Cacheable HTTP content goes to CloudFront. UDP game traffic, a need for fixed IP addresses, or quick failover between Regions points to Global Accelerator. Both use AWS edge locations, so being at the edge does not decide it. Caching does.
Where the exam catches people
- Believing CloudFront handles UDP game traffic: CloudFront serves HTTP content; Global Accelerator listeners accept TCP and UDP.
- Believing Global Accelerator caches responses: it routes traffic to endpoints and stores nothing.
- Believing CloudFront gives you two fixed IPs to allow-list: static anycast addresses are a Global Accelerator feature.
- Believing the default affinity keeps a user on one endpoint: the default hashes the source port too, so set
Source IPaffinity for stateful apps.