Search code examples
amazon-web-servicesamazon-cloudfront

Enforcing geo targeting in AWS


I have my site set up running WordPress on EC2, with the domain set up with Route 53 and CloudFront.

Currently, all non-Australian visitors are set up to be blocked from the site with CloudFront restriction.

I need to set it up so that non-Australian visitors get directed to the .com domain.

Any insight on how to achieve this in AWS?


Solution

  • Amazon Route 53 can provide geolocation routing where DNS names are resolved differently based upon the location of the DNS request.

    For example, you can configure Route 53 so that a DNS request coming from Australia is sent to a CloudFront distribution, while other ('default') requests are sent to a different location (eg a CNAME record pointing to a different .com domain). CloudFront can then do an extra level of enforcement to prevent users from bypassing the DNS location check (as you currently have it configured).

    Thus, it is actually Amazon Route 53 that will decide where to send the traffic, prior to hitting Amazon CloudFront.