Create domain configurations
Increase the response reliability of your site using a global load balancer that routes traffic based on real-time data center performance, health, and global internet conditions.
What you'll do
Create a Global Traffic Management (GTM) domain, datacenter, and property to split or balance your traffic between two or more data centers.
1. Create or import a domain
Create new
Create a new GTM domain and define its type as one of failover-only
, static
, weighted
, basic
, or full
.
resource "akamai_gtm_domain" "my_gtm_domain" {
name = "my-gtm-domain.akadns.net"
type = "weighted"
group = 12345
contract = "C-0N7RAC7"
email_notification_list = ["jsmith@email.com"]
comment = "My new domain"
}
Import a domain
-
Get a list of all of your domains to find the domain
name
you want.data "akamai_gtm_domains" "my_domains" { } output "my_domains" { value = data.akamai_gtm_domains.my_domains }
Changes to Outputs: + my_domains = { + domains = [ + { + acg_id = "C-0N7RAC7" + activation_state = "COMPLETE" + change_id = "" + delete_request_id = "" + last_modified = "2023-09-26T18:20:53.000+00:00" + last_modified_by = "jsmith" + links = [ + { + href = "https://akab-h05tnam3wl42son7nktnlnnx-kbob3i3v.luna.akamaiapis.net/config-gtm/v1/domains/my-domain-1.akadns.net" + rel = "self" }, ] + modification_comments = "My domain" + name = "my-domain-1.akadns.net" + sign_and_serve = false + sign_and_serve_algorithm = "" + status = "2023-12-23 19:57 GMT: Current configuration has been propagated to all GTM nameservers" }, + { + acg_id = "C-0N7RAC7" + activation_state = "COMPLETE" + change_id = "" + delete_request_id = "" + last_modified = "2023-10-01T16:18:11.000+00:00" + last_modified_by = "jsmith" + links = [ + { + href = "https://akab-h05tnam3wl42son7nktnlnnx-kbob3i3v.luna.akamaiapis.net/config-gtm/v1/domains/my-domain-2.akadns.net" + rel = "self" }, ] + modification_comments = "My domain 2" + name = "my-domain-2.akadns.net" + sign_and_serve = false + sign_and_serve_algorithm = "" + status = "2023-11-23 19:57 GMT: Current configuration has been propagated to all GTM nameservers" }, ] }
-
To export a domain and its related resources, use the
name
of the domain you want as the value of theexport-domain
argument of theakamai
CLI command.akamai terraform --edgerc {location-of-your-edgerc-file} --section {section-of-edgerc-to-use} export-domain {"your-domain-name"}
-
Run the included import script to populate your Terraform state. This prevents Terraform from attempting to recreate your assets.
2. Set up a data center
Use your domain to create at least two data centers to which the load balancer directs traffic. Pass the data center's ID downstream when you configure your response behavior.
resource "akamai_gtm_datacenter" "my_datacenter" {
domain = "my-gtm-domain.akadns.net"
nickname = "my_datacenter_1"
}
3. Configure a property
Configure a set of rules in a GTM property that define load balancing response behavior for your site's requests.
Note: This property type is independent of property manager and only configures your GTM settings.
resource "akamai_gtm_property" "my_gtm_property" {
domain = "my-gtm-domain.akadns.net"
name = "my_gtm_property"
type = "weighted-round-robin"
score_aggregation_type = "median"
handout_limit = 5
handout_mode = "normal"
traffic_target {
datacenter_id = 3131
}
}
See also
For more information on additional arguments or attributes for these resources, see the corresponding resource reference.
Updated 18 days ago