gcloud beta dns record-sets create Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud beta dns record-sets create - creates a record-set in a managed-zone
- SYNOPSIS
gcloud beta dns record-sets createDNS_NAME--type=TYPE--zone=ZONE,-zZONE(--rrdatas=[RRDATA,…] | [--routing_policy_type=ROUTING_POLICY_TYPE(--routing-policy-item=[ROUTING_POLICY_ITEM,…] |--routing_policy_data=ROUTING_POLICY_DATA| [--routing-policy-backup-data-type=ROUTING_POLICY_BACKUP_DATA_TYPE--routing-policy-primary-data=ROUTING_POLICY_PRIMARY_DATA(--routing-policy-backup-data=ROUTING_POLICY_BACKUP_DATA|--routing-policy-backup-item=[ROUTING_POLICY_BACKUP_ITEM,…]) :--backup-data-trickle-ratio=BACKUP_DATA_TRICKLE_RATIO]) :--enable-geo-fencing--enable-health-checking|--health-check=HEALTH_CHECK])[--location=LOCATION][--ttl=TTL][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
(BETA)This command creates a record-set contained within thespecified managed-zone.- EXAMPLES
- To create a record-set with dnsName foo.bar.com., record type A, rrdata[1.2.3.4, 9.8.7.6] and ttl 60 in my_zone run this:
gcloudbetadnsrecord-setscreatefoo.bar.com.--rrdatas=1.2.3.4,9.8.7.6--type=A--ttl=60--zone=my_zoneTo create a geo routed record-set with dnsName foo.bar.com., record type A,routing_policy_data "us-centra1=1.2.3.4,2.3.4.5;us-west1=3.4.5.6,9.8.7.6" andttl 60 in my_zone.
gcloudbetadnsrecord-setscreatefoo.bar.com.--routing_policy_data="us-centra1=1.2.3.4,2.3.4.5;us-west1=3.4.5.6,9.8.7.6"--routing_policy_type=GEO--type=A--ttl=60--zone=my_zone--location=us-east1-aTo create a record-set with dnsName foo.bar.com., record type A, rrdata[1.2.3.4, 9.8.7.6] and ttl 60 in my_zone in us-east1-a run this:
gcloudbetadnsrecord-setscreateus-east1-a.bar.com.--rrdatas=1.2.3.4,9.8.7.6--type=A--ttl=60--zone=my_zone--location=us-east1-aTo create a failover type health checked routed record-set with dnsNamefoo.bar.com., record type A, primary routing data "config1", backup routing data"us-centra1=1.2.3.4,2.3.4.5;us-west1=3.4.5.6,9.8.7.6", with a trickle trafficratio of 10% to the backup data, and ttl 60 in my_zone.
gcloudbetadnsrecord-setscreatefoo.bar.com.--type=A--ttl=60--zone=routing-policy-test--routing_policy_type=FAILOVER--routing-policy-primary-data='config1'--routing-policy-backup-data-type=GEO--routing-policy-backup-data='us-centra1=1.2.3.4,2.3.4.5;us-west1=3.4.5.6,9.8.7.6'--backup-data-trickle-ratio=0.1--enable-health-checking--zone=my_zoneTo create a geo fenced health checked routed record-set with dnsNamefoo.bar.com., record type A, routing-policy-data"us-centra1=config1,config2;us-west1=3.4.5.6,9.8.7.6", and ttl 60 in my_zone.
gcloudbetadnsrecord-setscreatefoo.bar.com.--type=A--ttl=60--zone=routing-policy-test--routing_policy_type=GEO--routing_policy_data='us-centra1=config1,config2;us-west1=3.4.5.6,9.8.7.6'--enable-health-checking--enable-geo-fencing--zone=my_zone - POSITIONAL ARGUMENTS
DNS_NAME- DNS or domain name of the record-set.
- REQUIRED FLAGS
--type=TYPE- DNS record type of the record-set (e.g. A, AAAA, MX etc.).
--zone=ZONE,-zZONE- Name of the managed zone whose record sets you want to manage.
- Resource record sets arguments. Can specify either --rrdatas or both--routing-policy-data and --routing-policy-type.
Exactly one of these must be specified:
--rrdatas=[RRDATA,…]- DNS data (Address/CNAME/MX info, etc.) of the record-set. This is RDATA; theformat of this information varies depending on the type and class of theresource record.
- Or at least one of these can be specified:
- Routing policy arguments. --routing-policy-type should be specified exactly whenone of --routing-policy-data, --routing-policy-item, or--routing-policy-primary-data is set.
--routing_policy_type=ROUTING_POLICY_TYPE- Indicates what type of routing policy is being specified. As of this time, thisfield can take on either "WRR" for weighted round robin, "GEO" for geo location,or "FAILOVER" for a primary-backup configuration. This field cannot be modified- once a policy has a chosen type, the only way to change it is to delete thepolicy and add a new one with the different type.
ROUTING_POLICY_TYPEmust be one of:GEO,WRR,FAILOVER.This flag argument must be specified if any of the other arguments in this groupare specified.
--enable-geo-fencing- Specifies whether to enable fencing for geo queries.
- Routing policy data arguments. Allows setting one of [routing-policy-data,routing-policy-item, [routing-policy-primary-data, [routing-policy-backup-data,routing-policy-backup-item]]]
Exactly one of these must be specified:
--routing-policy-item=[ROUTING_POLICY_ITEM,…]- Specify this argument multiple times for a weighted round robin (WRR) orgeolocation routing policy. Use this repeated argument for only one routingpolicy type (WRR or geolocation), not both. Similarly, use it only for healthchecking either internal load balancers or external IP addresses, not both.
(e.g.--routing-policy-item=weight=1,rrdatas=1.2.3.4;2.3.4.5,external_endpoints=3.4.5.6;4.5.6.7--routing-policy-item=weight=1,rrdatas=10.0.0.1;10.0.0.2,external_endpoints=10.0.0.4)
weight- The weight of the item. This is specified only for WRR routing policy items.
location- The location corresponding to the item. This is specified only for GEO routingpolicy items.
rrdatas- The list of rrdatas, split by ";".
external_endpoints- The list of health checked ips, split by ";".
internal_load_balancers- The list of health checked internal load balancers, split by ";".
--routing_policy_data=ROUTING_POLICY_DATA- (DEPRECATED) The routing policy data supports one of two formats below,depending on the choice of routing-policy-type.
For --routing-policy-type = "WRR" this flag indicates the weighted round robinpolicy data. The field accepts a semicolon-delimited list of the format"${weight_percent}=${rrdata},${rrdata}". Specify weight as a non-negative number(0 is allowed). Ratio of traffic routed to the target is calculated from theratio of individual weight over the total across all weights.
For --routing-policy-type = "GEO" this flag indicates the geo-locations policydata. The field accepts a semicolon-delimited list of the format"${region}=${rrdata},${rrdata}". Each rrdata can either be an IP address or areference to a forwarding rule of the format "FORWARDING_RULE_NAME","FORWARDING_RULE_NAME@{region}", "FORWARDING_RULE_NAME@global", or the fullresource path of the forwarding rule.
The
--routing_policy_dataflag is deprecated. Use--routing-policy-item instead. - Or at least one of these can be specified:
- Configuration for primary backup routing policy
--routing-policy-backup-data-type=ROUTING_POLICY_BACKUP_DATA_TYPE- For FAILOVER routing policies, the type of routing policy the backup data uses.Currently, this must be GEO.
ROUTING_POLICY_BACKUP_DATA_TYPEmust be (only one valueis supported):GEO.This flag argument must be specified if any of the other arguments in this groupare specified.
--routing-policy-primary-data=ROUTING_POLICY_PRIMARY_DATA- The primary configuration for a primary backup routing policy. Thisconfiguration is a list of forwarding rules of the format"FORWARDING_RULE_NAME", "FORWARDING_RULE_NAME@scope", or the full resource pathof the forwarding rule.
This flag argument must be specified if any of the other arguments in this groupare specified.
--backup-data-trickle-ratio=BACKUP_DATA_TRICKLE_RATIO- Specifies the percentage of traffic to send to the backup targets even when theprimary targets are healthy.
- Routing policy backup data arguments for the primary backup routing policy.Specify either --routing-policy-backup-data or --routing-policy-backup-item, butnot both.
Exactly one of these must be specified:
--routing-policy-backup-data=ROUTING_POLICY_BACKUP_DATA- (DEPRECATED) Specify the backup configuration for a primary backup routingpolicy. This backup configuration uses the same format as therouting-policy-data argument because it functions as another geolocation routingpolicy.
The
--routing-policy-backup-dataflag is deprecated. Use--routing-policy-backup-item instead. --routing-policy-backup-item=[ROUTING_POLICY_BACKUP_ITEM,…]- Specify this argument multiple times to define multiple items for a primarybackup routing policy.
(e.g.--routing-policy-backup-item=location=us-east1-a,rrdatas=1.2.3.4;2.3.4.5,external_endpoints=3.4.5.6;4.5.6.7--routing-policy-backup-item=location=us-east1-b,rrdatas=10.0.0.1;10.0.0.2,external_endpoints=10.0.0.4)
location- The location corresponding to the item.
rrdatas- The list of rrdatas, split by ";".
external_endpoints- The list of health checked ips, split by ";".
internal_load_balancers- The list of health checked internal load balancers, split by ";".
- Health checking arguments. You can specify one of --health-check or--enable-health-checking, but not both.
At most one of these can be specified:
--enable-health-checking- Required if specifying forwarding rule names for rrdata.
--health-check=HEALTH_CHECK- Specifies the health check to be used for public IP health checking. Either thehealth check name or full resource path should be provided.
- OPTIONAL FLAGS
--location=LOCATION- Specifies the desired service location the request is sent to. Defaults to CloudDNS global service. Use --location=global if you want to target the globalservice.
--ttl=TTL- TTL (time to live) for the record-set.
- GCLOUD WIDE FLAGS
- These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$gcloud helpfor details. - NOTES
- This command is currently in beta and might change without notice. Thesevariants are also available:
gclouddnsrecord-setscreategcloudalphadnsrecord-setscreate
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-01-21 UTC.