Per country Geo Steering

I have a question. My current CDN includes points of presence in London, Frankfurt, etc. I want Germany to be presented with my Frankfurt IP and UK with my London IP. Based on 13 available regions it is not possible. Is adding country-specific pools going to be available of I have to look for an alternative provider?

Enterprise customers can use per colo routing in load balancing. Latency (to origin) based routing is also available. The country of a visitor is not nearly as important for routing performance as the colo they connect to. However if for data privacy or other reasons you want to control that routing on a per country of visitor basis it can be done using workers.

2 Likes

Perfect! Thank you for your answers. Let me dig a little deeper into this.

1 Like

Based on what I found I was able to make a test load balancer with a few datacenters and POPs. The top portion is a variable file where I can enable or disable my origins, and which I actually run, and then the module that I call from variable file.

Based on this Terraform script all DNS queries initiated close to let’s say LHR will be handled by my LHR POP, so I think I understand concept of regions and POPs, but I was wondering if, instead of 3-letter POP I could use 2-letter contry code to let the whole country to be served by same origin. I apologize if I miss something obvoius, but I still have some confusion here.

########################## Actual run (variable) file ##################################

terraform {
#? Initialize S3 bucket for terraform state
backend “s3” {
bucket = “mycompanyxxxx-tfstate-useast1”
key = “dns/cloudflare/test/terraform.tfstate”
region = “us-east-1”
}
}
provider “aws” {
region = “us-east-1”
}

#?#####################################################
#? Module hookup
#?#####################################################
module “cloudflare-nlb” {
source = “git::https://mycompany.github.com/cloudflare-nlb.git

#! credentials
email-address = "[email protected]"
api-key = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
account-id = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
notify-email = "[email protected]"

#! Regions (origins) that need to be enabled or disabled
Enable-NJ = true
Enable-VA = true
Enable-LHR = true
Enable-FRA = true
}

#################### Load Balancer module (called from github) ##########################

provider “cloudflare” {
version = “~> 2.0”

… any other configuration

email = “{var.email-address}" api_key = "{var.api-key}”
account_id = “${var.account-id}”
}

#* ############################# Healthcheck Monitor ####################################
resource “cloudflare_load_balancer_monitor” “conduit-monitor” {
type = “https”
expected_body = “SUCCESS”
expected_codes = “2xx”
method = “GET”
timeout = 5
path = “/statuscheck.aspx”
interval = 30
retries = 1
description = “conduit.mycompany.com monitor”
header {
header = “Host”
values = [“conduit.mycompany.com”]
}
allow_insecure = false
follow_redirects = false
}

#* ################################### LHR Pool ########################################
resource “cloudflare_load_balancer_pool” “lhr-pool-conduit” {
name = “LHR-POP”
origins {
name = “lhr.conduit.cloudflare.mycompany.com
address = “50.60.245.147”
enabled = var.Enable-LHR
}

description = “LHR copy of conduit.cloudflare.mycompany.com
enabled = true
monitor = “${cloudflare_load_balancer_monitor.conduit-monitor.id}”
minimum_origins = 1
notification_email = var.notify-email
}

#* ################################### FRA Pool ########################################
resource “cloudflare_load_balancer_pool” “fra-pool-conduit” {
name = “FRA-POP”
origins {
name = “fra.conduit.cloudflare.mycompany.com
address = “50.60.246.147”
enabled = var.Enable-FRA
}

description = “FRA copy of conduit.cloudflare.mycompany.com
enabled = true
monitor = “${cloudflare_load_balancer_monitor.conduit-monitor.id}”
minimum_origins = 1
notification_email = var.notify-email
}

#* ############################## Dynamic DC Pool #####################################
resource “cloudflare_load_balancer_pool” “dc-pool-conduit-dynamic” {
name = “DC-DYNAMIC”
origins {
name = “nj.conduit.cloudflare.mycompany.com
address = “50.60.89.17”
weight = 0.5
enabled = var.Enable-NJ
}
origins {
name = “va.conduit.cloudflare.mycompany.com
address = “50.60.235.17”
weight = 0.5
enabled = var.Enable-VA
}

description = “NJ-VA dynamic copy of conduit.cloudflare.mycompany.com
enabled = true
monitor = cloudflare_load_balancer_monitor.conduit-monitor.id
minimum_origins = 1
notification_email = var.notify-email
}
#* ############################## Static DC Pool #####################################
resource “cloudflare_load_balancer_pool” “dc-pool-conduit-static” {
name = “DC-STATIC”
origins {
name = “nj.conduit.cloudflare.mycompany.com
address = “50.60.89.17”
weight = 0.5
enabled = var.Enable-NJ
}
origins {
name = “va.conduit.cloudflare.mycompany.com
address = “50.60.235.17”
weight = 0.5
enabled = var.Enable-VA
}

description = “NJ-VA static copy of conduit.cloudflare.mycompany.com
enabled = true
monitor = cloudflare_load_balancer_monitor.conduit-monitor.id
minimum_origins = 0
notification_email = var.notify-email
}

#* ################# conduit.cloudflare.mycompany.com load balancer ######################
#*######################################################################################
resource “cloudflare_load_balancer” “load-balancer-conduit” {
zone_id = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
name = “conduit.cloudflare.mycompany.com
fallback_pool_id = cloudflare_load_balancer_pool.dc-pool-conduit-static.id
default_pool_ids = [cloudflare_load_balancer_pool.dc-pool-conduit-dynamic.id,
cloudflare_load_balancer_pool.dc-pool-conduit-static.id]
description = “conduit.cloudflare.mycompany.com geo-based load balancer”
proxied = true
steering_policy = “geo”
pop_pools {
pop = “LHR”
pool_ids = [cloudflare_load_balancer_pool.lhr-pool-conduit.id,
cloudflare_load_balancer_pool.dc-pool-conduit-dynamic.id,
cloudflare_load_balancer_pool.dc-pool-conduit-static.id]
}
pop_pools {
pop = “FRA”
pool_ids = [cloudflare_load_balancer_pool.fra-pool-conduit.id,
cloudflare_load_balancer_pool.dc-pool-conduit-dynamic.id,
cloudflare_load_balancer_pool.dc-pool-conduit-static.id]
}
region_pools {
region = “WNAM”
pool_ids = [cloudflare_load_balancer_pool.dc-pool-conduit-dynamic.id,
cloudflare_load_balancer_pool.dc-pool-conduit-static.id]
}
region_pools {
region = “ENAM”
pool_ids = [cloudflare_load_balancer_pool.dc-pool-conduit-dynamic.id,
cloudflare_load_balancer_pool.dc-pool-conduit-static.id]
}
}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.