Certopolis

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 IP affinity for stateful apps.

Written from Amazon Web Services's documentation

Try 3 questions on this

Pick an answer to see why each option is right or wrong.

  1. A company must publish two fixed IP addresses to enterprise customers who allow-list destinations in their firewalls, and must still route each customer to the nearest of three Regional deployments behind Network Load Balancers. A solutions architect must pick the front door. Which solution meets these requirements?

    Right. In the game that’s Renown for your Design High-Performing Architectures building.

    Not that one: B is right. In the game your Design High-Performing Architectures building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    On the routing: "Global Accelerator uses the AWS global network to route traffic to the optimal regional endpoint based on health, client location, and policies that you configure", where "endpoints for standard accelerators can be Network Load Balancers, Application Load Balancers, Amazon EC2 instances, or Elastic IP addresses that are located in one AWS Region or multiple Regions." One pair of addresses for the customer, three Regions behind it.

    Written from docs.aws.amazon.com/global-accelerator/latest/dg/what-is-global-accelerator.html

  2. A multiplayer game server accepts UDP traffic from players worldwide and runs behind Network Load Balancers in three Regions. Players in distant Regions see high and variable latency over the public internet. A solutions architect must choose between Amazon CloudFront and AWS Global Accelerator to improve it. Which approach will meet these requirements?

    Right. In the game that’s Renown for your Design High-Performing Architectures building.

    Not that one: D is right. In the game your Design High-Performing Architectures building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    And "Global Accelerator directs traffic over the AWS global network to endpoints in the nearest Region to the client." The traffic enters at the nearest edge and travels AWS's backbone rather than the public internet, which is the variability the players are seeing. CloudFront is a content delivery network for HTTP, with nothing to cache here.

    Written from docs.aws.amazon.com/global-accelerator/latest/dg/what-is-global-accelerator.html

  3. An application behind a Global Accelerator standard listener keeps session state in memory on each endpoint. Users opening several connections from one machine are served by different endpoints and lose their session, and the listener is on its default affinity setting. Users need to keep their session across all of their connections. Which approach will meet these requirements?

    Right. In the game that’s Renown for your Design High-Performing Architectures building.

    Not that one: A is right. In the game your Design High-Performing Architectures building would lose a little Renown, and this question would come back later.